Fixing selenium tests with assertions (#3353)

* altering tests

* updated teams page with chrome option

* added fix for tests

* testid changes

* Entity details test (#3373)

* Adding Entity details test fix

* Java checkstyle format

* Selenium tests fix

* adding chrome options

Co-authored-by: kushal <kushalshinde2512@gmail.com>

* test fix

* test fix

* test fix

* text fix

* tests fix

* test fix

* test fix (#3428)

Co-authored-by: kushal <kushalshinde2512@gmail.com>

* added test fixes

* adding wait for add webhook button

Co-authored-by: kshinde2512 <67048554+kshinde2512@users.noreply.github.com>
Co-authored-by: kushal <kushalshinde2512@gmail.com>
This commit is contained in:
parthp2107 2022-03-15 20:18:29 +05:30 committed by GitHub
parent 7eaea054c1
commit 82540b6e18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 220 additions and 112 deletions

View File

@ -38,7 +38,7 @@ public class Common {
By searchResults = By.cssSelector("[data-testid='search-results']");
By searchBar = By.cssSelector("[data-testid='searchBox']");
By searchSuggestion = By.cssSelector("[data-testid='data-name']");
By editAssociatedTagButton = By.xpath("//div[@data-testid='tag-conatiner']//span");
By editAssociatedTagButton = By.xpath("//div[@data-testid='tag-container']//span");
By enterAssociatedTagName = By.cssSelector("[data-testid='associatedTagName']");
By tagListItem = By.cssSelector("[data-testid='list-item']");
By saveAssociatedTag = By.cssSelector("[data-testid='saveAssociatedTag']");
@ -51,7 +51,7 @@ public class Common {
By databaseName = By.cssSelector("[data-testid='database']");
By addTagCategory = By.cssSelector("[data-testid='add-category']");
By addTagButton = By.cssSelector("[data-testid='add-new-tag-button']");
By tagCount = By.xpath("//div[@data-testid='tag-conatiner']/div/div");
By tagCount = By.xpath("//div[@data-testid='tag-container']/div/div");
By errorMessage = By.cssSelector("[data-testid='error-message']");
By matchesInDescription = By.xpath("(//div[@data-testid='matches-stats'][1])/span[3]");
By tagCountSearch = By.xpath("(//div[@data-testid='description-text'][1])/div/span/span[@class='text-highlighter']");
@ -80,11 +80,12 @@ public class Common {
By versionRadioButton = By.xpath("//span[@data-testid=\"select-version\"]");
By topics = By.xpath("(//button[@data-testid='tab'])[2]");
By selectTable = By.xpath("(//button[@data-testid=\"table-link\"])[1]");
By addTag = By.xpath("(//div[@data-testid='tag-conatiner'])[1]");
By addTag = By.xpath("(//div[@data-testid='tag-container'])[1]");
By breadCrumbTags = By.xpath("(//span[@data-testid='tags'])");
By tagsAdded = By.cssSelector("span[class='tw-no-underline hover:tw-no-underline tw-px-1']");
By headerSettingsTeams = By.cssSelector("[data-testid='menu-item-Teams']");
By viewMore = By.xpath("//div[@data-testid='filter-containers-2']/p]");
By home = By.cssSelector("[data-testid='image']");
public List<WebElement> versionRadioButton() {
return webDriver.findElements(versionRadioButton);
@ -161,4 +162,16 @@ public class Common {
public By selectTableLink(int index) {
return By.xpath("(//button[@data-testid='table-link'])[" + index + "]");
}
public By followingTable(String table) {
return By.xpath("//div[@data-testid='Following data-" + table + "']");
}
public By recentlySearchedText(String text) {
return By.xpath("//div[@data-testid='Recently-Search-" + text + "']");
}
public By removeRecentlySearchedText(String text) {
return By.xpath("//div[@data-testid='Recently-Search-" + text + "']/div/div/button/img");
}
}

View File

@ -12,7 +12,7 @@ public class DashboardDetails {
@Nonnull WebDriver webDriver;
By dashboard = By.xpath("(//button[@data-testid='tab'])[3]");
By editChartDescription = By.xpath("(//img[@data-testid='image']/parent::button)[3]");
By editChartDescription = By.xpath("//div[@data-testid='description']/span/span");
By dashboardDescriptionBox = By.xpath("(//div[@data-testid='description']/div/span)[1]");
By descriptionBox = By.xpath("(//div[@data-testid='description'])[2]");
By addChartTag = By.xpath("(//span[@data-testid='tags'])[2]");

View File

@ -26,17 +26,16 @@ public class ExplorePage {
By pagination = By.xpath("//div[@data-testid=\"pagination-button\"]");
By bigQueryCheckbox = By.xpath("//input[@data-testid=\"checkbox\"][@id=\"BigQuery\"]");
By serviceName = By.xpath("//div[@data-testid=\"checkbox-label\"]");
By countService = By.xpath("//div[@data-testid='filter-containers-0']/div/span");
By countService = By.xpath("//div[@data-testid='filter-containers-0']/label/span");
By errorMessage = By.xpath("//p[@data-testid=\"no-search-results\"]");
By glueCheckbox = By.xpath("//input[@data-testid=\"checkbox\"][@id=\"Glue\"]");
By selectTable = By.xpath("(//button[@data-testid=\"table-link\"])[1]");
By addTag = By.xpath("//div[@data-testid='tag-conatiner']/div/span/span");
By addTag = By.xpath("//div[@data-testid='tag-container']/div/span/span");
By serviceText = By.xpath("//h6[contains(text(),'Service')]");
By tierText = By.xpath("//h6[contains(text(),'Tier')]");
By databaseText = By.xpath("//h6[contains(text(),'Database')]");
By tagText = By.xpath("//h6[contains(text(),'Tags')]");
By lastWeekSortDesc = By.xpath("//i[@data-testid=\"last-updated\"]");
By lastWeekSortAesc = By.xpath("//i[@data-testid=\"last-updated\"]");
By lastUpdatedSort = By.cssSelector("[data-testid='last-updated']");
By updatedDescription = By.xpath("(//div[@data-testid=\"description-text\"])[1]");
By shopifyCheckbox = By.xpath("//input[@data-testid=\"checkbox\"][@id=\"shopify\"]");
By tagSpecialCategoryCheckbox = By.xpath("//input[@data-testid=\"checkbox\"][@id=\"PersonalData.SpecialCategory\"]");

View File

@ -15,10 +15,10 @@ public class PipelineDetails {
By pipelines = By.xpath("(//button[@data-testid='tab'])[4]");
By selectedTag = By.xpath("//span[@class='tw-no-underline hover:tw-no-underline tw-py-0.5 tw-px-2 tw-pl-2 tw-pr-1']");
By editTaskDescription = By.xpath("(//img[@data-testid='image']/parent::button)[3]");
By editTaskDescription = By.xpath("//div[@data-testid='description']/span/span");
By descriptionBox = By.xpath("(//div[@data-testid='description'])[2]");
By lineage = By.xpath("//button[@data-testid='tab'][@id='lineage']");;
By lineageComponents = By.xpath("//span[@data-testid='lineage-entity']");
By lineageComponents = By.xpath("//div[@class=\"tw-relative nowheel \"]");
By sideDrawerLineage = By.xpath("//header[@class=\"tw-flex tw-justify-between\"]");
public List<WebElement> lineageNodes() {

View File

@ -29,7 +29,7 @@ public class TableDetails {
By addTagTextBox = By.xpath("//input[@data-testid='associatedTagName']");
By selectTag = By.xpath("//div[@data-testid=\"list-item\"][2]");
By saveTag = By.xpath("//button[@data-testid=\"saveAssociatedTag\"]");
By tagName = By.xpath("(//div[@data-testid=\"tag-conatiner\"])[1]");
By tagName = By.xpath("(//div[@data-testid=\"tag-container\"])[1]");
By removeTag = By.xpath("//span[@data-testid=\"remove\"]");
By editDescriptionButton = By.xpath("//button[@data-testid= 'edit-description']");
By editDescriptionBox = By.xpath("//div[@data-testid='enterDescription']/div/div[2]/div/div/div/div/div/div");
@ -44,13 +44,13 @@ public class TableDetails {
By breadCrumb = By.xpath("//li[@data-testid=\"breadcrumb-link\"]");
By sideDrawerLineage = By.xpath("//header[@class=\"tw-flex tw-justify-between\"]");
By breadCrumbTier = By.xpath("//div[@class=\"tw-flex tw-gap-1 tw-mb-2 tw-mt-1 tw-ml-7 tw-flex-wrap\"]");
By profilerDrawer = By.cssSelector("span[class = \"tw-mr-2 tw-cursor-pointer\"]");
By schemaTable = By.cssSelector("table[data-testid='schema-table']");
By chart = By.xpath("//div[@class=\"recharts-wrapper\"]");
By toolTip =
By.xpath("//div[@class=\"recharts-tooltip-wrapper recharts-tooltip-wrapper-left recharts-tooltip-wrapper-top\"]");
By columnDescriptionButton = By.xpath("(//img[@data-testid='image'][parent::button])[3]");
By columnDescriptionButton = By.xpath("//div[@data-testid='description']/span/span");
By columnDescriptionBox = By.xpath("//div[@data-testid='enterDescription']/div/div[2]/div/div/div/div/div/div");
By columnDescription = By.cssSelector("div[data-testid='description'][id='column-description-2']");
By columnDescription = By.xpath("(//div[@id='column-description-3'])[1]");
By joinedTables = By.xpath("(//div[@data-testid='frequently-joined-columns']/span/a)");
By joinedColumns = By.xpath("(//div[@data-testid='frequently-joined-columns']/span/a)");
By sampleDataTable = By.xpath("//table[@data-testid=\"sample-data-table\"]");
@ -72,11 +72,11 @@ public class TableDetails {
return webDriver.findElements(lineageComponents);
}
public List<WebElement> profilerColumn() {
return webDriver.findElements(profilerDrawer);
}
public List<WebElement> chart() {
return webDriver.findElements(chart);
}
public boolean schemaTableIsDisplayed() {
return webDriver.findElement(schemaTable).isDisplayed();
}
}

View File

@ -30,7 +30,7 @@ public class TagsPage {
By addAssociatedTagButton = By.cssSelector("[data-testid='tags']");
By removeAssociatedTag = By.cssSelector("[data-testid='remove']");
By tables = By.cssSelector("[data-testid='tables']");
By tableLink = By.xpath("//button[@data-testid='table-link']");
By tableLink = By.xpath("//button[@data-testid='table-link'][1]");
By lastTableLink = By.xpath("//button[@data-testid='table-link'][last()]");
By tagUsageCount = By.cssSelector("[data-testid='usage-count']");
By headerSettingsTags = By.cssSelector("[data-testid='menu-item-Tags']");

View File

@ -26,7 +26,6 @@ public class TeamsPage {
By selectedUser = By.xpath("//div[@data-testid='data-container']/p[1]");
By editDescription = By.xpath("//button[@data-testid='edit-description']");
By saveDescription = By.xpath("//button[@data-testid='save']");
By editDescriptionBox = By.xpath("//div[@class='DraftEditor-editorContainer']");
By asset = By.xpath("//button[@data-testid='assets']");
By searchInput = By.xpath("//input[@data-testid='searchInputText']");
By dataContainer = By.xpath("//div[@data-testid='data-container']");

View File

@ -11,7 +11,7 @@ import org.openqa.selenium.WebDriver;
public class TopicDetails {
@Nonnull WebDriver webDriver;
By addTag = By.xpath("//div[@data-testid=\"tag-conatiner\"]");
By addTag = By.xpath("//div[@data-testid=\"tag-container\"]");
By selectTag = By.xpath("(//div[@data-testid=\"list-item\"])[2]");
By selectedTag =
By.xpath("//span[@class=\"tw-no-underline hover:tw-no-underline tw-py-0.5 tw-px-2 tw-pl-2 tw-pr-1\"]");
@ -20,4 +20,9 @@ public class TopicDetails {
By config = By.xpath("(//button[@data-testid = \"tab\"])[2]");
By manage = By.xpath("(//button[@data-testid = \"tab\"])[3]");
By topicName = By.linkText("orders");
By ownerName = By.xpath("//div[@data-testid='list-item']");
public String getOwnerName() {
return webDriver.findElement(ownerName).getText();
}
}

View File

@ -18,7 +18,7 @@ public class UserPage {
By adminFilterCount = By.xpath("//button[@data-testid='assets'][1]//span[@data-testid='filter-count']");
By userListSearchBar = By.cssSelector("[data-testid='searchbar']");
By userListSearchResult =
By.xpath("//div[@data-testid='user-card-container']/div[@data-testid='user-card-container']");
By.xpath("//div[@data-testid='user-card-container']/div/div[@data-testid='user-card-container']");
By closeCheckBoxDropDown = By.cssSelector("[data-testid='close-dropdown']");
public By selectRole(String role) {

View File

@ -12,7 +12,7 @@ public class Webhooks {
@NotNull WebDriver webDriver;
By webhookLink = By.linkText("Webhooks");
By addWebhook = By.xpath("//button[@data-testid='add-webhook-button']");
By addWebhook = By.cssSelector("[data-testid='add-webhook-button']");
By name = By.xpath("//input[@data-testid='name']");
By descriptionBox = By.xpath("//div[@class='notranslate public-DraftEditor-content']");
By endpoint = By.xpath("//input[@data-testid='endpoint-url']");

View File

@ -5,7 +5,10 @@ import java.time.Duration;
import java.util.ArrayList;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.openmetadata.catalog.selenium.events.*;
import org.openmetadata.catalog.selenium.objectRepository.*;
import org.openmetadata.catalog.selenium.properties.*;
@ -14,9 +17,12 @@ 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;
@Order(20)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class WebhooksPageTest {
static WebDriver webDriver;
@ -46,6 +52,7 @@ public class WebhooksPageTest {
}
@Test
@Order(1)
void openWebHookPage() {
Events.click(webDriver, common.closeWhatsNew()); // Close What's new
Events.click(webDriver, common.headerSettings()); // Setting
@ -53,6 +60,7 @@ public class WebhooksPageTest {
}
@Test
@Order(2)
void addWebHook() throws InterruptedException {
String name = faker.name().name();
webDriver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
@ -61,7 +69,7 @@ public class WebhooksPageTest {
Events.sendKeys(webDriver, webhooks.name(), name);
Events.click(webDriver, webhooks.descriptionBox());
Events.sendKeys(webDriver, webhooks.descriptionBox(), "test");
Events.sendKeys(webDriver, webhooks.endpoint(), "test.com");
Events.sendKeys(webDriver, webhooks.endpoint(), "https://www.example.com");
Events.click(webDriver, webhooks.checkbox());
Thread.sleep(waitTime);
Events.click(webDriver, webhooks.entityCreatedMenu());
@ -69,12 +77,14 @@ public class WebhooksPageTest {
actions.click();
actions.perform();
Events.click(webDriver, webhooks.saveWebhook());
WebElement checkName = webDriver.findElement(webhooks.checkWebhook());
Thread.sleep(2000);
WebElement checkName = wait.until(ExpectedConditions.presenceOfElementLocated(webhooks.checkWebhook()));
Assert.assertTrue(checkName.isDisplayed());
Assert.assertEquals(checkName.getText(), name);
}
@Test
@Order(3)
void checkDuplicateWebhookName() throws InterruptedException {
String name = faker.name().name();
webDriver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
@ -84,21 +94,22 @@ public class WebhooksPageTest {
Events.sendKeys(webDriver, webhooks.name(), name);
Events.click(webDriver, webhooks.descriptionBox());
Events.sendKeys(webDriver, webhooks.descriptionBox(), "test");
Events.sendKeys(webDriver, webhooks.endpoint(), "test.com");
Events.sendKeys(webDriver, webhooks.endpoint(), "https://www.example.com");
Events.click(webDriver, webhooks.checkbox());
Events.click(webDriver, webhooks.entityCreatedMenu());
Events.click(webDriver, webhooks.allEntities());
actions.click();
actions.perform();
Events.click(webDriver, webhooks.saveWebhook());
Thread.sleep(2000);
}
Thread.sleep(waitTime);
WebElement errorMessage = webDriver.findElement(webhooks.toast());
Assert.assertTrue(errorMessage.isDisplayed());
Assert.assertEquals(errorMessage.getText(), "Request failed with status code 409");
Assert.assertEquals(errorMessage.getText(), "Entity already exists");
}
@Test
@Order(4)
void checkBlankName() throws InterruptedException {
webDriver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
openWebHookPage();
@ -120,6 +131,7 @@ public class WebhooksPageTest {
}
@Test
@Order(5)
void checkBlankEndpoint() {
webDriver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
openWebHookPage();
@ -140,6 +152,7 @@ public class WebhooksPageTest {
}
@Test
@Order(6)
void checkBlankEntityCheckbox() {
webDriver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
openWebHookPage();
@ -147,7 +160,7 @@ public class WebhooksPageTest {
Events.sendKeys(webDriver, webhooks.name(), "test");
Events.click(webDriver, webhooks.descriptionBox());
Events.sendKeys(webDriver, webhooks.descriptionBox(), "test");
Events.sendKeys(webDriver, webhooks.endpoint(), "test.com");
Events.sendKeys(webDriver, webhooks.endpoint(), "https://www.test.com");
Events.click(webDriver, webhooks.saveWebhook());
WebElement errorMessage = webDriver.findElement(common.errorMessage());
Assert.assertTrue(errorMessage.isDisplayed());

View File

@ -85,7 +85,7 @@ public class CommonTests {
Events.sendKeys(webDriver, common.searchBar(), "dim_location");
Events.click(webDriver, common.searchSuggestion());
Thread.sleep(waitTime);
actions.moveToElement(webDriver.findElement(common.editAssociatedTagButton())).perform();
// actions.moveToElement(webDriver.findElement(common.editAssociatedTagButton())).perform();
Events.click(webDriver, common.editAssociatedTagButton());
Events.click(webDriver, common.enterAssociatedTagName());
Events.sendKeys(webDriver, common.enterAssociatedTagName(), "PersonalData.Personal");
@ -160,19 +160,10 @@ public class CommonTests {
Events.click(webDriver, common.descriptionBoldButton());
Events.sendKeys(webDriver, common.addDescriptionString(), faker.address().toString());
Events.click(webDriver, common.nextButton());
Events.sendKeys(webDriver, common.serviceUrl(), "localhost");
Events.sendKeys(webDriver, common.servicePort(), "3306");
Events.sendKeys(webDriver, common.serviceUsername(), "openmetadata_user");
Events.sendKeys(webDriver, common.servicePassword(), "openmetadata_password");
Events.sendKeys(webDriver, common.databaseName(), "openmetadata_db");
Events.click(webDriver, common.nextButton());
Events.click(webDriver, common.nextButton());
Events.click(webDriver, common.saveServiceButton());
webDriver.navigate().refresh();
try {
Events.click(webDriver, common.deleteServiceButton(" "));
} catch (TimeoutException exception) {
LOG.info("Success");
wait.until(ExpectedConditions.presenceOfElementLocated(common.containsText("Service name is required.")));
WebElement emptyName = webDriver.findElement(common.containsText("Service name is required."));
if (!emptyName.isDisplayed()) {
Assert.fail("Excepting space as name");
}
}
@ -339,7 +330,7 @@ public class CommonTests {
Events.sendKeys(webDriver, common.searchBar(), tableName);
Events.click(webDriver, common.searchSuggestion());
Thread.sleep(waitTime);
actions.moveToElement(webDriver.findElement(common.editAssociatedTagButton())).perform();
// actions.moveToElement(webDriver.findElement(common.editAssociatedTagButton())).perform();
Events.click(webDriver, common.editAssociatedTagButton());
Events.click(webDriver, common.enterAssociatedTagName());
for (int i = 0; i <= 8; i++) {

View File

@ -26,6 +26,7 @@ import org.openmetadata.catalog.selenium.events.Events;
import org.openmetadata.catalog.selenium.objectRepository.Common;
import org.openmetadata.catalog.selenium.properties.Property;
import org.openqa.selenium.Keys;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
@ -129,6 +130,10 @@ public class PaginationAndFilterTest {
webDriver.navigate().refresh();
Events.click(webDriver, common.headerItem("explore"));
Events.click(webDriver, common.selectFilterExplore("BigQuery"));
Events.click(webDriver, common.home());
Thread.sleep(waitTime);
actions.moveToElement(webDriver.findElement(common.removeRecentlySearchedText("zzzz"))).perform();
Events.click(webDriver, common.removeRecentlySearchedText("zzzz"));
}
@Test
@ -173,7 +178,15 @@ public class PaginationAndFilterTest {
webDriver.navigate().back();
webDriver.navigate().refresh();
Thread.sleep(2000);
Events.click(webDriver, common.selectFilterExplore("PersonalData.Personal"));
try {
WebElement viewMore = wait.until(ExpectedConditions.presenceOfElementLocated(common.viewMore()));
if (viewMore.isDisplayed()) {
Events.click(webDriver, common.viewMore());
}
Events.click(webDriver, common.selectFilterExplore("PersonalData.Personal"));
} catch (TimeoutException | NoSuchElementException e) {
Assert.fail("Tag not present");
}
Events.click(webDriver, common.selectFilterExplore("shopify"));
Thread.sleep(2000);
Object filteredResults = webDriver.findElements(common.searchResultsList()).size();

View File

@ -159,8 +159,8 @@ public class DashboardDetailsPageTest {
String updatedDescription = faker.address().toString();
openExplorePage();
Events.click(webDriver, dashboardDetails.dashboard());
Events.click(webDriver, explorePage.selectTable());
actions.moveToElement(webDriver.findElement(dashboardDetails.editChartDescription())).perform();
Events.click(webDriver, common.selectTableLink(1));
// actions.moveToElement(webDriver.findElement(dashboardDetails.editChartDescription()));
Events.click(webDriver, dashboardDetails.editChartDescription());
Events.sendKeys(webDriver, common.editDescriptionBox(), description);
Thread.sleep(2000);

View File

@ -18,6 +18,7 @@ import java.io.IOException;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.MethodOrderer;
@ -28,6 +29,7 @@ import org.openmetadata.catalog.selenium.events.Events;
import org.openmetadata.catalog.selenium.objectRepository.Common;
import org.openmetadata.catalog.selenium.objectRepository.DashboardServicePage;
import org.openmetadata.catalog.selenium.properties.Property;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
@ -36,6 +38,7 @@ import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
@Slf4j
@Order(9)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class DashboardServiceTestPage {
@ -132,9 +135,13 @@ public class DashboardServiceTestPage {
Events.sendKeys(webDriver, common.servicePassword(), "1");
Events.click(webDriver, common.saveConnectionConfig());
Thread.sleep(2000);
WebElement errorText = webDriver.findElement(common.containsText("Error while updating service"));
if (errorText.isDisplayed()) {
Assert.fail("Error while updating service");
try {
WebElement errorText = webDriver.findElement(common.containsText("Error while updating service"));
if (errorText.isDisplayed()) {
Assert.fail("Error while updating service");
}
} catch (NoSuchElementException e) {
LOG.info("Success");
}
}

View File

@ -17,6 +17,7 @@ import com.github.javafaker.Faker;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.MethodOrderer;
@ -27,14 +28,18 @@ import org.openmetadata.catalog.selenium.events.Events;
import org.openmetadata.catalog.selenium.objectRepository.Common;
import org.openmetadata.catalog.selenium.objectRepository.DatabaseServicePage;
import org.openmetadata.catalog.selenium.properties.Property;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebDriver;
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;
@Slf4j
@Order(8)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class DatabaseServicePageTest {
@ -108,6 +113,9 @@ public class DatabaseServicePageTest {
Events.click(webDriver, common.nextButton());
Events.click(webDriver, common.nextButton());
Events.click(webDriver, common.saveServiceButton());
webDriver.navigate().refresh();
Events.click(webDriver, common.containsText(serviceName));
Thread.sleep(5000); // for data ingestion
}
@Test
@ -129,15 +137,30 @@ public class DatabaseServicePageTest {
Thread.sleep(2000);
Events.click(webDriver, common.containsText(serviceName));
Events.click(webDriver, common.serviceDetailsTabs("ingestions"));
Events.click(webDriver, databaseServicePage.runIngestion()); // run ingestion
try {
WebElement runIngestion =
wait.until(ExpectedConditions.presenceOfElementLocated(databaseServicePage.runIngestion()));
if (runIngestion.isDisplayed()) {
Events.click(webDriver, databaseServicePage.runIngestion()); // run ingestion
}
} catch (NoSuchElementException | TimeoutException e) {
Assert.fail("Ingestion is not created");
}
webDriver.navigate().refresh();
Events.click(webDriver, databaseServicePage.editIngestion()); // edit ingestion
Events.click(webDriver, common.nextButton());
Events.click(webDriver, databaseServicePage.selectInterval());
Events.click(webDriver, databaseServicePage.ingestionInterval("day"));
Events.click(webDriver, common.nextButton());
try {
WebElement nextButton = wait.until(ExpectedConditions.presenceOfElementLocated(common.nextButton()));
Thread.sleep(2000);
if (nextButton.isDisplayed()) {
nextButton.click();
}
} catch (TimeoutException | NoSuchElementException e) {
Assert.fail("Next button not found");
}
Events.click(webDriver, common.saveServiceButton());
webDriver.navigate().refresh();
Events.click(webDriver, databaseServicePage.deleteIngestion()); // delete ingestion
Events.click(webDriver, common.saveEditedService());
}
@ -154,9 +177,13 @@ public class DatabaseServicePageTest {
Events.sendKeys(webDriver, common.databaseName(), "1");
Events.click(webDriver, common.saveConnectionConfig());
Thread.sleep(2000);
WebElement errorText = webDriver.findElement(common.containsText("Error while updating service"));
if (errorText.isDisplayed()) {
Assert.fail("Error while updating service");
try {
WebElement errorText = webDriver.findElement(common.containsText("Error while updating service"));
if (errorText.isDisplayed()) {
Assert.fail("Error while updating service");
}
} catch (NoSuchElementException e) {
LOG.info("Success");
}
}

View File

@ -221,11 +221,15 @@ class Explore {
Events.click(webDriver, tableDetails.saveTableDescription());
Thread.sleep(2000);
Events.click(webDriver, explorePage.explore());
Events.click(webDriver, explorePage.lastWeekSortDesc());
Events.click(webDriver, explorePage.lastWeekSortAesc());
Events.click(webDriver, explorePage.lastUpdatedSort());
Events.click(webDriver, explorePage.lastUpdatedSort());
Thread.sleep(2000);
WebElement descriptionCheck = webDriver.findElement(explorePage.updatedDescription());
Assert.assertEquals(sendKeys, descriptionCheck.getText());
try {
WebElement descriptionCheck = webDriver.findElement(explorePage.updatedDescription());
Assert.assertEquals(sendKeys, descriptionCheck.getText());
} catch (NoSuchElementException e) {
Assert.fail("Description not updated || Not sorting according to last updated");
}
}
@Test

View File

@ -243,7 +243,7 @@ public class MyDataPageTest {
@Test
@Order(7)
void checkFollowingTab() {
void checkFollowingTab() throws InterruptedException {
webDriver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
Events.click(webDriver, myDataPage.closeWhatsNew());
Events.click(webDriver, myDataPage.tables());
@ -257,8 +257,18 @@ public class MyDataPageTest {
Events.click(webDriver, tableDetails.follow());
}
Events.click(webDriver, myDataPage.home());
String tableName = webDriver.findElement(myDataPage.following()).getText();
Assert.assertEquals(tableName, "Started following " + table);
Thread.sleep(2000);
webDriver.navigate().refresh();
try {
Events.click(webDriver, common.followingTable(table));
} catch (TimeoutException | NoSuchElementException e) {
Assert.fail("Following data not present");
}
// Do not delete
// String tableName = webDriver.findElement(myDataPage.following()).getText();
// Assert.assertEquals(tableName, "Started following " + table)
}
@Test

View File

@ -165,23 +165,23 @@ public class PipelineDetailsPageTest {
String updatedDescription = faker.address().toString();
openExplorePage();
Events.click(webDriver, pipelineDetails.pipelines());
Events.click(webDriver, explorePage.selectTable());
Events.click(webDriver, common.selectTableLink(1));
actions.moveToElement(webDriver.findElement(pipelineDetails.editTaskDescription())).perform();
Events.click(webDriver, pipelineDetails.editTaskDescription());
Events.sendKeys(webDriver, common.editDescriptionBox(), description);
Thread.sleep(2000);
Events.click(webDriver, common.editDescriptionSaveButton());
Thread.sleep(waitTime);
Thread.sleep(2000);
webDriver.navigate().refresh();
Thread.sleep(waitTime);
Thread.sleep(2000);
actions.moveToElement(webDriver.findElement(pipelineDetails.editTaskDescription())).perform();
Events.click(webDriver, pipelineDetails.editTaskDescription());
Events.sendKeys(webDriver, common.editDescriptionBox(), updatedDescription);
Thread.sleep(2000);
Events.click(webDriver, common.editDescriptionSaveButton());
Thread.sleep(waitTime);
Thread.sleep(2000);
webDriver.navigate().refresh();
Thread.sleep(waitTime);
Thread.sleep(2000);
String checkDescription = pipelineDetails.getDescriptionBox().getText();
if (!checkDescription.contains(updatedDescription)) {
Assert.fail("Description not updated");

View File

@ -36,8 +36,6 @@ public class RolesPageTest {
String webDriverInstance = Property.getInstance().getWebDriver();
String webDriverPath = Property.getInstance().getWebDriverPath();
String xpath = "//p[@title = '" + roleDisplayName + "']";
static String pageLoadStatus = null;
JavascriptExecutor js;
@BeforeEach
public void openMetadataWindow() {
@ -228,7 +226,7 @@ public class RolesPageTest {
Events.click(webDriver, common.descriptionSaveButton());
try {
WebElement errorMessage = webDriver.findElement(rolesPage.errorMessage());
Assert.assertEquals(errorMessage.getText(), "Operation is required");
Assert.assertEquals(errorMessage.getText(), "Operation is required.");
} catch (TimeoutException | NoSuchElementException e) {
Assert.fail("Error message not displayed");
}

View File

@ -96,8 +96,7 @@ public class TableDetailsPageTest {
Events.sendKeys(webDriver, myDataPage.searchBox(), tableName);
Events.click(webDriver, myDataPage.tableName());
Events.click(webDriver, tableDetails.profiler());
WebElement profilerColumn = tableDetails.profilerColumn().get(1);
Assert.assertTrue(profilerColumn.isDisplayed());
Assert.assertTrue(tableDetails.schemaTableIsDisplayed());
Events.click(webDriver, tableDetails.lineage());
WebElement lineage = tableDetails.lineageNodes().get(1);
Assert.assertTrue(lineage.isDisplayed());
@ -150,11 +149,15 @@ public class TableDetailsPageTest {
Thread.sleep(2000);
webDriver.navigate().refresh();
}
String verifyDescription = webDriver.findElement(tableDetails.columnDescription()).getText();
if (!verifyDescription.contains(sendKeys)) {
Assert.fail("Description not updated");
} else {
LOG.info("Description Updated");
try {
String verifyDescription = webDriver.findElement(tableDetails.columnDescription()).getText();
if (!verifyDescription.contains(sendKeys)) {
Assert.fail("Description not updated");
} else {
LOG.info("Description Updated");
}
} catch (NoSuchElementException e) {
Assert.fail("Element column description not found");
}
}
@ -211,15 +214,7 @@ public class TableDetailsPageTest {
openExplorePage();
Events.click(webDriver, explorePage.selectTable());
Events.click(webDriver, tableDetails.profiler());
List<WebElement> profilerColumn = tableDetails.profilerColumn();
List<WebElement> chart = tableDetails.chart();
for (WebElement e : profilerColumn) {
e.click();
}
for (WebElement c : chart) {
actions.moveToElement(c).build().perform();
Assert.assertTrue(c.isDisplayed());
}
Assert.assertTrue(tableDetails.schemaTableIsDisplayed());
}
@Test
@ -264,17 +259,17 @@ public class TableDetailsPageTest {
// Since after navigating back we are facing StaleElementException using try catch block.
for (WebElement link : br) {
try {
counter = counter + 1;
link.click();
Thread.sleep(1000);
Assert.assertTrue(link.isDisplayed());
webDriver.navigate().back();
Thread.sleep(1000);
} catch (StaleElementReferenceException ex) {
webDriver.navigate().back();
Thread.sleep(1000);
Events.click(webDriver, By.xpath(xpath));
Thread.sleep(2000);
WebElement breadcrumb_link = webDriver.findElement(By.xpath(xpath));
breadcrumb_link.click();
Assert.assertTrue(breadcrumb_link.isDisplayed());
Assert.assertTrue(webDriver.findElement(By.xpath(xpath)).isDisplayed());
break;
}
}
}
@ -306,7 +301,11 @@ public class TableDetailsPageTest {
Events.sendKeys(webDriver, myDataPage.searchBox(), "fact_sale");
Events.click(webDriver, common.selectSuggestionSearch("bigquery_gcpshopifyfact_sale"));
Thread.sleep(2000);
Events.click(webDriver, tableDetails.joinedTables());
try {
Events.click(webDriver, tableDetails.joinedTables());
} catch (NoSuchElementException | TimeoutException e) {
Assert.fail("No Frequently joined tables found");
}
}
@Test
@ -317,7 +316,11 @@ public class TableDetailsPageTest {
Events.sendKeys(webDriver, myDataPage.searchBox(), "fact_sale");
Events.click(webDriver, common.selectSuggestionSearch("bigquery_gcpshopifyfact_sale"));
Thread.sleep(2000);
Events.click(webDriver, tableDetails.joinedColumns());
try {
Events.click(webDriver, tableDetails.joinedColumns());
} catch (NoSuchElementException | TimeoutException e) {
Assert.fail("No Frequently joined columns found");
}
}
@AfterEach

View File

@ -28,11 +28,13 @@ import org.openmetadata.catalog.selenium.objectRepository.Common;
import org.openmetadata.catalog.selenium.objectRepository.TagsPage;
import org.openmetadata.catalog.selenium.properties.Property;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebDriver;
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;
@ -192,8 +194,16 @@ public class TagsPageTest {
public void checkAddedTagToTableColumn() {
Events.click(webDriver, common.closeWhatsNew());
Events.click(webDriver, tagsPage.tables());
Events.click(webDriver, tagsPage.tagFilter(tagCategoryDisplayName, tagDisplayName));
Events.click(webDriver, tagsPage.tableLink());
try {
WebElement viewMore = wait.until(ExpectedConditions.presenceOfElementLocated(common.viewMore()));
if (viewMore.isDisplayed()) {
Events.click(webDriver, common.viewMore());
}
Events.click(webDriver, tagsPage.tagFilter(tagCategoryDisplayName, tagDisplayName));
Events.click(webDriver, tagsPage.tableLink());
} catch (TimeoutException | NoSuchElementException e) {
Assert.fail("Tag not found");
}
}
@Test
@ -202,7 +212,11 @@ public class TagsPageTest {
openTagsPage();
Events.click(webDriver, common.containsText(tagCategoryDisplayName));
Events.click(webDriver, tagsPage.tagUsageCount());
Events.click(webDriver, tagsPage.tableLink());
try {
Events.click(webDriver, tagsPage.tableLink());
} catch (TimeoutException e) {
Assert.fail("Table is not present for the selected tag filter");
}
Events.click(webDriver, common.editAssociatedTagButton());
Events.click(webDriver, tagsPage.removeAssociatedTag());
Events.click(webDriver, common.saveAssociatedTag());
@ -252,7 +266,11 @@ public class TagsPageTest {
Events.click(webDriver, common.containsText("PersonalData"));
Events.click(webDriver, tagsPage.usageCountElementIndex(2));
Events.click(webDriver, tagsPage.tableLink());
try {
Events.click(webDriver, tagsPage.tableLink());
} catch (TimeoutException e) {
Assert.fail("Table is not present for the selected tag filter");
}
Events.click(webDriver, common.editAssociatedTagButton());
Events.click(webDriver, tagsPage.removeAssociatedTag());
Events.click(webDriver, common.saveAssociatedTag());

View File

@ -58,8 +58,6 @@ public class TeamsPageTest {
public void openMetadataWindow() {
System.setProperty(webDriverInstance, webDriverPath);
ChromeOptions options = new ChromeOptions();
options.addArguments("--no-sandbox");
options.addArguments("--disable-dev-shm-usage");
options.addArguments("--headless");
options.addArguments("--window-size=1280,800");
webDriver = new ChromeDriver(options);
@ -149,10 +147,10 @@ public class TeamsPageTest {
// Select the created listed team
Events.click(webDriver, By.xpath(xpath));
Events.click(webDriver, teamsPage.editDescription());
wait.until(ExpectedConditions.presenceOfElementLocated(teamsPage.editDescriptionBox()));
Events.click(webDriver, teamsPage.editDescriptionBox());
Events.sendKeys(webDriver, teamsPage.editDescriptionBox(), Keys.CONTROL + "A");
Events.sendKeys(webDriver, teamsPage.editDescriptionBox(), sendKeys);
wait.until(ExpectedConditions.presenceOfElementLocated(teamsPage.enterDescription()));
Events.click(webDriver, teamsPage.enterDescription());
Events.sendKeys(webDriver, teamsPage.enterDescription(), Keys.CONTROL + "A");
Events.sendKeys(webDriver, teamsPage.enterDescription(), sendKeys);
Events.click(webDriver, teamsPage.saveDescription());
String description = webDriver.findElement(common.descriptionContainer()).getText();
Thread.sleep(2000);
@ -215,6 +213,7 @@ public class TeamsPageTest {
webDriver.navigate().back();
Events.click(webDriver, myDataPage.openWhatsNew()); // What's New
}
Events.click(webDriver, common.closeWhatsNew());
String teamsListCount = String.valueOf(webDriver.findElements(teamsPage.teamsCount()).size());
Thread.sleep(waitTime);
Events.click(webDriver, myDataPage.home());

View File

@ -50,7 +50,6 @@ public class TopicDetailsPageTest {
int counter = 2;
String xpath = "//li[@data-testid='breadcrumb-link'][" + counter + "]";
String description = "Test@1234";
String updatedDescription = "Updated Description";
@BeforeEach
public void openMetadataWindow() {
@ -109,8 +108,11 @@ public class TopicDetailsPageTest {
Events.click(webDriver, common.follow());
}
Events.click(webDriver, myDataPage.home());
String tableName = webDriver.findElement(myDataPage.following()).getText();
Assert.assertEquals(tableName, "Started following " + topic);
if (!webDriver.getPageSource().contains(topic)) {
Assert.fail(topic + "topic not found");
} else {
LOG.info("Passed");
}
}
@Test
@ -141,10 +143,14 @@ public class TopicDetailsPageTest {
webDriver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
openExplorePage();
Events.click(webDriver, explorePage.topics());
Events.click(webDriver, explorePage.selectTable());
Events.click(webDriver, common.selectTableLink(1));
Object count = webDriver.findElements(topicDetails.breadCrumbTags()).size();
Events.click(webDriver, topicDetails.addTag());
Events.click(webDriver, common.removeAssociatedTag());
try {
Events.click(webDriver, common.removeAssociatedTag());
} catch (TimeoutException e) {
Assert.fail("Tag not found");
}
Events.click(webDriver, common.saveAssociatedTag());
Thread.sleep(2000);
webDriver.navigate().refresh();
@ -191,16 +197,19 @@ public class TopicDetailsPageTest {
public void checkManage() throws InterruptedException {
openExplorePage();
Events.click(webDriver, explorePage.topics());
Events.click(webDriver, common.selectTableLink(1));
Events.click(webDriver, common.selectTableLink(2));
Thread.sleep(waitTime);
actions.perform();
actions.click();
Events.click(webDriver, common.manage());
Events.click(webDriver, common.ownerDropdown());
Events.click(webDriver, common.users());
String user = topicDetails.getOwnerName();
Events.click(webDriver, common.selectUser());
Events.click(webDriver, common.selectTier1());
Events.click(webDriver, common.saveManage());
String ownerName = webDriver.findElement(common.ownerDropdown()).getText();
Assert.assertEquals(ownerName, user);
}
@Test