Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - Selenium fix #3014

Merged
merged 10 commits into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
public class DashboardServicePage {
@Nonnull WebDriver webDriver;

By dashboardServiceUrl = By.cssSelector("[data-testid='dashboard-url']");
By addDashboardServiceUrl = By.cssSelector("[data-testid='dashboard-url']");
By editDashboardServiceUrl = By.cssSelector("[data-testid='dashboardUrl']");
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,17 @@ public void addTagWithSpaceCheck() throws InterruptedException, IOException {
Events.click(webDriver, common.headerSettings()); // Setting
Events.click(webDriver, common.headerSettingsMenu("Tags")); // Setting/Tags
Events.click(webDriver, common.addTagCategory());
wait.until(ExpectedConditions.elementToBeClickable(webDriver.findElement(common.displayName())));
Thread.sleep(2000);
Events.sendKeys(webDriver, common.displayName(), tagCategoryDisplayName);
Events.sendKeys(webDriver, common.addDescriptionString(), faker.address().toString());
Events.click(webDriver, common.saveEditedService());
Events.click(webDriver, common.descriptionSaveButton());
webDriver.navigate().refresh();
Events.click(webDriver, common.containsText(tagCategoryDisplayName));
Events.click(webDriver, common.addTagButton());
wait.until(ExpectedConditions.elementToBeClickable(common.displayName()));
Events.sendKeys(webDriver, common.displayName(), "Testing Tag");
Events.sendKeys(webDriver, common.addDescriptionString(), faker.address().toString());
Events.click(webDriver, common.saveEditedService());
Events.click(webDriver, common.descriptionSaveButton());
URL tagUrl = new URL(url + urlTag + tagCategoryDisplayName + "/");
HttpURLConnection http = (HttpURLConnection) tagUrl.openConnection();
http.setRequestMethod("HEAD");
Expand All @@ -133,7 +133,7 @@ public void addTagCategoryWithSpaceCheck() throws InterruptedException, IOExcept
wait.until(ExpectedConditions.elementToBeClickable(webDriver.findElement(common.displayName())));
Events.sendKeys(webDriver, common.displayName(), "Space Tag");
Events.sendKeys(webDriver, common.addDescriptionString(), faker.address().toString());
Events.click(webDriver, common.saveEditedService());
Events.click(webDriver, common.descriptionSaveButton());
webDriver.navigate().refresh();
URL tagUrl = new URL(url + urlTag);
HttpURLConnection http = (HttpURLConnection) tagUrl.openConnection();
Expand Down Expand Up @@ -219,7 +219,7 @@ public void sameNameTagUIMessageCheck() throws InterruptedException {
Events.click(webDriver, common.headerSettings());
Events.click(webDriver, common.headerSettingsMenu("Tags"));
Events.click(webDriver, common.containsText("PersonalData"));
Events.click(webDriver, common.noServicesAddServiceButton());
Events.click(webDriver, common.addTagButton());
wait.until(ExpectedConditions.elementToBeClickable(common.displayName()));
Events.sendKeys(webDriver, common.displayName(), "personal");
Events.sendKeys(webDriver, common.addDescriptionString(), faker.address().toString());
Expand Down Expand Up @@ -325,6 +325,7 @@ public void tourStepSkippingCheck() throws InterruptedException {
openHomePage();
Events.click(webDriver, common.selectOverview("tour"));
for (int i = 0; i < 2; i++) {
Thread.sleep(waitTime);
Events.click(webDriver, common.tourNavigationArrow("right-arrow"));
}
Events.sendKeys(webDriver, common.searchBar(), "dim_a"); // Search bar/dim
Expand All @@ -334,6 +335,7 @@ public void tourStepSkippingCheck() throws InterruptedException {
@Test
@Order(15)
public void tagFilterCountCheck() throws InterruptedException {
openHomePage();
Events.sendKeys(webDriver, common.searchBar(), tableName);
Events.click(webDriver, common.searchSuggestion());
Thread.sleep(waitTime);
Expand Down Expand Up @@ -365,13 +367,13 @@ public void differentSearchDifferentResultCheck() throws InterruptedException {
Events.sendKeys(webDriver, common.searchBar(), "!");
Events.sendEnter(webDriver, common.searchBar());
Thread.sleep(2000);
String search1 = webDriver.findElement(common.noSearchResult()).getAttribute("innerHTML");
String search1 = webDriver.findElement(common.noSearchResult()).getText();
Assert.assertEquals(search1, "No matching data assets found for !");
webDriver.navigate().back();
Events.sendKeys(webDriver, common.searchBar(), "{");
Events.sendEnter(webDriver, common.searchBar());
try {
String search2 = webDriver.findElement(common.noSearchResult()).getAttribute("innerHTML");
String search2 = webDriver.findElement(common.noSearchResult()).getText();
Assert.assertEquals(search2, "No matching data assets found for {");
} catch (NoSuchElementException exception) {
LOG.info("Search results are not similar for no data found!");
Expand All @@ -385,24 +387,14 @@ public void missingMatchesForSearchCheck() throws InterruptedException {
Events.click(webDriver, common.selectOverview("dashboards"));
Events.sendKeys(webDriver, common.searchBar(), "sales");
Events.sendEnter(webDriver, common.searchBar());
Thread.sleep(2000);
String resultsCount = webDriver.findElement(common.resultsCount()).getAttribute("innerHTML");
Object matchesCount = webDriver.findElements(common.matchesStats()).size();
Assert.assertEquals(matchesCount + " results", resultsCount);
}

@Test
@Order(18)
public void sameNodesLineage() throws InterruptedException {
openHomePage();
Events.sendKeys(webDriver, common.searchBar(), "dim_product_variant");
Events.click(webDriver, common.searchSuggestion());
Thread.sleep(waitTime);
Events.click(webDriver, common.entityTabIndex(4));
Events.click(webDriver, common.editLineageButton());
}

@Test
@Order(19)
public void searchNotShowingResultsCheck() throws InterruptedException {
openHomePage();
Events.click(webDriver, common.selectOverview("pipelines"));
Expand All @@ -414,7 +406,7 @@ public void searchNotShowingResultsCheck() throws InterruptedException {
LOG.info("Success");
}
} catch (TimeoutException exception) {
throw new TimeoutException("No search results found");
Assert.fail("No search results found");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void filterDisappearsAfterSearchCheck() throws Exception {
Events.click(webDriver, common.selectFilterExplore("Glue"));
Events.click(webDriver, common.selectFilterExplore("default"));
} catch (TimeoutException exception) {
throw new Exception("filters are missing");
Assert.fail("filters are missing");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void setOwner() throws InterruptedException {
Thread.sleep(waitTime);
Events.sendKeys(webDriver, common.searchBar(), dashboard);
Events.click(webDriver, common.selectSuggestionSearch("sample_superset34"));
Events.click(webDriver, common.entityTabIndex(3));
Events.click(webDriver, common.entityTabIndex(4));
Events.click(webDriver, common.ownerDropdown());
Events.sendKeys(webDriver, common.ownerSearchBox(), "Cloud");
Events.click(webDriver, common.tagListItem());
Expand All @@ -78,7 +78,7 @@ public void checkOwnerPostIngestion() throws InterruptedException, IOException {
Thread.sleep(waitTime);
Events.sendKeys(webDriver, common.searchBar(), dashboard);
Events.click(webDriver, common.selectSuggestionSearch("sample_superset34"));
Events.click(webDriver, common.entityTabIndex(3));
Events.click(webDriver, common.entityTabIndex(4));
Events.click(webDriver, common.containsText("Cloud_Infra"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package org.openmetadata.catalog.selenium.pages.dashboardService;

import com.github.javafaker.Faker;
import java.io.IOException;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -33,6 +34,7 @@
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;

@Order(9)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
Expand Down Expand Up @@ -99,7 +101,7 @@ public void addDashboardService() throws InterruptedException {
Events.click(webDriver, common.descriptionLinkButton());
Events.sendKeys(webDriver, common.addDescriptionString(), faker.address().toString());
Events.click(webDriver, common.nextButton());
Events.sendKeys(webDriver, dashboardServicePage.dashboardServiceUrl(), "localhost:8080");
Events.sendKeys(webDriver, dashboardServicePage.addDashboardServiceUrl(), "localhost:8080");
Events.sendKeys(webDriver, common.serviceUsername(), "openmetadata_user");
Events.sendKeys(webDriver, common.servicePassword(), "openmetadata_password");
Events.click(webDriver, common.nextButton());
Expand All @@ -120,15 +122,20 @@ public void checkDashboardServiceDetails() throws InterruptedException {

@Test
@Order(4)
public void checkConnectionConfigTab() throws InterruptedException {
public void checkConnectionConfigTab() throws InterruptedException, IOException {
openDashboardServicePage();
Thread.sleep(2000);
Events.click(webDriver, common.containsText(serviceName));
Events.click(webDriver, common.serviceDetailsTabs("connectionConfig"));
Events.sendKeys(webDriver, dashboardServicePage.dashboardServiceUrl(), "1");
Events.sendKeys(webDriver, dashboardServicePage.editDashboardServiceUrl(), "1");
Events.sendKeys(webDriver, common.serviceUsername(), "1");
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");
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;

@Order(8)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
Expand All @@ -55,6 +56,7 @@ public void openMetadataWindow() {
System.setProperty(webDriverInstance, webDriverPath);
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
options.addArguments("--window-size=1280,800");
webDriver = new ChromeDriver(options);
common = new Common(webDriver);
databaseServicePage = new DatabaseServicePage(webDriver);
Expand Down Expand Up @@ -125,7 +127,7 @@ public void checkDatabaseServiceDetails() throws InterruptedException {
public void checkIngestionTab() throws InterruptedException {
openDatabaseServicePage();
Thread.sleep(2000);
Events.click(webDriver, common.containsText("Demo1"));
Events.click(webDriver, common.containsText(serviceName));
Events.click(webDriver, common.serviceDetailsTabs("ingestions"));
Events.click(webDriver, databaseServicePage.runIngestion()); // run ingestion

Expand All @@ -151,6 +153,11 @@ public void checkConnectionConfigTab() throws InterruptedException {
Events.sendKeys(webDriver, common.servicePassword(), "1");
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");
}
}

@Test
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public void editDescription() throws InterruptedException {
Events.sendKeys(webDriver, common.addDescriptionString(), Keys.CONTROL + "A");
Events.sendKeys(webDriver, common.addDescriptionString(), description);
Events.click(webDriver, common.editDescriptionSaveButton());
webDriver.navigate().refresh();
Events.click(webDriver, common.containsText(roleName));
String updatedDescription = webDriver.findElement(common.descriptionContainer()).getText();
Assert.assertEquals(updatedDescription, description);
Expand All @@ -118,8 +119,7 @@ public void editDescription() throws InterruptedException {
@Order(4)
public void addRules() throws InterruptedException {
openRolesPage();
String roleName = "Data Consumer";
Events.click(webDriver, common.containsText(roleName));
Events.click(webDriver, common.containsText(roleDisplayName));
Events.click(webDriver, rolesPage.addRule());
Events.click(webDriver, rolesPage.listOperation());
Events.click(webDriver, rolesPage.selectOperation("UpdateDescription"));
Expand Down