This is an automated email from the ASF dual-hosted git repository.
liuxun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new 692dfb409 [#5796][#5798] Add e2e test case for creating
schema/fileset/topic/table (#5805)
692dfb409 is described below
commit 692dfb409368d43452ff0c46a8d83f9dab767d6e
Author: Qian Xia <[email protected]>
AuthorDate: Wed Dec 11 10:42:39 2024 +0800
[#5796][#5798] Add e2e test case for creating schema/fileset/topic/table
(#5805)
### What changes were proposed in this pull request?
Add e2e test case for creating schema/fileset/topic/table
### Why are the changes needed?
we need to implement the created test case by simulating a click on the
UI dialog box
Fix: #5796, #5797, #5798, #5799
### Does this PR introduce _any_ user-facing change?
N/A
### How was this patch tested?
local run e2e test
<img width="398" alt="image"
src="https://github.com/user-attachments/assets/de5e716b-0956-46ed-a41d-3d619dacfb3f">
<img width="376" alt="image"
src="https://github.com/user-attachments/assets/c69b560a-6cab-424f-92b1-1dba46a447de">
<img width="337" alt="image"
src="https://github.com/user-attachments/assets/4ff54f73-468b-4ea7-b413-d6e745893492">
---
.../test/web/ui/CatalogsPageKafkaTest.java | 50 +----
.../integration/test/web/ui/CatalogsPageTest.java | 117 +++++------
.../test/web/ui/pages/CatalogsPage.java | 224 ++++++++++++++++++++-
.../metalake/rightContent/CreateTableDialog.js | 1 +
.../metalake/rightContent/RightContent.js | 2 +-
5 files changed, 288 insertions(+), 106 deletions(-)
diff --git
a/web/integration-test/src/test/java/org/apache/gravitino/integration/test/web/ui/CatalogsPageKafkaTest.java
b/web/integration-test/src/test/java/org/apache/gravitino/integration/test/web/ui/CatalogsPageKafkaTest.java
index 8af7277e2..61278114e 100644
---
a/web/integration-test/src/test/java/org/apache/gravitino/integration/test/web/ui/CatalogsPageKafkaTest.java
+++
b/web/integration-test/src/test/java/org/apache/gravitino/integration/test/web/ui/CatalogsPageKafkaTest.java
@@ -20,12 +20,8 @@
package org.apache.gravitino.integration.test.web.ui;
import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
-import org.apache.gravitino.Catalog;
-import org.apache.gravitino.NameIdentifier;
import org.apache.gravitino.client.GravitinoAdminClient;
-import org.apache.gravitino.client.GravitinoMetalake;
import org.apache.gravitino.integration.test.container.ContainerSuite;
import org.apache.gravitino.integration.test.web.ui.pages.CatalogsPage;
import org.apache.gravitino.integration.test.web.ui.pages.MetalakePage;
@@ -46,7 +42,6 @@ public class CatalogsPageKafkaTest extends BaseWebIT {
private static final ContainerSuite containerSuite =
ContainerSuite.getInstance();
protected static GravitinoAdminClient gravitinoClient;
- private static GravitinoMetalake metalake;
protected static String gravitinoUri = "http://127.0.0.1:8090";
protected static String kafkaUri = "http://127.0.0.1:9092";
@@ -76,35 +71,6 @@ public class CatalogsPageKafkaTest extends BaseWebIT {
catalogsPage = new CatalogsPage(driver);
}
- /**
- * Creates a Kafka topic within the specified Metalake, Catalog, Schema, and
Topic names.
- *
- * @param metalakeName The name of the Metalake.
- * @param catalogName The name of the Catalog.
- * @param schemaName The name of the Schema.
- * @param topicName The name of the Kafka topic.
- */
- void createTopic(String metalakeName, String catalogName, String schemaName,
String topicName) {
- Catalog catalog_kafka = metalake.loadCatalog(catalogName);
- catalog_kafka
- .asTopicCatalog()
- .createTopic(
- NameIdentifier.of(schemaName, topicName), "comment", null,
Collections.emptyMap());
- }
-
- /**
- * Drops a Kafka topic from the specified Metalake, Catalog, and Schema.
- *
- * @param metalakeName The name of the Metalake where the topic resides.
- * @param catalogName The name of the Catalog that contains the topic.
- * @param schemaName The name of the Schema under which the topic exists.
- * @param topicName The name of the Kafka topic to be dropped.
- */
- void dropTopic(String metalakeName, String catalogName, String schemaName,
String topicName) {
- Catalog catalog_kafka = metalake.loadCatalog(catalogName);
- catalog_kafka.asTopicCatalog().dropTopic(NameIdentifier.of(schemaName,
topicName));
- }
-
@Test
@Order(0)
public void testCreateKafkaCatalog() throws InterruptedException {
@@ -113,7 +79,7 @@ public class CatalogsPageKafkaTest extends BaseWebIT {
metalakePage.setMetalakeNameField(METALAKE_NAME);
clickAndWait(metalakePage.submitHandleMetalakeBtn);
// load metalake
- metalake = gravitinoClient.loadMetalake(METALAKE_NAME);
+ gravitinoClient.loadMetalake(METALAKE_NAME);
metalakePage.clickMetalakeLink(METALAKE_NAME);
// create kafka catalog actions
clickAndWait(catalogsPage.createCatalogBtn);
@@ -145,14 +111,17 @@ public class CatalogsPageKafkaTest extends BaseWebIT {
@Test
@Order(2)
public void testKafkaTopicTreeNode() throws InterruptedException {
- // 1. create topic of kafka catalog
- createTopic(METALAKE_NAME, KAFKA_CATALOG_NAME, SCHEMA_NAME, TOPIC_NAME);
- // 2. click schema tree node
+ // 1. click schema tree node
String kafkaSchemaNode =
String.format(
"{{%s}}{{%s}}{{%s}}{{%s}}",
METALAKE_NAME, KAFKA_CATALOG_NAME, CATALOG_TYPE_MESSAGING,
SCHEMA_NAME);
catalogsPage.clickTreeNode(kafkaSchemaNode);
+ // 2. create topic of kafka catalog
+ clickAndWait(catalogsPage.createTopicBtn);
+ catalogsPage.setTopicNameField(TOPIC_NAME);
+ catalogsPage.setTopicCommentField("topic comment");
+ clickAndWait(catalogsPage.handleSubmitTopicBtn);
// 3. verify show table title、 default schema name and tree node
Assertions.assertTrue(catalogsPage.verifyShowTableTitle(SCHEMA_TOPIC_TITLE));
Assertions.assertTrue(catalogsPage.verifyShowDataItemInList(TOPIC_NAME,
false));
@@ -187,14 +156,15 @@ public class CatalogsPageKafkaTest extends BaseWebIT {
@Test
@Order(4)
public void testDropKafkaTopic() throws InterruptedException {
- // delete topic of kafka catalog
- dropTopic(METALAKE_NAME, KAFKA_CATALOG_NAME, SCHEMA_NAME, TOPIC_NAME);
// click schema tree node
String kafkaSchemaNode =
String.format(
"{{%s}}{{%s}}{{%s}}{{%s}}",
METALAKE_NAME, KAFKA_CATALOG_NAME, CATALOG_TYPE_MESSAGING,
SCHEMA_NAME);
catalogsPage.clickTreeNode(kafkaSchemaNode);
+ // delete topic of kafka catalog
+ catalogsPage.clickDeleteBtn(TOPIC_NAME);
+ clickAndWait(catalogsPage.confirmDeleteBtn);
// verify empty topic list
Assertions.assertTrue(catalogsPage.verifyEmptyTableData());
}
diff --git
a/web/integration-test/src/test/java/org/apache/gravitino/integration/test/web/ui/CatalogsPageTest.java
b/web/integration-test/src/test/java/org/apache/gravitino/integration/test/web/ui/CatalogsPageTest.java
index 0b140a122..01c48c6a0 100644
---
a/web/integration-test/src/test/java/org/apache/gravitino/integration/test/web/ui/CatalogsPageTest.java
+++
b/web/integration-test/src/test/java/org/apache/gravitino/integration/test/web/ui/CatalogsPageTest.java
@@ -30,7 +30,6 @@ import org.apache.gravitino.Catalog;
import org.apache.gravitino.NameIdentifier;
import org.apache.gravitino.client.GravitinoAdminClient;
import org.apache.gravitino.client.GravitinoMetalake;
-import org.apache.gravitino.file.Fileset;
import org.apache.gravitino.integration.test.container.ContainerSuite;
import org.apache.gravitino.integration.test.container.TrinoITContainers;
import org.apache.gravitino.integration.test.web.ui.pages.CatalogsPage;
@@ -93,6 +92,7 @@ public class CatalogsPageTest extends BaseWebIT {
private static final String FILESET_NAME = "fileset1";
private static final String TABLE_NAME = "table1";
private static final String TABLE_NAME_2 = "table2";
+ private static final String TABLE_NAME_3 = "table3";
private static final String COLUMN_NAME = "column";
private static final String COLUMN_NAME_2 = "column_2";
private static final String PROPERTIES_KEY1 = "key1";
@@ -131,21 +131,6 @@ public class CatalogsPageTest extends BaseWebIT {
catalogsPage = new CatalogsPage(driver);
}
- /**
- * Create the specified schema
- *
- * @param metalakeName The name of the Metalake where the schema will be
created.
- * @param catalogName The name of the Catalog where the schema will be
created.
- * @param schemaName The name of the Schema where the schema will be created.
- */
- void createSchema(String metalakeName, String catalogName, String
schemaName) {
- Map<String, String> properties = Maps.newHashMap();
- properties.put(PROPERTIES_KEY1, PROPERTIES_VALUE1);
- GravitinoMetalake metalake = gravitinoClient.loadMetalake(metalakeName);
- Catalog catalog = metalake.loadCatalog(catalogName);
- catalog.asSchemas().createSchema(schemaName, "comment", properties);
- }
-
/**
* Creates a table with a single column in the specified Metalake, Catalog,
Schema, and Table.
*
@@ -215,31 +200,6 @@ public class CatalogsPageTest extends BaseWebIT {
return defaultBaseLocation(schemaName) + "/" + filesetName;
}
- /**
- * Creates a fileset within the specified Metalake, Catalog, Schema, and
Fileset names.
- *
- * @param metalakeName The name of the Metalake.
- * @param catalogName The name of the Catalog.
- * @param schemaName The name of the Schema.
- * @param filesetName The name of the Fileset.
- */
- void createFileset(
- String metalakeName, String catalogName, String schemaName, String
filesetName) {
- Map<String, String> properties = Maps.newHashMap();
- properties.put(PROPERTIES_KEY1, PROPERTIES_VALUE1);
- String storageLocation = storageLocation(schemaName, filesetName);
- GravitinoMetalake metalake = gravitinoClient.loadMetalake(metalakeName);
- Catalog catalog_fileset = metalake.loadCatalog(catalogName);
- catalog_fileset
- .asFilesetCatalog()
- .createFileset(
- NameIdentifier.of(schemaName, filesetName),
- "comment",
- Fileset.Type.MANAGED,
- storageLocation,
- properties);
- }
-
@AfterAll
public static void after() {
try {
@@ -270,7 +230,7 @@ public class CatalogsPageTest extends BaseWebIT {
clickAndWait(catalogsPage.handleSubmitCatalogBtn);
// delete catalog
catalogsPage.clickInUseSwitch(DEFAULT_CATALOG_NAME);
- catalogsPage.clickDeleteCatalogBtn(DEFAULT_CATALOG_NAME);
+ catalogsPage.clickDeleteBtn(DEFAULT_CATALOG_NAME);
clickAndWait(catalogsPage.confirmDeleteBtn);
Assertions.assertTrue(catalogsPage.verifyEmptyTableData());
}
@@ -284,9 +244,9 @@ public class CatalogsPageTest extends BaseWebIT {
catalogsPage.setCatalogCommentField("catalog comment");
catalogsPage.setCatalogFixedProp("metastore.uris", hiveMetastoreUri);
catalogsPage.addCatalogPropsBtn.click();
- catalogsPage.setCatalogPropsAt(1, "key1", "value1");
+ catalogsPage.setPropsAt(1, "key1", "value1");
catalogsPage.addCatalogPropsBtn.click();
- catalogsPage.setCatalogPropsAt(2, "key2", "value2");
+ catalogsPage.setPropsAt(2, "key2", "value2");
clickAndWait(catalogsPage.handleSubmitCatalogBtn);
// load catalog
GravitinoMetalake metalake = gravitinoClient.loadMetalake(METALAKE_NAME);
@@ -583,6 +543,33 @@ public class CatalogsPageTest extends BaseWebIT {
@Test
@Order(19)
+ public void testCreateTableByUI() throws InterruptedException {
+ String schemaNode =
+ String.format(
+ "{{%s}}{{%s}}{{%s}}{{%s}}",
+ METALAKE_NAME, MODIFIED_HIVE_CATALOG_NAME,
CATALOG_TYPE_RELATIONAL, SCHEMA_NAME);
+ catalogsPage.clickTreeNode(schemaNode);
+ // 1. create table in hive catalog without partition/sort
order/distribution
+ clickAndWait(catalogsPage.createTableBtn);
+ catalogsPage.setTableNameField(TABLE_NAME_3);
+ catalogsPage.setTableCommentField("table comment for ui");
+ catalogsPage.setTableColumnsAt(0, COLUMN_NAME, "byte");
+ clickAndWait(catalogsPage.handleSubmitTableBtn);
+ Assertions.assertTrue(catalogsPage.verifyShowDataItemInList(TABLE_NAME_3,
false));
+ }
+
+ @Test
+ @Order(20)
+ public void testDropTableByUI() throws InterruptedException {
+ // delete table of hive catalog
+ catalogsPage.clickDeleteBtn(TABLE_NAME_3);
+ clickAndWait(catalogsPage.confirmDeleteBtn);
+ // verify table list without table name 3
+ Assertions.assertTrue(catalogsPage.verifyNoDataItemInList(TABLE_NAME_3,
false));
+ }
+
+ @Test
+ @Order(21)
public void testOtherRelationalCatalogTreeNode() throws InterruptedException
{
String icebergNode =
String.format(
@@ -602,7 +589,7 @@ public class CatalogsPageTest extends BaseWebIT {
}
@Test
- @Order(20)
+ @Order(22)
public void testSelectMetalake() throws InterruptedException {
catalogsPage.metalakeSelectChange(METALAKE_SELECT_NAME);
Assertions.assertTrue(catalogsPage.verifyEmptyTableData());
@@ -612,16 +599,18 @@ public class CatalogsPageTest extends BaseWebIT {
}
@Test
- @Order(21)
- public void testFilesetCatalogTreeNode() throws InterruptedException {
- // 1. create schema and fileset of fileset catalog
- createSchema(METALAKE_NAME, FILESET_CATALOG_NAME, SCHEMA_NAME_FILESET);
- createFileset(METALAKE_NAME, FILESET_CATALOG_NAME, SCHEMA_NAME_FILESET,
FILESET_NAME);
- // 2. click fileset catalog tree node
+ @Order(23)
+ public void testCreateFilesetSchema() throws InterruptedException {
+ // 1. click fileset catalog tree node
String filesetCatalogNode =
String.format(
"{{%s}}{{%s}}{{%s}}", METALAKE_NAME, FILESET_CATALOG_NAME,
CATALOG_TYPE_FILESET);
catalogsPage.clickTreeNode(filesetCatalogNode);
+ // 2. click create schema button
+ clickAndWait(catalogsPage.createSchemaBtn);
+ catalogsPage.setSchemaNameField(SCHEMA_NAME_FILESET);
+ catalogsPage.setCatalogCommentField("fileset schema comment");
+ clickAndWait(catalogsPage.handleSubmitSchemaBtn);
// 3. verify show table title、 schema name and tree node
Assertions.assertTrue(catalogsPage.verifyShowTableTitle(CATALOG_TABLE_TITLE));
Assertions.assertTrue(catalogsPage.verifyShowDataItemInList(SCHEMA_NAME_FILESET,
false));
@@ -634,16 +623,30 @@ public class CatalogsPageTest extends BaseWebIT {
FILESET_CATALOG_NAME,
SCHEMA_NAME_FILESET);
Assertions.assertTrue(catalogsPage.verifyTreeNodes(treeNodes));
- // 4. click schema tree node
+ }
+
+ @Test
+ @Order(24)
+ public void testCreateFileset() throws InterruptedException {
+ // 1. click schema tree node
String filesetSchemaNode =
String.format(
"{{%s}}{{%s}}{{%s}}{{%s}}",
METALAKE_NAME, FILESET_CATALOG_NAME, CATALOG_TYPE_FILESET,
SCHEMA_NAME_FILESET);
catalogsPage.clickTreeNode(filesetSchemaNode);
- // 5. verify show table title、 fileset name and tree node
+ // 2. create fileset
+ clickAndWait(catalogsPage.createFilesetBtn);
+ catalogsPage.setFilesetNameField(FILESET_NAME);
+ String storageLocation = storageLocation(SCHEMA_NAME_FILESET,
FILESET_NAME);
+ catalogsPage.setFilesetStorageLocationField(storageLocation);
+ catalogsPage.setFilesetCommentField("fileset comment");
+ catalogsPage.addFilesetPropsBtn.click();
+ catalogsPage.setPropsAt(0, PROPERTIES_KEY1, PROPERTIES_VALUE1);
+ clickAndWait(catalogsPage.handleSubmitFilesetBtn);
+ // 3. verify show table title、 fileset name and tree node
Assertions.assertTrue(catalogsPage.verifyShowTableTitle(SCHEMA_FILESET_TITLE));
Assertions.assertTrue(catalogsPage.verifyShowDataItemInList(FILESET_NAME,
false));
- treeNodes =
+ List<String> treeNodes =
Arrays.asList(
MODIFIED_HIVE_CATALOG_NAME,
ICEBERG_CATALOG_NAME,
@@ -653,7 +656,7 @@ public class CatalogsPageTest extends BaseWebIT {
SCHEMA_NAME_FILESET,
FILESET_NAME);
Assertions.assertTrue(catalogsPage.verifyTreeNodes(treeNodes));
- // 6. click fileset tree node
+ // 4. click fileset tree node
String filesetNode =
String.format(
"{{%s}}{{%s}}{{%s}}{{%s}}{{%s}}",
@@ -663,7 +666,7 @@ public class CatalogsPageTest extends BaseWebIT {
SCHEMA_NAME_FILESET,
FILESET_NAME);
catalogsPage.clickTreeNode(filesetNode);
- // 7. verify show tab details
+ // 5. verify show tab details
Assertions.assertTrue(catalogsPage.verifyShowDetailsContent());
Assertions.assertTrue(
catalogsPage.verifyShowPropertiesItemInList(
@@ -674,7 +677,7 @@ public class CatalogsPageTest extends BaseWebIT {
}
@Test
- @Order(22)
+ @Order(25)
public void testBackHomePage() throws InterruptedException {
clickAndWait(catalogsPage.backHomeBtn);
Assertions.assertTrue(catalogsPage.verifyBackHomePage());
diff --git
a/web/integration-test/src/test/java/org/apache/gravitino/integration/test/web/ui/pages/CatalogsPage.java
b/web/integration-test/src/test/java/org/apache/gravitino/integration/test/web/ui/pages/CatalogsPage.java
index 43a2dd5ba..1bd210447 100644
---
a/web/integration-test/src/test/java/org/apache/gravitino/integration/test/web/ui/pages/CatalogsPage.java
+++
b/web/integration-test/src/test/java/org/apache/gravitino/integration/test/web/ui/pages/CatalogsPage.java
@@ -62,6 +62,60 @@ public class CatalogsPage extends BaseWebIT {
@FindBy(xpath = "//*[@data-refer='handle-submit-catalog']")
public WebElement handleSubmitCatalogBtn;
+ @FindBy(xpath = "//*[@data-refer='create-schema-btn']")
+ public WebElement createSchemaBtn;
+
+ @FindBy(xpath = "//*[@data-refer='schema-name-field']")
+ public WebElement schemaNameField;
+
+ @FindBy(xpath = "//*[@data-refer='schema-comment-field']")
+ public WebElement schemaCommentField;
+
+ @FindBy(xpath = "//*[@data-refer='handle-submit-schema']")
+ public WebElement handleSubmitSchemaBtn;
+
+ @FindBy(xpath = "//*[@data-refer='create-fileset-btn']")
+ public WebElement createFilesetBtn;
+
+ @FindBy(xpath = "//*[@data-refer='fileset-name-field']")
+ public WebElement filesetNameField;
+
+ @FindBy(xpath = "//*[@data-refer='fileset-storageLocation-field']")
+ public WebElement filesetStorageLocationField;
+
+ @FindBy(xpath = "//*[@data-refer='fileset-comment-field']")
+ public WebElement filesetCommentField;
+
+ @FindBy(xpath = "//button[@data-refer='add-fileset-props']")
+ public WebElement addFilesetPropsBtn;
+
+ @FindBy(xpath = "//*[@data-refer='handle-submit-fileset']")
+ public WebElement handleSubmitFilesetBtn;
+
+ @FindBy(xpath = "//*[@data-refer='create-topic-btn']")
+ public WebElement createTopicBtn;
+
+ @FindBy(xpath = "//*[@data-refer='topic-name-field']")
+ public WebElement topicNameField;
+
+ @FindBy(xpath = "//*[@data-refer='topic-comment-field']")
+ public WebElement topicCommentField;
+
+ @FindBy(xpath = "//*[@data-refer='handle-submit-topic']")
+ public WebElement handleSubmitTopicBtn;
+
+ @FindBy(xpath = "//*[@data-refer='create-table-btn']")
+ public WebElement createTableBtn;
+
+ @FindBy(xpath = "//*[@data-refer='table-name-field']")
+ public WebElement tableNameField;
+
+ @FindBy(xpath = "//*[@data-refer='table-comment-field']")
+ public WebElement tableCommentField;
+
+ @FindBy(xpath = "//*[@data-refer='handle-submit-table']")
+ public WebElement handleSubmitTableBtn;
+
@FindBy(xpath = "//div[@data-refer='tree-view']")
public WebElement treeView;
@@ -144,14 +198,13 @@ public class CatalogsPage extends BaseWebIT {
}
}
- public void setCatalogCommentField(String nameField) {
+ public void setCatalogCommentField(String commentField) {
try {
- WebElement metalakeCommentFieldInput =
- catalogCommentField.findElement(By.tagName("textarea"));
- metalakeCommentFieldInput.sendKeys(
+ WebElement catalogCommentFieldInput =
catalogCommentField.findElement(By.tagName("textarea"));
+ catalogCommentFieldInput.sendKeys(
Keys.chord(Keys.HOME, Keys.chord(Keys.SHIFT, Keys.END),
Keys.DELETE));
- metalakeCommentFieldInput.clear();
- metalakeCommentFieldInput.sendKeys(nameField);
+ catalogCommentFieldInput.clear();
+ catalogCommentFieldInput.sendKeys(commentField);
} catch (Exception e) {
LOG.error(e.getMessage(), e);
}
@@ -169,7 +222,7 @@ public class CatalogsPage extends BaseWebIT {
}
// set the indexed catalog properties
- public void setCatalogPropsAt(int index, String key, String value) {
+ public void setPropsAt(int index, String key, String value) {
try {
// Set the indexed props key
String keyPath = "//div[@data-refer='props-key-" + index +
"']//input[@name='key']";
@@ -217,7 +270,7 @@ public class CatalogsPage extends BaseWebIT {
}
}
- public void clickDeleteCatalogBtn(String name) {
+ public void clickDeleteBtn(String name) {
try {
String xpath = "//button[@data-refer='delete-entity-" + name + "']";
WebElement btn = driver.findElement(By.xpath(xpath));
@@ -229,6 +282,135 @@ public class CatalogsPage extends BaseWebIT {
}
}
+ public void setSchemaNameField(String nameField) {
+ try {
+ WebElement schemaNameFieldInput =
schemaNameField.findElement(By.tagName("input"));
+ schemaNameFieldInput.sendKeys(
+ Keys.chord(Keys.HOME, Keys.chord(Keys.SHIFT, Keys.END),
Keys.DELETE));
+ schemaNameFieldInput.clear();
+ schemaNameFieldInput.sendKeys(nameField);
+ } catch (Exception e) {
+ LOG.error(e.getMessage(), e);
+ }
+ }
+
+ public void setSchemaCommentField(String nameField) {
+ try {
+ WebElement schemaCommentFieldInput =
schemaCommentField.findElement(By.tagName("textarea"));
+ schemaCommentFieldInput.sendKeys(
+ Keys.chord(Keys.HOME, Keys.chord(Keys.SHIFT, Keys.END),
Keys.DELETE));
+ schemaCommentFieldInput.clear();
+ schemaCommentFieldInput.sendKeys(nameField);
+ } catch (Exception e) {
+ LOG.error(e.getMessage(), e);
+ }
+ }
+
+ public void setFilesetNameField(String nameField) {
+ try {
+ WebElement filesetNameFieldInput =
filesetNameField.findElement(By.tagName("input"));
+ filesetNameFieldInput.sendKeys(
+ Keys.chord(Keys.HOME, Keys.chord(Keys.SHIFT, Keys.END),
Keys.DELETE));
+ filesetNameFieldInput.clear();
+ filesetNameFieldInput.sendKeys(nameField);
+ } catch (Exception e) {
+ LOG.error(e.getMessage(), e);
+ }
+ }
+
+ public void setFilesetStorageLocationField(String storageLocation) {
+ try {
+ WebElement filesetStorageLocationFieldInput =
+ filesetStorageLocationField.findElement(By.tagName("input"));
+ filesetStorageLocationFieldInput.sendKeys(
+ Keys.chord(Keys.HOME, Keys.chord(Keys.SHIFT, Keys.END),
Keys.DELETE));
+ filesetStorageLocationFieldInput.clear();
+ filesetStorageLocationFieldInput.sendKeys(storageLocation);
+ } catch (Exception e) {
+ LOG.error(e.getMessage(), e);
+ }
+ }
+
+ public void setFilesetCommentField(String commentField) {
+ try {
+ WebElement filesetCommentFieldInput =
filesetCommentField.findElement(By.tagName("textarea"));
+ filesetCommentFieldInput.sendKeys(
+ Keys.chord(Keys.HOME, Keys.chord(Keys.SHIFT, Keys.END),
Keys.DELETE));
+ filesetCommentFieldInput.clear();
+ filesetCommentFieldInput.sendKeys(commentField);
+ } catch (Exception e) {
+ LOG.error(e.getMessage(), e);
+ }
+ }
+
+ public void setTopicNameField(String nameField) {
+ try {
+ WebElement topicNameFieldInput =
topicNameField.findElement(By.tagName("input"));
+ topicNameFieldInput.sendKeys(
+ Keys.chord(Keys.HOME, Keys.chord(Keys.SHIFT, Keys.END),
Keys.DELETE));
+ topicNameFieldInput.clear();
+ topicNameFieldInput.sendKeys(nameField);
+ } catch (Exception e) {
+ LOG.error(e.getMessage(), e);
+ }
+ }
+
+ public void setTopicCommentField(String commentField) {
+ try {
+ WebElement topicCommentFieldInput =
topicCommentField.findElement(By.tagName("textarea"));
+ topicCommentFieldInput.sendKeys(
+ Keys.chord(Keys.HOME, Keys.chord(Keys.SHIFT, Keys.END),
Keys.DELETE));
+ topicCommentFieldInput.clear();
+ topicCommentFieldInput.sendKeys(commentField);
+ } catch (Exception e) {
+ LOG.error(e.getMessage(), e);
+ }
+ }
+
+ public void setTableNameField(String nameField) {
+ try {
+ WebElement tableNameFieldInput =
tableNameField.findElement(By.tagName("input"));
+ tableNameFieldInput.sendKeys(
+ Keys.chord(Keys.HOME, Keys.chord(Keys.SHIFT, Keys.END),
Keys.DELETE));
+ tableNameFieldInput.clear();
+ tableNameFieldInput.sendKeys(nameField);
+ } catch (Exception e) {
+ LOG.error(e.getMessage(), e);
+ }
+ }
+
+ public void setTableCommentField(String commentField) {
+ try {
+ WebElement tableCommentFieldInput =
tableCommentField.findElement(By.tagName("textarea"));
+ tableCommentFieldInput.sendKeys(
+ Keys.chord(Keys.HOME, Keys.chord(Keys.SHIFT, Keys.END),
Keys.DELETE));
+ tableCommentFieldInput.clear();
+ tableCommentFieldInput.sendKeys(commentField);
+ } catch (Exception e) {
+ LOG.error(e.getMessage(), e);
+ }
+ }
+
+ // set the indexed table columns
+ public void setTableColumnsAt(int index, String name, String type) {
+ try {
+ // Set the indexed column name
+ String columnName = "//div[@data-refer='column-name-" + index +
"']//input";
+ WebElement keyInput = driver.findElement(By.xpath(columnName));
+ keyInput.sendKeys(name);
+ // Set the indexed column type
+ String columnType = "//div[@data-refer='column-type-" + index + "']";
+ WebElement typeSelect = driver.findElement(By.xpath(columnType));
+ clickAndWait(typeSelect);
+ WebElement typeList =
+
driver.findElement(By.xpath("//ul[@aria-labelledby='select-column-type']"));
+ WebElement typeItem =
typeList.findElement(By.xpath(".//li[@data-value='" + type + "']"));
+ clickAndWait(typeItem);
+ } catch (Exception e) {
+ LOG.error(e.getMessage(), e);
+ }
+ }
+
public void clickMetalakeLink(String metalakeName) {
try {
String xpath = "//a[@href='?metalake=" + metalakeName + "']";
@@ -550,6 +732,32 @@ public class CatalogsPage extends BaseWebIT {
}
}
+ public boolean verifyNoDataItemInList(String itemName, Boolean
isColumnLevel) {
+ try {
+ Thread.sleep(ACTION_SLEEP_MILLIS);
+ String xpath =
+ "//div[@data-refer='table-grid']//div[contains(@class,
'MuiDataGrid-main')]/div[contains(@class,
'MuiDataGrid-virtualScroller')]/div/div[@role='rowgroup']//div[@data-field='name']";
+ if (isColumnLevel) {
+ xpath = xpath + "//p";
+ }
+ List<WebElement> list = driver.findElements(By.xpath(xpath));
+ List<String> texts = new ArrayList<>();
+ for (WebElement element : list) {
+ texts.add(element.getText());
+ }
+
+ if (texts.contains(itemName)) {
+ LOG.error("table list: {} does not include itemName: {}", texts,
itemName);
+ return false;
+ }
+
+ return true;
+ } catch (Exception e) {
+ LOG.error(e.getMessage(), e);
+ return false;
+ }
+ }
+
public boolean verifyTableColumns() {
try {
List<String> columns = Arrays.asList("Name", "Type", "Nullable",
"AutoIncrement", "Comment");
diff --git
a/web/web/src/app/metalakes/metalake/rightContent/CreateTableDialog.js
b/web/web/src/app/metalakes/metalake/rightContent/CreateTableDialog.js
index a1c337725..ccb053117 100644
--- a/web/web/src/app/metalakes/metalake/rightContent/CreateTableDialog.js
+++ b/web/web/src/app/metalakes/metalake/rightContent/CreateTableDialog.js
@@ -596,6 +596,7 @@ const CreateTableDialog = props => {
handleColumnChange({ index, field:
'type', value: e.target.value })
}
error={!column.type.trim() ||
column.paramErrors}
+ labelId='select-column-type'
data-refer={`column-type-${index}`}
renderValue={selected =>
<Box>{`${selected}${column.typeSuffix || ''}`}</Box>}
>
diff --git a/web/web/src/app/metalakes/metalake/rightContent/RightContent.js
b/web/web/src/app/metalakes/metalake/rightContent/RightContent.js
index 8e061f97a..54b248297 100644
--- a/web/web/src/app/metalakes/metalake/rightContent/RightContent.js
+++ b/web/web/src/app/metalakes/metalake/rightContent/RightContent.js
@@ -164,7 +164,7 @@ const RightContent = () => {
startIcon={<Icon icon='mdi:plus-box' />}
onClick={handleCreateFileset}
sx={{ width: 200 }}
- data-refer='create-schema-btn'
+ data-refer='create-fileset-btn'
>
Create Fileset
</Button>