World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Java ai-catalogdata-catalogdatalakefederated-querylakehousemetadatametalakemodel-catalogopendatacatalogskycomputingstratosphere
[#2604][#2606] improve(IT): add more test cases for e2e test of metalake page (#2701)
CHEYNEcf74fffcd4df
diff --git a/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/MetalakePageTest.java b/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/MetalakePageTest.javaindex ea30919a52..271be49e0a 100644--- a/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/MetalakePageTest.java+++ b/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/MetalakePageTest.java@@ -14,11 +14,17 @@ import org.junit.jupiter.api.TestMethodOrder;@TestMethodOrder(MethodOrderer.OrderAnnotation.class)public class MetalakePageTest extends AbstractWebIT {+ private static final String WEB_TITLE = "Gravitino";+ private static final String METALAKE_NAME = "metalake_name";+ private static final String EDITED_METALAKE_NAME = METALAKE_NAME + "_edited";+ private static final String FOOTER_LINK_DATASTRATO = "https://datastrato.ai/";+ private static final String FOOTER_LINK_DOCS = "https://datastrato.ai/docs/";+ private static final String FOOTER_LINK_LICENSE =+ "https://github.com/datastrato/gravitino/blob/main/LICENSE";+ private static final String FOOTER_LINK_SUPPORT =+ "https://github.com/datastrato/gravitino/issues";MetalakePage metalakePage = new MetalakePage();- String metalakeName = "metalake_name";- String editedMetalakeName = metalakeName + "_edited";-// Create a metalake by name, set the default comment and properties.public void createMetalakeAction(String name) throws InterruptedException {clickAndWait(metalakePage.createMetalakeBtn);@@ -35,36 +41,36 @@ public class MetalakePageTest extends AbstractWebIT {@Order(0)public void homePage() {String title = driver.getTitle();- Assertions.assertEquals("Gravitino", title);+ Assertions.assertEquals(WEB_TITLE, title);}@Test@Order(1)public void testCreateMetalake() throws InterruptedException {- createMetalakeAction(metalakeName);- Assertions.assertTrue(metalakePage.verifyCreateMetalake(metalakeName));+ createMetalakeAction(METALAKE_NAME);+ Assertions.assertTrue(metalakePage.verifyCreateMetalake(METALAKE_NAME));}@Test@Order(2)public void testViewMetalakeDetails() throws InterruptedException {- metalakePage.clickViewMetalakeBtn(metalakeName);- Assertions.assertTrue(metalakePage.verifyShowMetalakeDetails(metalakeName));+ metalakePage.clickViewMetalakeBtn(METALAKE_NAME);+ Assertions.assertTrue(metalakePage.verifyShowMetalakeDetails(METALAKE_NAME));}@Test@Order(3)public void testEditMetalake() {- metalakePage.clickEditMetalakeBtn(metalakeName);- metalakePage.setMetalakeNameField(editedMetalakeName);+ metalakePage.clickEditMetalakeBtn(METALAKE_NAME);+ metalakePage.setMetalakeNameField(EDITED_METALAKE_NAME);metalakePage.submitHandleMetalakeBtn.click();- Assertions.assertTrue(metalakePage.verifyEditedMetalake(editedMetalakeName));+ Assertions.assertTrue(metalakePage.verifyEditedMetalake(EDITED_METALAKE_NAME));}@Test@Order(4)public void testDeleteMetalake() {- metalakePage.clickDeleteMetalakeBtn(editedMetalakeName);+ metalakePage.clickDeleteMetalakeBtn(EDITED_METALAKE_NAME);metalakePage.confirmDeleteBtn.click();Assertions.assertTrue(metalakePage.verifyEmptyMetalake());}@@ -113,4 +119,49 @@ public class MetalakePageTest extends AbstractWebIT {metalakePage.clickMetalakeLink(name);Assertions.assertTrue(metalakePage.verifyLinkToCatalogsPage(name));}++ @Test+ @Order(9)+ public void testRefreshPage() {+ driver.navigate().refresh();++ Assertions.assertEquals(driver.getTitle(), WEB_TITLE);+ Assertions.assertTrue(metalakePage.verifyRefreshPage());+ }++ @Test+ @Order(10)+ public void testCheckLinkDatastrato() {+ String originalWindowHandle = driver.getWindowHandle();+ metalakePage.footerLinkDatastrato.click();+ Assertions.assertTrue(+ metalakePage.verifyLinkInNewWindow(originalWindowHandle, FOOTER_LINK_DATASTRATO, false));+ }++ @Test+ @Order(11)+ public void testCheckLinkLicense() {+ String originalWindowHandle = driver.getWindowHandle();+ metalakePage.footerLinkLicense.click();+ Assertions.assertTrue(+ metalakePage.verifyLinkInNewWindow(originalWindowHandle, FOOTER_LINK_LICENSE, false));+ }++ @Test+ @Order(12)+ public void testCheckLinkDocs() {+ String originalWindowHandle = driver.getWindowHandle();+ metalakePage.footerLinkDocs.click();+ Assertions.assertTrue(+ metalakePage.verifyLinkInNewWindow(originalWindowHandle, FOOTER_LINK_DOCS, true));+ }++ @Test+ @Order(13)+ public void testCheckLinkSupport() {+ String originalWindowHandle = driver.getWindowHandle();+ metalakePage.footerLinkSupport.click();+ Assertions.assertTrue(+ metalakePage.verifyLinkInNewWindow(originalWindowHandle, FOOTER_LINK_SUPPORT, false));+ }}diff --git a/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/pages/MetalakePage.java b/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/pages/MetalakePage.javaindex 36eb11ed61..febf8dfc48 100644--- a/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/pages/MetalakePage.java+++ b/integration-test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/pages/MetalakePage.java@@ -8,7 +8,9 @@ package com.datastrato.gravitino.integration.test.web.ui.pages;import com.datastrato.gravitino.integration.test.web.ui.utils.AbstractWebIT;import java.util.List;import java.util.Objects;+import java.util.Set;import org.openqa.selenium.By;+import org.openqa.selenium.JavascriptExecutor;import org.openqa.selenium.Keys;import org.openqa.selenium.WebElement;import org.openqa.selenium.support.FindBy;@@ -17,6 +19,8 @@ import org.openqa.selenium.support.ui.ExpectedConditions;import org.openqa.selenium.support.ui.WebDriverWait;public class MetalakePage extends AbstractWebIT {+ private static final String PAGE_TITLE = "Metalakes";+@FindBy(xpath ="//div[contains(@class, 'MuiDataGrid-main')]//div[contains(@class, 'MuiDataGrid-virtualScroller')]//div[@role='rowgroup']")@@ -73,6 +77,24 @@ public class MetalakePage extends AbstractWebIT {"//div[@data-refer='metalake-table-grid']//div[contains(@class, 'MuiDataGrid-overlay')]")public WebElement metalakeTableWrapper;+ @FindBy(xpath = "//*[@data-refer='back-home-btn']")+ public WebElement backHomeBtn;++ @FindBy(xpath = "//*[@data-refer='metalake-page-title']")+ public WebElement metalakePageTitle;++ @FindBy(xpath = "//a[@data-refer='footer-link-datastrato']")+ public WebElement footerLinkDatastrato;++ @FindBy(xpath = "//a[@data-refer='footer-link-license']")+ public WebElement footerLinkLicense;++ @FindBy(xpath = "//a[@data-refer='footer-link-docs']")+ public WebElement footerLinkDocs;++ @FindBy(xpath = "//a[@data-refer='footer-link-support']")+ public WebElement footerLinkSupport;+public MetalakePage() {PageFactory.initElements(driver, this);}@@ -281,7 +303,7 @@ public class MetalakePage extends AbstractWebIT {}}- public boolean verifyLinkToCatalogsPage(String name) {+ public boolean verifyLinkToCatalogsPage(String name) throws InterruptedException {try {WebDriverWait wait = new WebDriverWait(driver, MAX_TIMEOUT);wait.until(ExpectedConditions.visibilityOf(metalakeNameLink));@@ -297,6 +319,61 @@ public class MetalakePage extends AbstractWebIT {} catch (Exception e) {LOG.error(e.getMessage(), e);return false;+ } finally {+ clickAndWait(backHomeBtn);+ }+ }++ public boolean verifyRefreshPage() {+ try {+ WebDriverWait wait = new WebDriverWait(driver, MAX_TIMEOUT);+ wait.until(+ webDriver ->+ ((JavascriptExecutor) webDriver)+ .executeScript("return document.readyState")+ .equals("complete"));+ String pageTitle = metalakePageTitle.getText();+ boolean isPageTitle = pageTitle.equals(PAGE_TITLE);+ if (!isPageTitle) {+ LOG.error("No match with title, get {}", pageTitle);+ return false;+ }+ List<WebElement> dataList = dataViewer.findElements(By.xpath(".//div[@data-field='name']"));+ if (dataList.isEmpty()) {+ LOG.error("Table List should not be empty");+ return false;+ }+ return true;+ } catch (Exception e) {+ LOG.error(e.getMessage(), e);+ return false;+ }+ }++ public boolean verifyLinkInNewWindow(+ String originalWindowHandle, String expectedUrl, boolean contains) {+ try {+ Set<String> allWindowHandles = driver.getWindowHandles();+ for (String windowHandle : allWindowHandles) {+ if (!windowHandle.equals(originalWindowHandle)) {+ driver.switchTo().window(windowHandle);+ break;+ }+ }++ String actualUrl = driver.getCurrentUrl();++ if (contains) {+ return actualUrl.contains(expectedUrl);+ }+ return actualUrl.equals(expectedUrl);++ } catch (Exception e) {+ LOG.error(e.getMessage(), e);+ return false;+ } finally {+ driver.close();+ driver.switchTo().window(originalWindowHandle);}}}diff --git a/web/src/app/rootLayout/Footer.js b/web/src/app/rootLayout/Footer.jsindex d091a65737..81da7d05cf 100644--- a/web/src/app/rootLayout/Footer.js+++ b/web/src/app/rootLayout/Footer.js@@ -14,7 +14,12 @@ const Footer = props => {<Box className={'twc-flex twc-flex-wrap twc-items-center twc-justify-between'}><Typography className='twc-mr-2'>{`© 2023 `}- <Link className={'twc-no-underline twc-text-primary-main'} target='_blank' href='https://datastrato.ai/'>+ <Link+ className={'twc-no-underline twc-text-primary-main'}+ target='_blank'+ href='https://datastrato.ai/'+ data-refer='footer-link-datastrato'+ >Datastrato</Link></Typography>@@ -23,6 +28,7 @@ const Footer = props => {className={'twc-no-underline twc-text-primary-main'}target='_blank'href='https://github.com/datastrato/gravitino/blob/main/LICENSE'+ data-refer='footer-link-license'>License</Link>@@ -30,6 +36,7 @@ const Footer = props => {className={'twc-no-underline twc-text-primary-main'}target='_blank'href='https://datastrato.ai/docs/'+ data-refer='footer-link-docs'>Documentation</Link>@@ -37,6 +44,7 @@ const Footer = props => {className={'twc-no-underline twc-text-primary-main'}target='_blank'href='https://github.com/datastrato/gravitino/issues'+ data-refer='footer-link-support'>Support</Link>