added tests for tags and description (#2332)

This commit is contained in:
parthp2107 2022-01-21 21:37:25 +05:30 committed by GitHub
parent 9da9266c3a
commit 91767ee4cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 70 additions and 1 deletions

View File

@ -406,6 +406,24 @@ public class CommonTests {
Events.click(webDriver, By.cssSelector("[data-testid='edit-lineage']"));
}
@Test
@Order(19)
public void searchNotShowingResultsCheck() throws InterruptedException {
openHomePage();
Events.click(webDriver, By.cssSelector("[data-testid='pipelines']"));
Events.sendKeys(webDriver, By.cssSelector("[data-testid='searchBox']"), "sample");
Events.sendEnter(webDriver, By.cssSelector("[id='searchBox']"));
try {
WebElement searchResult =
wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("[data-testid='search-results']")));
if (searchResult.isDisplayed()) {
LOG.info("Success");
}
} catch (TimeoutException exception) {
throw new TimeoutException("No search results found");
}
}
@AfterEach
public void closeTabs() {
ArrayList<String> tabs = new ArrayList<>(webDriver.getWindowHandles());

View File

@ -16,6 +16,7 @@ package org.openmetadata.catalog.selenium.pages.tags;
import com.github.javafaker.Faker;
import java.time.Duration;
import java.util.ArrayList;
import java.util.logging.Logger;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.MethodOrderer;
@ -23,9 +24,12 @@ import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.openmetadata.catalog.selenium.events.Events;
import org.openmetadata.catalog.selenium.pages.myData.MyDataPageTest;
import org.openmetadata.catalog.selenium.properties.Property;
import org.openqa.selenium.By;
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;
@ -37,6 +41,8 @@ import org.testng.Assert;
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class TagsPageTest {
private static final Logger LOG = Logger.getLogger(MyDataPageTest.class.getName());
static WebDriver webDriver;
static String url = Property.getInstance().getURL();
static Faker faker = new Faker();
@ -243,6 +249,26 @@ public class TagsPageTest {
@Test
@Order(11)
public void TagUsageCheck() throws InterruptedException {
openTagsPage();
Events.click(webDriver, By.xpath("//*[text()[contains(.,'" + "PersonalData" + "')]] "));
Events.click(webDriver, By.xpath("(//a[@data-testid='usage-count'])[2]"));
Thread.sleep(2000);
String beforeFilterCount =
webDriver
.findElement(By.xpath("(//button[@data-testid='tab'])[1]//span[@data-testid='filter-count']"))
.getAttribute("innerHTML");
Events.click(webDriver, By.xpath("(//button[@data-testid='tab'])[2]"));
Events.click(webDriver, By.xpath("(//button[@data-testid='tab'])[1]"));
String afterFilterCount =
webDriver
.findElement(By.xpath("(//button[@data-testid='tab'])[1]//span[@data-testid='filter-count']"))
.getAttribute("innerHTML");
Assert.assertEquals(afterFilterCount, beforeFilterCount);
}
@Test
@Order(12)
public void removeTagWithExistingName() throws InterruptedException {
openTagsPage();
Events.click(webDriver, By.xpath("//*[text()[contains(.,'" + "PersonalData" + "')]] "));
@ -262,6 +288,27 @@ public class TagsPageTest {
Assert.assertEquals(usageCount, "Not used");
}
@Test
@Order(13)
public void addSelfAssociatedTag() throws Exception {
openTagsPage();
Events.click(webDriver, By.xpath("//*[text()[contains(.,'" + "PersonalData" + "')]] "));
actions.moveToElement(webDriver.findElement(By.cssSelector("[data-testid='tags']"))).perform();
Events.click(webDriver, By.cssSelector("[data-testid='tags']"));
Events.click(webDriver, By.cssSelector("[data-testid='associatedTagName']"));
try {
Events.sendKeys(webDriver, By.cssSelector("[data-testid='associatedTagName']"), "PersonalData.Personal");
WebElement sameTag =
wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("[data-testid='list-item']")));
if (sameTag.isDisplayed()) {
throw new Exception("Can add tag itself as it's associated tag");
}
} catch (TimeoutException exception) {
LOG.info("Success");
}
}
@AfterEach
public void closeTabs() {
ArrayList<String> tabs = new ArrayList<>(webDriver.getWindowHandles());

View File

@ -107,8 +107,12 @@ public class TeamsPageTest {
// Select the created listed team
Events.click(webDriver, By.cssSelector("[data-testid='edit-description']"));
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(enterDescription)));
Events.sendKeys(webDriver, By.xpath(enterDescription), faker.address().toString());
Events.sendKeys(webDriver, By.xpath(enterDescription), faker.address().toString() + "[google](www.google.com)");
Events.click(webDriver, By.cssSelector("[data-testid='save']"));
Events.click(webDriver, By.xpath("//div[@data-testid='description']//a"));
Thread.sleep(2000);
String currentUrl = webDriver.getCurrentUrl();
Assert.assertEquals(currentUrl, "https://www.google.com/?gws_rd=ssl");
}
@Test