diff --git a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/events/Events.java b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/events/Events.java index 0ee89f68197..1abb206cfba 100644 --- a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/events/Events.java +++ b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/events/Events.java @@ -25,17 +25,17 @@ public final class Events { private Events() {} public static void click(WebDriver driver, By by) { - (new WebDriverWait(driver, 30)).until(ExpectedConditions.elementToBeClickable(by)); + (new WebDriverWait(driver, 15)).until(ExpectedConditions.elementToBeClickable(by)); driver.findElement(by).click(); } public static void sendKeys(WebDriver driver, By by, String sendKeys) { - (new WebDriverWait(driver, 30)).until(ExpectedConditions.elementToBeClickable(by)); + (new WebDriverWait(driver, 15)).until(ExpectedConditions.elementToBeClickable(by)); driver.findElement(by).sendKeys(sendKeys); } public static void sendEnter(WebDriver driver, By by) { - (new WebDriverWait(driver, 30)).until(ExpectedConditions.elementToBeClickable(by)); + (new WebDriverWait(driver, 15)).until(ExpectedConditions.elementToBeClickable(by)); driver.findElement(by).sendKeys(Keys.ENTER); } } diff --git a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/objectRepository/DatabaseServicePage.java b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/objectRepository/DatabaseServicePage.java index 6d58d40770e..4e1c7838b73 100644 --- a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/objectRepository/DatabaseServicePage.java +++ b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/objectRepository/DatabaseServicePage.java @@ -17,7 +17,7 @@ public class DatabaseServicePage { By selectInterval = By.xpath("//select[@id='ingestionType']"); By confirmationDeleteText = By.cssSelector("[data-testid='confirmation-text-input']"); By viewService = By.cssSelector("[data-testid='view-service-button']"); - By clickDatabase = By.xpath("//tr[@data-testid='column']/td"); + By clickDatabase = By.xpath("//tr[@data-testid='column']/td/a"); By deleteDatabase = By.cssSelector("[data-testid='delete-button']"); public By ingestionInterval(String interval) { diff --git a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/objectRepository/TagsPage.java b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/objectRepository/TagsPage.java index 0b2e19d890a..c1f296e8856 100644 --- a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/objectRepository/TagsPage.java +++ b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/objectRepository/TagsPage.java @@ -36,6 +36,7 @@ public class TagsPage { By headerSettingsTags = By.cssSelector("[data-testid='menu-item-Tags']"); By sortBy = By.cssSelector("[data-testid='sortBy']"); By editTags = By.xpath("(//div[@data-testid=\"tag-container\"])[1]"); + By editBreadcrumbTag = By.xpath("//div[@data-testid='tag-container']/div/button"); public By tagFilter(String tagCategoryDisplayName, String tagDisplayName) { return By.cssSelector("[data-testid='checkbox'][id='" + tagCategoryDisplayName + "." + tagDisplayName + "']"); diff --git a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/objectRepository/UserPage.java b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/objectRepository/UserPage.java index 9c3d54c2e8a..c19f7e3dbc3 100644 --- a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/objectRepository/UserPage.java +++ b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/objectRepository/UserPage.java @@ -14,14 +14,18 @@ public class UserPage { By rolesList = By.cssSelector("[data-testid='menu-button'][id='menu-button-User']"); By selectUser = By.xpath("//div[@data-testid='data-container']//p"); - By userFilterCount = By.xpath("//span[@data-testid='filter-count'][text()[contains(.,'101')]]"); + By userFilterCount = By.xpath("//span[@data-testid='filter-count'][text()='101']"); By adminFilterCount = By.xpath("//span[@data-testid='filter-count'][text()='1']"); + By adminFilterCountAfterDelete = By.xpath("//span[@data-testid='filter-count'][text()='0']"); By userListSearchBar = By.cssSelector("[data-testid='searchbar']"); By userListSearchResult = By.xpath("//div[@data-testid='user-card-container']/div/div[@data-testid='user-card-container']"); By closeCheckBoxDropDown = By.cssSelector("[data-testid='close-dropdown']"); By admin = By.cssSelector("[title='Admins']"); By users = By.cssSelector("[title='Users']"); + By editRole = By.cssSelector("[data-testid='edit-roles']"); + By saveRole = By.cssSelector("[data-testid='save-roles']"); + By removeRole = By.xpath("(//div[@class='css-xb97g8'])[2]"); public By selectRole(String role) { return By.cssSelector("[data-testid='" + role + "']"); diff --git a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/objectRepository/Webhooks.java b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/objectRepository/Webhooks.java index cb7ab4595a4..b14f3bc5f1b 100644 --- a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/objectRepository/Webhooks.java +++ b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/objectRepository/Webhooks.java @@ -20,6 +20,9 @@ public class Webhooks { By checkbox = By.xpath("//input[@data-testid='entity-created-checkbox']"); By entityCreatedMenu = By.xpath("(//button[@id='menu-button-select entities'])[1]"); By allEntities = By.xpath("(//input[@type='checkbox'])[2]"); - By checkWebhook = By.xpath("//button[@data-testid='webhook-link']"); By toast = By.xpath("(//div[@class='Toastify__toast-body']/div)[2]"); + + public By checkWebhook(String webHookName) { + return By.xpath("//button[@data-testid='webhook-link'][text()='" + webHookName + "']"); + } } diff --git a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/Webhooks/WebhooksPageTest.java b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/Webhooks/WebhooksPageTest.java index 135e1c8c669..70b05450a96 100644 --- a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/Webhooks/WebhooksPageTest.java +++ b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/Webhooks/WebhooksPageTest.java @@ -69,17 +69,17 @@ class WebhooksPageTest { Events.click(webDriver, webhooks.addWebhook()); Events.sendKeys(webDriver, webhooks.name(), name); Events.click(webDriver, webhooks.descriptionBox()); - Events.sendKeys(webDriver, webhooks.focusedDescriptionBox(), "test"); + Events.sendKeys(webDriver, webhooks.focusedDescriptionBox(), faker.address().toString()); Events.sendKeys(webDriver, webhooks.endpoint(), "https://www.example.com"); Events.click(webDriver, webhooks.checkbox()); - Thread.sleep(waitTime); Events.click(webDriver, webhooks.entityCreatedMenu()); Events.click(webDriver, webhooks.allEntities()); actions.click(); actions.perform(); Events.click(webDriver, common.saveWebhook()); - Thread.sleep(2000); - WebElement checkName = wait.until(ExpectedConditions.presenceOfElementLocated(webhooks.checkWebhook())); + Thread.sleep(waitTime); + WebElement checkName = wait.until(ExpectedConditions.presenceOfElementLocated(webhooks.checkWebhook(name))); + Thread.sleep(waitTime); Assert.assertTrue(checkName.isDisplayed()); Assert.assertEquals(checkName.getText(), name); } @@ -102,7 +102,7 @@ class WebhooksPageTest { actions.click(); actions.perform(); Events.click(webDriver, common.saveWebhook()); - Thread.sleep(2000); + Thread.sleep(waitTime); } WebElement errorMessage = webDriver.findElement(webhooks.toast()); Assert.assertTrue(errorMessage.isDisplayed()); diff --git a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/common/CommonTests.java b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/common/CommonTests.java index 399a521b67b..8037070c2fd 100644 --- a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/common/CommonTests.java +++ b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/common/CommonTests.java @@ -345,7 +345,6 @@ class CommonTests { Events.sendKeys(webDriver, common.searchBar(), tableName); Events.click(webDriver, common.searchSuggestion()); Thread.sleep(waitTime); - // actions.moveToElement(webDriver.findElement(common.editAssociatedTagButton())).perform(); Events.click(webDriver, common.editAssociatedTagButton()); Events.click(webDriver, common.enterAssociatedTagName()); for (int i = 0; i <= 2; i++) { @@ -364,7 +363,6 @@ class CommonTests { Events.click(webDriver, common.saveAssociatedTag()); Thread.sleep(waitTime); Events.click(webDriver, common.editAssociatedTagButton()); - Object tagsCount = webDriver.findElements(common.tagCount()).size(); Events.click(webDriver, common.explore()); Thread.sleep(waitTime); try { diff --git a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/databaseService/DatabaseServicePageTest.java b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/databaseService/DatabaseServicePageTest.java index a11ecc68a07..789f181b9a3 100644 --- a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/databaseService/DatabaseServicePageTest.java +++ b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/databaseService/DatabaseServicePageTest.java @@ -35,6 +35,7 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert; @@ -188,8 +189,9 @@ class DatabaseServicePageTest { void deleteDatabaseService() throws InterruptedException { openDatabaseServicePage(); Events.click(webDriver, databaseServicePage.serviceName(serviceName)); - Thread.sleep(waitTime); Events.click(webDriver, databaseServicePage.clickDatabase()); + Thread.sleep(waitTime); + wait.until(ExpectedConditions.urlContains("/database/" + serviceName + ".default")); Events.click(webDriver, common.manage()); Events.click(webDriver, databaseServicePage.deleteDatabase()); Events.sendKeys(webDriver, databaseServicePage.confirmationDeleteText(), "DELETE"); diff --git a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/glossary/GlossaryPageTest.java b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/glossary/GlossaryPageTest.java index fb3746a7e86..7eaa3be30f6 100644 --- a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/glossary/GlossaryPageTest.java +++ b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/glossary/GlossaryPageTest.java @@ -187,11 +187,6 @@ class GlossaryPageTest { Events.sendKeys(webDriver, common.urlLink(), faker.address().toString()); Events.sendKeys(webDriver, common.linkText(), faker.address().firstName()); Events.click(webDriver, common.okButton()); - Events.click(webDriver, glossary.addReviewerButton()); - for (int i = 1; i <= 2; i++) { - Events.click(webDriver, glossary.checkboxAddUser(i)); - } - Events.click(webDriver, common.descriptionSaveButton()); Events.click(webDriver, glossary.saveGlossaryTerm()); } @@ -221,9 +216,15 @@ class GlossaryPageTest { Events.click(webDriver, common.containsText(glossaryName)); Events.click(webDriver, common.containsText(glossaryName)); Events.click(webDriver, common.containsText(termName)); - Events.click(webDriver, glossary.reviewers()); + Events.click(webDriver, common.manage()); Events.click(webDriver, common.addGlossaryReviewer()); + Thread.sleep(waitTime); + Events.click(webDriver, glossary.checkboxAddUser(1)); + Thread.sleep(waitTime); + Events.click(webDriver, glossary.checkboxAddUser(2)); + Thread.sleep(waitTime); Events.click(webDriver, glossary.checkboxAddUser(3)); + Thread.sleep(waitTime); Events.click(webDriver, glossary.saveTermReviewer()); Thread.sleep(waitTime); Object reviewerCount = webDriver.findElements(common.reviewCount()).size(); @@ -237,7 +238,7 @@ class GlossaryPageTest { Events.click(webDriver, common.containsText(glossaryName)); Events.click(webDriver, common.containsText(glossaryName)); Events.click(webDriver, common.containsText(termName)); - Events.click(webDriver, glossary.reviewers()); + Events.click(webDriver, common.manage()); Thread.sleep(waitTime); actions.moveToElement(webDriver.findElement(common.removeAssociatedTag())).perform(); Events.click(webDriver, common.removeAssociatedTag()); @@ -253,13 +254,12 @@ class GlossaryPageTest { Events.click(webDriver, common.containsText(glossaryName)); Events.click(webDriver, common.containsText(glossaryName)); Events.click(webDriver, common.containsText(termName)); - Events.click(webDriver, glossary.reviewers()); - Events.click(webDriver, common.addGlossaryReviewer()); + Events.click(webDriver, common.manage()); + actions.moveToElement(webDriver.findElement(common.removeAssociatedTag())).perform(); for (int i = 1; i <= 2; i++) { - Events.click(webDriver, glossary.checkboxAddUser(i)); + Events.click(webDriver, common.removeAssociatedTag()); + Thread.sleep(waitTime); } - Events.click(webDriver, glossary.saveTermReviewer()); - Thread.sleep(waitTime); Object reviewerCount = webDriver.findElements(common.reviewCount()).size(); Assert.assertEquals(reviewerCount.toString(), "0"); } diff --git a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/roles/RolesPageTest.java b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/roles/RolesPageTest.java index 5fe469e301d..be818df1f61 100644 --- a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/roles/RolesPageTest.java +++ b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/roles/RolesPageTest.java @@ -102,7 +102,7 @@ class RolesPageTest { openRolesPage(); Events.click(webDriver, common.containsText(roleName)); Events.click(webDriver, common.editTagCategoryDescription()); - Events.sendKeys(webDriver, common.focusedDescriptionBox(), Keys.COMMAND + "A"); + Events.sendKeys(webDriver, common.focusedDescriptionBox(), Keys.CONTROL + "A"); Events.sendKeys(webDriver, common.focusedDescriptionBox(), description); Events.click(webDriver, common.editDescriptionSaveButton()); webDriver.navigate().refresh(); diff --git a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/tags/TagsPageTest.java b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/tags/TagsPageTest.java index e61ce76e449..2b9f71c3f29 100644 --- a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/tags/TagsPageTest.java +++ b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/tags/TagsPageTest.java @@ -187,7 +187,7 @@ class TagsPageTest { } catch (TimeoutException e) { Assert.fail("Table is not present for the selected tag filter"); } - Events.click(webDriver, common.editAssociatedTagButton()); + Events.click(webDriver, tagsPage.editBreadcrumbTag()); Events.click(webDriver, tagsPage.removeAssociatedTag()); Events.click(webDriver, common.saveAssociatedTag()); } @@ -219,7 +219,17 @@ class TagsPageTest { @Test @Order(11) void TagUsageCheck() throws InterruptedException { - openTagsPage(); + Events.click(webDriver, common.closeWhatsNew()); + Events.click(webDriver, common.headerItem("explore")); + Events.click(webDriver, tagsPage.lastTableLink()); + Thread.sleep(waitTime); + Events.click(webDriver, tagsPage.editTags()); + Events.click(webDriver, common.enterAssociatedTagName()); + Events.sendKeys(webDriver, common.enterAssociatedTagName(), "P"); + Events.click(webDriver, common.tagListItem()); + Events.click(webDriver, common.saveAssociatedTag()); + Events.click(webDriver, common.headerSettings()); + Events.click(webDriver, tagsPage.headerSettingsTags()); Events.click(webDriver, common.containsText("PersonalData")); Events.click(webDriver, tagsPage.usageCountElementIndex(1)); Thread.sleep(2000); diff --git a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/teams/TeamsPageTest.java b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/teams/TeamsPageTest.java index 4c6fc02cfe2..642b83bdd05 100644 --- a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/teams/TeamsPageTest.java +++ b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/teams/TeamsPageTest.java @@ -196,6 +196,7 @@ class TeamsPageTest { // Select the created listed team Events.click(webDriver, common.containsText(teamDisplayName)); // Events.click(webDriver,teamsPage.getAsset()); + Events.click(webDriver, common.manage()); Events.click(webDriver, teamsPage.ownerDropdown()); String ownerName = webDriver.findElement(teamsPage.selectOwner()).getText(); Events.click(webDriver, teamsPage.selectOwner()); diff --git a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/users/UsersPageTest.java b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/users/UsersPageTest.java index ce57d89b3a0..5e934a587f6 100644 --- a/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/users/UsersPageTest.java +++ b/openmetadata-ui/src/test/java/org/openmetadata/catalog/selenium/pages/users/UsersPageTest.java @@ -61,12 +61,15 @@ class UsersPageTest { openUsersPage(); Events.click(webDriver, userPage.users()); Events.click(webDriver, userPage.selectUser()); - Events.click(webDriver, userPage.rolesList()); - Events.click(webDriver, userPage.selectRole("Admin")); - actions.moveToElement(userPage.closeCheckBoxDropDown(), 100, 200); - actions.click(); - actions.perform(); - Events.click(webDriver, common.descriptionSaveButton()); + Events.click(webDriver, userPage.editRole()); + Events.click(webDriver, common.containsText("Data Consumer")); + Events.click(webDriver, common.containsText("Admin")); + Events.click(webDriver, userPage.saveRole()); + Thread.sleep(waitTime); + Events.click(webDriver, common.headerSettings()); + Events.click(webDriver, common.headerSettingsTeams()); + Events.click(webDriver, userPage.users()); + webDriver.navigate().refresh(); Thread.sleep(waitTime); Object afterUsersCount = webDriver.findElement(userPage.userFilterCount()).getAttribute("innerHTML"); Thread.sleep(waitTime); @@ -81,15 +84,17 @@ class UsersPageTest { openUsersPage(); Events.click(webDriver, userPage.users()); Events.click(webDriver, userPage.selectUser()); - Events.click(webDriver, userPage.rolesList()); - Events.click(webDriver, userPage.selectRole("Admin")); - actions.moveToElement(userPage.closeCheckBoxDropDown(), 100, 200); - actions.click(); - actions.perform(); - Events.click(webDriver, common.descriptionSaveButton()); - Thread.sleep(1000); - Object afterAdminCount = webDriver.findElement(userPage.adminFilterCount()).getAttribute("innerHTML"); - Thread.sleep(1000); + Events.click(webDriver, userPage.editRole()); + Events.click(webDriver, userPage.removeRole()); + Events.click(webDriver, userPage.saveRole()); + Thread.sleep(waitTime); + Events.click(webDriver, common.headerSettings()); + Events.click(webDriver, common.headerSettingsTeams()); + Events.click(webDriver, userPage.users()); + webDriver.navigate().refresh(); + Thread.sleep(waitTime); + Object afterAdminCount = webDriver.findElement(userPage.adminFilterCountAfterDelete()).getAttribute("innerHTML"); + Thread.sleep(waitTime); Assert.assertEquals(afterAdminCount, "0"); Object afterUsersCount = webDriver.findElement(userPage.userFilterCount()).getAttribute("innerHTML"); Assert.assertEquals(afterUsersCount, "101");