mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-11-04 04:29:13 +00:00 
			
		
		
		
	added tests for tags, user search and lineage (#2312)
* added tests for tags, user search and lineage * addressing style-check * empty commit, testing workflow
This commit is contained in:
		
							parent
							
								
									89d029355d
								
							
						
					
					
						commit
						b9f4249457
					
				@ -610,6 +610,7 @@ const Entitylineage: FunctionComponent<EntityLineageProp> = ({
 | 
			
		||||
                      <SVGIcons
 | 
			
		||||
                        alt="icon-edit-lineag"
 | 
			
		||||
                        className="tw--mt-1"
 | 
			
		||||
                        data-testid="edit-lineage"
 | 
			
		||||
                        icon={
 | 
			
		||||
                          !isEditMode
 | 
			
		||||
                            ? 'icon-edit-lineage-color'
 | 
			
		||||
 | 
			
		||||
@ -400,7 +400,7 @@ const TagsPage = () => {
 | 
			
		||||
                                    </button>
 | 
			
		||||
                                  </NonAdminAction>
 | 
			
		||||
                                </div>
 | 
			
		||||
                                <div className="tw-mt-1">
 | 
			
		||||
                                <div className="tw-mt-1" data-testid="usage">
 | 
			
		||||
                                  <span className="tw-text-grey-muted tw-mr-1">
 | 
			
		||||
                                    Usage:
 | 
			
		||||
                                  </span>
 | 
			
		||||
@ -414,7 +414,9 @@ const TagsPage = () => {
 | 
			
		||||
                                      {tag.usageCount}
 | 
			
		||||
                                    </Link>
 | 
			
		||||
                                  ) : (
 | 
			
		||||
                                    <span className="tw-no-description">
 | 
			
		||||
                                    <span
 | 
			
		||||
                                      className="tw-no-description"
 | 
			
		||||
                                      data-testid="usage-count">
 | 
			
		||||
                                      Not used
 | 
			
		||||
                                    </span>
 | 
			
		||||
                                  )}
 | 
			
		||||
 | 
			
		||||
@ -395,6 +395,17 @@ public class CommonTests {
 | 
			
		||||
    Assert.assertEquals(matchesCount + " results", resultsCount);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Test
 | 
			
		||||
  @Order(18)
 | 
			
		||||
  public void sameNodesLineage() throws InterruptedException {
 | 
			
		||||
    openHomePage();
 | 
			
		||||
    Events.sendKeys(webDriver, By.cssSelector("[data-testid='searchBox']"), "dim_product_variant");
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='data-name']"));
 | 
			
		||||
    Thread.sleep(waitTime);
 | 
			
		||||
    Events.click(webDriver, By.xpath("(//button[@data-testid='tab'])[4]"));
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='edit-lineage']"));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @AfterEach
 | 
			
		||||
  public void closeTabs() {
 | 
			
		||||
    ArrayList<String> tabs = new ArrayList<>(webDriver.getWindowHandles());
 | 
			
		||||
 | 
			
		||||
@ -31,6 +31,7 @@ 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(3)
 | 
			
		||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
 | 
			
		||||
@ -213,6 +214,54 @@ public class TagsPageTest {
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='saveAssociatedTag']"));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Test
 | 
			
		||||
  @Order(10)
 | 
			
		||||
  public void addTagWithExistingName() throws InterruptedException {
 | 
			
		||||
    openTagsPage();
 | 
			
		||||
    Events.click(webDriver, By.xpath("//*[text()[contains(.,'" + "PersonalData" + "')]] "));
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='add-new-tag-button']"));
 | 
			
		||||
    wait.until(ExpectedConditions.elementToBeClickable(By.name("name")));
 | 
			
		||||
    Events.sendKeys(webDriver, By.name("name"), "Personals");
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='saveButton']"));
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='appbar-item'][id='explore']")); // Explore
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='table-link']"));
 | 
			
		||||
    Events.click(webDriver, By.xpath("//div[@data-testid='tag-conatiner']//span"));
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='associatedTagName']"));
 | 
			
		||||
    Events.sendKeys(webDriver, By.cssSelector("[data-testid='associatedTagName']"), "Personals");
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='list-item']"));
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='saveAssociatedTag']"));
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='menu-button'][id='menu-button-Settings']")); // Setting
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='menu-item-Tags']")); // Setting/Tags
 | 
			
		||||
    Events.click(webDriver, By.xpath("//*[text()[contains(.,'" + "PersonalData" + "')]] "));
 | 
			
		||||
    Thread.sleep(2000);
 | 
			
		||||
    String usageCount =
 | 
			
		||||
        webDriver
 | 
			
		||||
            .findElement(By.xpath("(//div[@data-testid='usage'])[1]/a[@data-testid='usage-count']"))
 | 
			
		||||
            .getAttribute("innerHTML");
 | 
			
		||||
    Assert.assertEquals(usageCount, "0");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Test
 | 
			
		||||
  @Order(11)
 | 
			
		||||
  public void removeTagWithExistingName() throws InterruptedException {
 | 
			
		||||
    openTagsPage();
 | 
			
		||||
    Events.click(webDriver, By.xpath("//*[text()[contains(.,'" + "PersonalData" + "')]] "));
 | 
			
		||||
    Events.click(webDriver, By.xpath("(//a[@data-testid='usage-count'])[2]"));
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='table-link']"));
 | 
			
		||||
    Events.click(webDriver, By.xpath("//div[@data-testid='tag-conatiner']//span"));
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='remove']"));
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='saveAssociatedTag']"));
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='menu-button'][id='menu-button-Settings']")); // Setting
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='menu-item-Tags']")); // Setting/Tags
 | 
			
		||||
    Events.click(webDriver, By.xpath("//*[text()[contains(.,'" + "PersonalData" + "')]] "));
 | 
			
		||||
    Thread.sleep(2000);
 | 
			
		||||
    String usageCount =
 | 
			
		||||
        webDriver
 | 
			
		||||
            .findElement(By.xpath("(//div[@data-testid='usage'])[2]/span[@data-testid='usage-count']"))
 | 
			
		||||
            .getAttribute("innerHTML");
 | 
			
		||||
    Assert.assertEquals(usageCount, "Not used");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @AfterEach
 | 
			
		||||
  public void closeTabs() {
 | 
			
		||||
    ArrayList<String> tabs = new ArrayList<>(webDriver.getWindowHandles());
 | 
			
		||||
 | 
			
		||||
@ -210,6 +210,26 @@ public class TeamsPageTest {
 | 
			
		||||
    Assert.assertEquals(teamsCount, teamsFilterCount);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Test
 | 
			
		||||
  @Order(8)
 | 
			
		||||
  public void teamsWithSameDisplayNameCheck() throws Exception {
 | 
			
		||||
    for (int i = 0; i < 2; i++) {
 | 
			
		||||
      createTeam();
 | 
			
		||||
      webDriver.navigate().back();
 | 
			
		||||
      Events.click(webDriver, By.cssSelector("[data-testid='whatsnew-modal']")); // What's New
 | 
			
		||||
    }
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='closeWhatsNew']")); // Close What's new
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='menu-button'][id='menu-button-Settings']")); // Setting
 | 
			
		||||
    Events.click(webDriver, By.cssSelector("[data-testid='menu-item-Teams']")); // Setting/Teams
 | 
			
		||||
    Thread.sleep(2000);
 | 
			
		||||
    int teamsCount = webDriver.findElements(By.xpath("//*[text()[contains(.,'" + teamDisplayName + "')]] ")).size();
 | 
			
		||||
    if (teamsCount > 1) {
 | 
			
		||||
      throw new Exception("Two Team with same display-name exists");
 | 
			
		||||
    } else {
 | 
			
		||||
      Assert.assertEquals(teamsCount, 1);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @AfterEach
 | 
			
		||||
  public void closeTabs() {
 | 
			
		||||
    ArrayList<String> tabs = new ArrayList<>(webDriver.getWindowHandles());
 | 
			
		||||
 | 
			
		||||
@ -96,6 +96,19 @@ public class UsersPageTest {
 | 
			
		||||
    Assert.assertEquals(afterUsersCount, "15");
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Test
 | 
			
		||||
  @Order(3)
 | 
			
		||||
  public void caseSensitiveSearchCheck() throws InterruptedException {
 | 
			
		||||
    openUsersPage();
 | 
			
		||||
    Events.sendKeys(webDriver, By.cssSelector("[data-testid='searchbar']"), "AaR");
 | 
			
		||||
    Thread.sleep(4000);
 | 
			
		||||
    Object userResultsCount =
 | 
			
		||||
        webDriver
 | 
			
		||||
            .findElements(By.xpath("//div[@data-testid='user-card-container']/div[@data-testid='user-card-container']"))
 | 
			
		||||
            .size();
 | 
			
		||||
    Assert.assertEquals(userResultsCount, 3);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @AfterEach
 | 
			
		||||
  public void closeTabs() {
 | 
			
		||||
    ArrayList<String> tabs = new ArrayList<>(webDriver.getWindowHandles());
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user