-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#2436] feat(IT): Add catalogs page to web e2e test #2528
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
156 changes: 156 additions & 0 deletions
156
...test/src/test/java/com/datastrato/gravitino/integration/test/web/ui/CatalogsPageTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
/* | ||
* Copyright 2024 Datastrato Pvt Ltd. | ||
* This software is licensed under the Apache License version 2. | ||
*/ | ||
|
||
package com.datastrato.gravitino.integration.test.web.ui; | ||
|
||
import com.datastrato.gravitino.integration.test.container.ContainerSuite; | ||
import com.datastrato.gravitino.integration.test.container.HiveContainer; | ||
import com.datastrato.gravitino.integration.test.web.ui.pages.CatalogsPage; | ||
import com.datastrato.gravitino.integration.test.web.ui.pages.MetalakePage; | ||
import com.datastrato.gravitino.integration.test.web.ui.utils.AbstractWebIT; | ||
import org.apache.hadoop.hive.conf.HiveConf; | ||
import org.junit.jupiter.api.AfterAll; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.MethodOrderer; | ||
import org.junit.jupiter.api.Order; | ||
import org.junit.jupiter.api.Tag; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.TestMethodOrder; | ||
|
||
@Tag("gravitino-docker-it") | ||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class) | ||
public class CatalogsPageTest extends AbstractWebIT { | ||
private static final ContainerSuite containerSuite = ContainerSuite.getInstance(); | ||
MetalakePage metalakePage = new MetalakePage(); | ||
CatalogsPage catalogsPage = new CatalogsPage(); | ||
|
||
private static final String metalakeName = "metalake_name"; | ||
String catalogName = "catalog_name"; | ||
String modifiedCatalogName = catalogName + "_edited"; | ||
String schemaName = "default"; | ||
String tableName = "employee"; | ||
|
||
@BeforeAll | ||
public static void before() { | ||
containerSuite.startHiveContainer(); | ||
|
||
// Initial hive client | ||
HiveConf hiveConf = new HiveConf(); | ||
String hiveMetastoreUris = | ||
String.format( | ||
"thrift://%s:%d", | ||
containerSuite.getHiveContainer().getContainerIpAddress(), | ||
HiveContainer.HIVE_METASTORE_PORT); | ||
hiveConf.set(HiveConf.ConfVars.METASTOREURIS.varname, hiveMetastoreUris); | ||
} | ||
|
||
@AfterAll | ||
public static void after() { | ||
try { | ||
closer.close(); | ||
} catch (Exception e) { | ||
LOG.error(e.getMessage(), e); | ||
} | ||
} | ||
|
||
@Test | ||
@Order(1) | ||
public void testCreateHiveCatalog() throws InterruptedException { | ||
// Create metalake first | ||
clickAndWait(metalakePage.createMetalakeBtn); | ||
metalakePage.setMetalakeNameField(metalakeName); | ||
clickAndWait(metalakePage.submitHandleMetalakeBtn); | ||
metalakePage.clickMetalakeLink(metalakeName); | ||
// Create catalog | ||
clickAndWait(catalogsPage.createCatalogBtn); | ||
catalogsPage.setCatalogNameField(catalogName); | ||
catalogsPage.setCatalogCommentField("catalog comment"); | ||
String hiveMetastoreUris = | ||
String.format( | ||
"thrift://%s:%d", | ||
containerSuite.getHiveContainer().getContainerIpAddress(), | ||
HiveContainer.HIVE_METASTORE_PORT); | ||
catalogsPage.setHiveCatalogURI(hiveMetastoreUris); | ||
catalogsPage.addCatalogPropsBtn.click(); | ||
catalogsPage.setCatalogProps(1, "key1", "value1"); | ||
catalogsPage.addCatalogPropsBtn.click(); | ||
catalogsPage.setCatalogProps(2, "key2", "value2"); | ||
clickAndWait(catalogsPage.handleSubmitCatalogBtn); | ||
|
||
Assertions.assertTrue(catalogsPage.verifyCreateHiveCatalog(catalogName)); | ||
} | ||
|
||
@Test | ||
@Order(2) | ||
public void testRefreshPage() { | ||
driver.navigate().refresh(); | ||
Assertions.assertEquals(driver.getTitle(), "Gravitino"); | ||
Assertions.assertTrue(catalogsPage.verifyRefreshPage()); | ||
} | ||
|
||
@Test | ||
@Order(3) | ||
public void testViewTabMetalakeDetails() throws InterruptedException { | ||
clickAndWait(catalogsPage.tabDetailsBtn); | ||
Assertions.assertTrue(catalogsPage.verifyShowDetailsContent()); | ||
clickAndWait(catalogsPage.tabTableBtn); | ||
Assertions.assertTrue(catalogsPage.verifyShowTableContent()); | ||
} | ||
|
||
@Test | ||
@Order(4) | ||
public void testViewCatalogDetails() throws InterruptedException { | ||
catalogsPage.clickViewCatalogBtn(catalogName); | ||
Assertions.assertTrue(catalogsPage.verifyShowCatalogDetails(catalogName)); | ||
} | ||
|
||
@Test | ||
@Order(5) | ||
public void testEditCatalog() throws InterruptedException { | ||
catalogsPage.clickEditCatalogBtn(catalogName); | ||
catalogsPage.setCatalogNameField(modifiedCatalogName); | ||
clickAndWait(catalogsPage.handleSubmitCatalogBtn); | ||
Assertions.assertTrue(catalogsPage.verifyEditedCatalog(modifiedCatalogName)); | ||
} | ||
|
||
@Test | ||
@Order(6) | ||
public void testClickCatalogLink() { | ||
catalogsPage.clickCatalogLink(metalakeName, modifiedCatalogName); | ||
Assertions.assertTrue(catalogsPage.verifyShowTableTitle("Schemas")); | ||
} | ||
|
||
@Test | ||
@Order(7) | ||
public void testClickSchemaLink() { | ||
catalogsPage.clickSchemaLink(metalakeName, modifiedCatalogName, schemaName); | ||
Assertions.assertTrue(catalogsPage.verifyShowTableTitle("Tables")); | ||
} | ||
|
||
@Test | ||
@Order(8) | ||
public void testClickTableLink() { | ||
catalogsPage.clickTableLink(metalakeName, modifiedCatalogName, schemaName, tableName); | ||
Assertions.assertTrue(catalogsPage.verifyShowTableTitle("Columns")); | ||
Assertions.assertTrue(catalogsPage.verifyTableColumns()); | ||
} | ||
|
||
@Test | ||
@Order(9) | ||
public void testDeleteCatalog() throws InterruptedException { | ||
catalogsPage.clickBreadCrumbsToCatalogs(); | ||
catalogsPage.clickDeleteCatalogBtn(modifiedCatalogName); | ||
clickAndWait(catalogsPage.confirmDeleteBtn); | ||
Assertions.assertTrue(catalogsPage.verifyEmptyCatalog()); | ||
} | ||
|
||
@Test | ||
@Order(10) | ||
public void testBackHomePage() throws InterruptedException { | ||
clickAndWait(catalogsPage.backHomeBtn); | ||
Assertions.assertTrue(catalogsPage.verifyBackHomePage()); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add a test case
testCreateMultipleCatalogs
and check the render table data is correct values when switch different catalog tree nodesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because other providers of catalogs require different environments, I will add these tests in the next pull request.