mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-18 14:06:59 +00:00
added tests for owner, tags filters and search matches (#2285)
* added tests for owner, tags filters and search matches * addressing style check
This commit is contained in:
parent
7b20a62118
commit
1eaf9b1cc1
@ -185,7 +185,9 @@ const FacetFilter: FunctionComponent<FacetProp> = ({
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="sidebar-my-data-holder mt-2 mb-3">
|
||||
<div
|
||||
className="sidebar-my-data-holder mt-2 mb-3"
|
||||
data-testid={`filter-containers-${index}`}>
|
||||
{getFilterItems(aggregation)}
|
||||
</div>
|
||||
{getSeparator(aggregations.length, index)}
|
||||
|
@ -30,6 +30,7 @@ import org.junit.jupiter.api.TestMethodOrder;
|
||||
import org.openmetadata.catalog.selenium.events.Events;
|
||||
import org.openmetadata.catalog.selenium.properties.Property;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.NoSuchElementException;
|
||||
import org.openqa.selenium.TimeoutException;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
@ -55,6 +56,7 @@ public class CommonTests {
|
||||
Integer waitTime = Property.getInstance().getSleepTime();
|
||||
static String url = Property.getInstance().getURL();
|
||||
static String urlTag = "/api/v1/tags/";
|
||||
String tableName = "dim_address";
|
||||
|
||||
@BeforeEach
|
||||
public void openMetadataWindow() {
|
||||
@ -330,6 +332,69 @@ public class CommonTests {
|
||||
Events.sendEnter(webDriver, By.cssSelector("[id='searchBox']"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(15)
|
||||
public void tagFilterCountCheck() throws InterruptedException {
|
||||
Events.sendKeys(webDriver, By.cssSelector("[data-testid='searchBox']"), tableName);
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='data-name']"));
|
||||
Thread.sleep(waitTime);
|
||||
actions.moveToElement(webDriver.findElement(By.xpath("//div[@data-testid='tag-conatiner']//span"))).perform();
|
||||
Events.click(webDriver, By.xpath("//div[@data-testid='tag-conatiner']//span"));
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='associatedTagName']"));
|
||||
for (int i = 0; i <= 8; i++) {
|
||||
Events.sendKeys(webDriver, By.cssSelector("[data-testid='associatedTagName']"), "P");
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='list-item']"));
|
||||
}
|
||||
for (int i = 0; i <= 5; i++) {
|
||||
Events.sendKeys(webDriver, By.cssSelector("[data-testid='associatedTagName']"), "U");
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='list-item']"));
|
||||
}
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='saveAssociatedTag']"));
|
||||
Thread.sleep(2000);
|
||||
Object tagsCount = webDriver.findElements(By.xpath("//div[@data-testid='tag-conatiner']/div/div")).size() - 1;
|
||||
Thread.sleep(2000);
|
||||
webDriver.navigate().back();
|
||||
Thread.sleep(2000);
|
||||
Object tagsFilterCount = webDriver.findElements(By.xpath("//div[@data-testid='filter-containers-2']/div")).size();
|
||||
Assert.assertEquals(tagsFilterCount.toString(), tagsCount.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(16)
|
||||
public void differentSearchDifferentResultCheck() throws InterruptedException {
|
||||
openHomePage();
|
||||
Events.sendKeys(webDriver, By.cssSelector("[data-testid='searchBox']"), "!");
|
||||
Events.sendEnter(webDriver, By.cssSelector("[id='searchBox']"));
|
||||
Thread.sleep(2000);
|
||||
String search1 =
|
||||
webDriver.findElement(By.cssSelector("[data-testid='no-search-results']")).getAttribute("innerHTML");
|
||||
Assert.assertEquals(search1, "No matching data assets found for !");
|
||||
webDriver.navigate().back();
|
||||
Events.sendKeys(webDriver, By.cssSelector("[data-testid='searchBox']"), "{");
|
||||
Events.sendEnter(webDriver, By.cssSelector("[id='searchBox']"));
|
||||
Thread.sleep(2000);
|
||||
try {
|
||||
String search2 =
|
||||
webDriver.findElement(By.cssSelector("[data-testid='no-search-results']")).getAttribute("innerHTML");
|
||||
Assert.assertEquals(search2, "No matching data assets found for {");
|
||||
} catch (NoSuchElementException exception) {
|
||||
LOG.info("Search results are not similar for no data found!");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(17)
|
||||
public void missingMatchesForSearchCheck() throws InterruptedException {
|
||||
openHomePage();
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='dashboards']")); // Dashboards
|
||||
Events.sendKeys(webDriver, By.cssSelector("[data-testid='searchBox']"), "sales");
|
||||
Events.sendEnter(webDriver, By.cssSelector("[id='searchBox']"));
|
||||
String resultsCount =
|
||||
webDriver.findElement(By.xpath("//div[@data-testid='search-container']/div")).getAttribute("innerHTML");
|
||||
Object matchesCount = webDriver.findElements(By.cssSelector("[data-testid='matches-stats']")).size();
|
||||
Assert.assertEquals(matchesCount + " results", resultsCount);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void closeTabs() {
|
||||
ArrayList<String> tabs = new ArrayList<>(webDriver.getWindowHandles());
|
||||
|
@ -46,6 +46,7 @@ public class TeamsPageTest {
|
||||
static String teamDisplayName = faker.name().lastName();
|
||||
static Actions actions;
|
||||
static WebDriverWait wait;
|
||||
String teamsFilterCountXpath = "//div[@data-testid='terms-summary']//span[@data-testid='filter-count']";
|
||||
|
||||
@BeforeEach
|
||||
public void openMetadataWindow() {
|
||||
@ -175,11 +176,38 @@ public class TeamsPageTest {
|
||||
Thread.sleep(2000);
|
||||
webDriver.navigate().back();
|
||||
Thread.sleep(2000);
|
||||
String teamsFilterCount =
|
||||
String teamsFilterCount = webDriver.findElement(By.xpath(teamsFilterCountXpath)).getAttribute("innerHTML");
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='tables']")); // Tables
|
||||
Events.click(webDriver, By.xpath("(//button[@data-testid='table-link'])[last()]"));
|
||||
Events.click(webDriver, By.xpath("(//button[@data-testid='tab'])[5]")); // Manage
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='owner-dropdown']")); // Owner
|
||||
Thread.sleep(2000);
|
||||
String teamsCount =
|
||||
webDriver
|
||||
.findElement(By.xpath("//div[@data-testid='terms-summary']//span[@data-testid='filter-count']"))
|
||||
.findElement(By.xpath("//button[@data-testid='tab']/span/span[@data-testid='filter-count']"))
|
||||
.getAttribute("innerHTML");
|
||||
Assert.assertEquals(teamsFilterCount, teamsListCount.toString());
|
||||
Assert.assertEquals(teamsCount, teamsFilterCount);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(7)
|
||||
public void ownerDropDownListTeamsCount() throws InterruptedException {
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='closeWhatsNew']")); // Close What's new
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='tables']")); // Tables
|
||||
Events.click(webDriver, By.xpath("(//button[@data-testid='table-link'])[last()]"));
|
||||
Events.click(webDriver, By.xpath("(//button[@data-testid='tab'])[5]")); // Manage
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='owner-dropdown']")); // Owner
|
||||
Thread.sleep(2000);
|
||||
String teamsCount =
|
||||
webDriver
|
||||
.findElement(By.xpath("//button[@data-testid='tab']/span/span[@data-testid='filter-count']"))
|
||||
.getAttribute("innerHTML");
|
||||
webDriver.navigate().back();
|
||||
Events.click(webDriver, By.cssSelector("[data-testid='image']")); // home-page
|
||||
Thread.sleep(2000);
|
||||
String teamsFilterCount = webDriver.findElement(By.xpath(teamsFilterCountXpath)).getAttribute("innerHTML");
|
||||
Assert.assertEquals(teamsCount, teamsFilterCount);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
|
Loading…
x
Reference in New Issue
Block a user