mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-18 14:06:59 +00:00
added tests for tags and description (#2332)
This commit is contained in:
parent
9da9266c3a
commit
91767ee4cf
@ -406,6 +406,24 @@ public class CommonTests {
|
|||||||
Events.click(webDriver, By.cssSelector("[data-testid='edit-lineage']"));
|
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
|
@AfterEach
|
||||||
public void closeTabs() {
|
public void closeTabs() {
|
||||||
ArrayList<String> tabs = new ArrayList<>(webDriver.getWindowHandles());
|
ArrayList<String> tabs = new ArrayList<>(webDriver.getWindowHandles());
|
||||||
|
@ -16,6 +16,7 @@ package org.openmetadata.catalog.selenium.pages.tags;
|
|||||||
import com.github.javafaker.Faker;
|
import com.github.javafaker.Faker;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.logging.Logger;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.MethodOrderer;
|
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.Test;
|
||||||
import org.junit.jupiter.api.TestMethodOrder;
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
import org.openmetadata.catalog.selenium.events.Events;
|
import org.openmetadata.catalog.selenium.events.Events;
|
||||||
|
import org.openmetadata.catalog.selenium.pages.myData.MyDataPageTest;
|
||||||
import org.openmetadata.catalog.selenium.properties.Property;
|
import org.openmetadata.catalog.selenium.properties.Property;
|
||||||
import org.openqa.selenium.By;
|
import org.openqa.selenium.By;
|
||||||
|
import org.openqa.selenium.TimeoutException;
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
|
import org.openqa.selenium.WebElement;
|
||||||
import org.openqa.selenium.chrome.ChromeDriver;
|
import org.openqa.selenium.chrome.ChromeDriver;
|
||||||
import org.openqa.selenium.chrome.ChromeOptions;
|
import org.openqa.selenium.chrome.ChromeOptions;
|
||||||
import org.openqa.selenium.interactions.Actions;
|
import org.openqa.selenium.interactions.Actions;
|
||||||
@ -37,6 +41,8 @@ import org.testng.Assert;
|
|||||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||||
public class TagsPageTest {
|
public class TagsPageTest {
|
||||||
|
|
||||||
|
private static final Logger LOG = Logger.getLogger(MyDataPageTest.class.getName());
|
||||||
|
|
||||||
static WebDriver webDriver;
|
static WebDriver webDriver;
|
||||||
static String url = Property.getInstance().getURL();
|
static String url = Property.getInstance().getURL();
|
||||||
static Faker faker = new Faker();
|
static Faker faker = new Faker();
|
||||||
@ -243,6 +249,26 @@ public class TagsPageTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(11)
|
@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 {
|
public void removeTagWithExistingName() throws InterruptedException {
|
||||||
openTagsPage();
|
openTagsPage();
|
||||||
Events.click(webDriver, By.xpath("//*[text()[contains(.,'" + "PersonalData" + "')]] "));
|
Events.click(webDriver, By.xpath("//*[text()[contains(.,'" + "PersonalData" + "')]] "));
|
||||||
@ -262,6 +288,27 @@ public class TagsPageTest {
|
|||||||
Assert.assertEquals(usageCount, "Not used");
|
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
|
@AfterEach
|
||||||
public void closeTabs() {
|
public void closeTabs() {
|
||||||
ArrayList<String> tabs = new ArrayList<>(webDriver.getWindowHandles());
|
ArrayList<String> tabs = new ArrayList<>(webDriver.getWindowHandles());
|
||||||
|
@ -107,8 +107,12 @@ public class TeamsPageTest {
|
|||||||
// Select the created listed team
|
// Select the created listed team
|
||||||
Events.click(webDriver, By.cssSelector("[data-testid='edit-description']"));
|
Events.click(webDriver, By.cssSelector("[data-testid='edit-description']"));
|
||||||
wait.until(ExpectedConditions.elementToBeClickable(By.xpath(enterDescription)));
|
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.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
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user