This is an automated email from the ASF dual-hosted git repository.

benjobs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git


The following commit(s) were added to refs/heads/dev by this push:
     new ec38a12af [ISSUE-3830][Feature] Introduce upload management e2e test 
(#3845)
ec38a12af is described below

commit ec38a12af868c971034524ef836570d65fd8f31f
Author: Zhengke Zhou <[email protected]>
AuthorDate: Fri Jul 12 13:27:12 2024 +0800

    [ISSUE-3830][Feature] Introduce upload management e2e test (#3845)
    
    * Introduce resource management e2e test
    
    * fix code format
    
    * engine type dropdown list can't be clicked
    
    * Improve uploads and variables page test case
---
 .github/workflows/e2e.yml                          |  10 +-
 .../streampark/e2e/cases/UploadManagementTest.java | 147 +++++++++++++++
 .../e2e/cases/VariableManagementTest.java          |  34 ++--
 .../e2e/pages/resource/ResourcePage.java           |  26 ++-
 .../streampark/e2e/pages/resource/UploadsPage.java | 205 +++++++++++++++++++++
 ...iableManagementPage.java => VariablesPage.java} |  15 +-
 6 files changed, 401 insertions(+), 36 deletions(-)

diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
index 359026edd..f908b05d5 100644
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -110,18 +110,20 @@ jobs:
     strategy:
       matrix:
         case:
-          - name: MemberManagementTest
-            class: org.apache.streampark.e2e.cases.MemberManagementTest
+          - name: UploadManagementTest
+            class: org.apache.streampark.e2e.cases.UploadManagementTest
           - name: ProjectsManagementTest
             class: org.apache.streampark.e2e.cases.ProjectsManagementTest
           - name: VariableManagementTest
             class: org.apache.streampark.e2e.cases.VariableManagementTest
-          - name: RoleManagementTest
-            class: org.apache.streampark.e2e.cases.RoleManagementTest
           - name: UserManagementTest
             class: org.apache.streampark.e2e.cases.UserManagementTest
+          - name: RoleManagementTest
+            class: org.apache.streampark.e2e.cases.RoleManagementTest
           - name: TeamManagementTest
             class: org.apache.streampark.e2e.cases.TeamManagementTest
+          - name: MemberManagementTest
+            class: org.apache.streampark.e2e.cases.MemberManagementTest
           - name: ApplicationsFlink116OnYarnWithFlinkSQLTest
             class: 
org.apache.streampark.e2e.cases.ApplicationsFlink116OnYarnWithFlinkSQLTest
           - name: ApplicationsFlink117OnYarnWithFlinkSQLTest
diff --git 
a/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/cases/UploadManagementTest.java
 
b/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/cases/UploadManagementTest.java
new file mode 100644
index 000000000..9fa8577b9
--- /dev/null
+++ 
b/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/cases/UploadManagementTest.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.streampark.e2e.cases;
+
+import org.apache.streampark.e2e.core.StreamPark;
+import org.apache.streampark.e2e.pages.LoginPage;
+import org.apache.streampark.e2e.pages.resource.ResourcePage;
+import org.apache.streampark.e2e.pages.resource.UploadsPage;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.remote.RemoteWebDriver;
+import org.testcontainers.shaded.org.awaitility.Awaitility;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+@StreamPark(composeFiles = "docker/basic/docker-compose.yaml")
+public class UploadManagementTest {
+
+    private static RemoteWebDriver browser;
+
+    private static final String userName = "admin";
+
+    private static final String password = "streampark";
+
+    private static final String teamName = "default";
+
+    private static final String engineType = "Apache Flink";
+
+    private static final String resourceType = "Jar Library";
+
+    private static final String resourceName = "test-resource";
+
+    private static final String mavenPom =
+        "<dependency>\n" +
+            "    <groupId>junit</groupId>\n" +
+            "    <artifactId>junit</artifactId>\n" +
+            "    <version>4.13.2</version>\n" +
+            "    <scope>test</scope>\n" +
+            "</dependency>";
+
+    private static final String description = "Junit-jar-lib";
+
+    @BeforeAll
+    public static void setup() {
+        new LoginPage(browser)
+            .login(userName, password, teamName)
+            .goToNav(ResourcePage.class)
+            .goToTab(UploadsPage.class);
+    }
+
+    @Test
+    @Order(10)
+    void testCreateUpload() {
+        final UploadsPage uploadsPage = new UploadsPage(browser);
+        uploadsPage.createUpload(engineType, resourceType, resourceName, 
mavenPom, description);
+
+        Awaitility.await()
+            .untilAsserted(
+                () -> assertThat(uploadsPage.resourceList())
+                    .as("Resource list should contain newly-created resource")
+                    .extracting(WebElement::getText)
+                    .anyMatch(it -> it.contains(resourceName))
+                    .anyMatch(it -> it.contains(description))
+                    .anyMatch(it -> it.contains(resourceType))
+                    .anyMatch(it -> it.contains(engineType)));
+    }
+
+    @Test
+    @Order(20)
+    void testCreateDuplicateUpload() {
+        final UploadsPage uploadsPage = new UploadsPage(browser);
+        browser.navigate().refresh();
+        uploadsPage.createUpload(engineType, resourceType, resourceName, 
mavenPom, description);
+
+        Awaitility.await()
+            .untilAsserted(
+                () -> assertThat(uploadsPage.errorMessageList())
+                    .as("Resource Name Duplicated Error message should be 
displayed")
+                    .extracting(WebElement::getText)
+                    .anyMatch(it -> it.contains(
+                        String.format("the resource %s already exists, please 
check.", resourceName))));
+
+        uploadsPage.errorMessageConfirmButton().click();
+        uploadsPage.createUploadForm().buttonCancel().click();
+    }
+
+    @Test
+    @Order(30)
+    void testEditUpload() {
+        final UploadsPage uploadsPage = new UploadsPage(browser);
+        browser.navigate().refresh();
+
+        String editDescription = "Kafka-jar-lib";
+        String editResource =
+            "<dependency>\n" +
+                "   <groupId>org.apache.kafka</groupId>\n" +
+                "   <artifactId>kafka-clients</artifactId>\n" +
+                "   <version>3.7.1</version>\n" +
+                "</dependency>";
+
+        uploadsPage.editUpload(engineType, resourceType, resourceName, 
editResource,
+            editDescription);
+
+        Awaitility.await()
+            .untilAsserted(
+                () -> assertThat(uploadsPage.resourceList())
+                    .as("Resource list should contain edit resource")
+                    .extracting(WebElement::getText)
+                    .anyMatch(it -> it.contains(resourceName))
+                    .anyMatch(it -> it.contains(editDescription))
+                    .anyMatch(it -> it.contains(resourceType))
+                    .anyMatch(it -> it.contains(engineType)));
+    }
+
+    @Test
+    @Order(40)
+    void testDeleteUpload() {
+        final UploadsPage uploadsPage = new UploadsPage(browser);
+        uploadsPage.deleteUpload(resourceName);
+        Awaitility.await()
+            .untilAsserted(
+                () -> {
+                    browser.navigate().refresh();
+
+                    assertThat(uploadsPage.resourceList())
+                        .noneMatch(it -> it.getText().contains(resourceName));
+                });
+    }
+}
diff --git 
a/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/cases/VariableManagementTest.java
 
b/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/cases/VariableManagementTest.java
index c6e0ee787..c9738c008 100644
--- 
a/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/cases/VariableManagementTest.java
+++ 
b/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/cases/VariableManagementTest.java
@@ -20,7 +20,7 @@ package org.apache.streampark.e2e.cases;
 import org.apache.streampark.e2e.core.StreamPark;
 import org.apache.streampark.e2e.pages.LoginPage;
 import org.apache.streampark.e2e.pages.resource.ResourcePage;
-import org.apache.streampark.e2e.pages.resource.VariableManagementPage;
+import org.apache.streampark.e2e.pages.resource.VariablesPage;
 
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Order;
@@ -55,18 +55,18 @@ public class VariableManagementTest {
         new LoginPage(browser)
             .login(userName, password, teamName)
             .goToNav(ResourcePage.class)
-            .goToTab(VariableManagementPage.class);
+            .goToTab(VariablesPage.class);
     }
 
     @Test
     @Order(10)
     void testCreateVariable() {
-        final VariableManagementPage variableManagementPage = new 
VariableManagementPage(browser);
-        variableManagementPage.createVariable(variableCode, variableValue, 
description, isNotVisible);
+        final VariablesPage variablesPage = new VariablesPage(browser);
+        variablesPage.createVariable(variableCode, variableValue, description, 
isNotVisible);
 
         Awaitility.await()
             .untilAsserted(
-                () -> assertThat(variableManagementPage.variableList())
+                () -> assertThat(variablesPage.variableList())
                     .as("Variable list should contain newly-created variable")
                     .extracting(WebElement::getText)
                     .anyMatch(it -> it.contains(variableCode)));
@@ -75,32 +75,32 @@ public class VariableManagementTest {
     @Test
     @Order(20)
     void testCreateDuplicateVariable() {
-        final VariableManagementPage variableManagementPage = new 
VariableManagementPage(browser);
-        variableManagementPage.createVariable(variableCode, variableValue, 
description, isNotVisible);
+        final VariablesPage variablesPage = new VariablesPage(browser);
+        variablesPage.createVariable(variableCode, variableValue, description, 
isNotVisible);
 
         Awaitility.await()
             .untilAsserted(
-                () -> assertThat(variableManagementPage.errorMessageList())
+                () -> assertThat(variablesPage.errorMessageList())
                     .as("Variable Code Duplicated Error message should be 
displayed")
                     .extracting(WebElement::getText)
                     .anyMatch(it -> it.contains(
                         "The variable code already exists.")));
 
-        variableManagementPage.errorMessageConfirmButton().click();
-        variableManagementPage.createVariableForm().buttonCancel().click();
+        variablesPage.errorMessageConfirmButton().click();
+        variablesPage.createVariableForm().buttonCancel().click();
     }
 
     @Test
     @Order(30)
     void testEditVariable() {
-        final VariableManagementPage variableManagementPage = new 
VariableManagementPage(browser);
+        final VariablesPage variablesPage = new VariablesPage(browser);
         String editVariableValue = "6379";
         String editDescription = "Redis default port";
 
-        variableManagementPage.editVariable(variableCode, editVariableValue, 
editDescription, isNotVisible);
+        variablesPage.editVariable(variableCode, editVariableValue, 
editDescription, isNotVisible);
         Awaitility.await()
             .untilAsserted(
-                () -> assertThat(variableManagementPage.variableList())
+                () -> assertThat(variablesPage.variableList())
                     .as("Variable list should contain edited variable")
                     .extracting(WebElement::getText)
                     .anyMatch(it -> it.contains(editVariableValue))
@@ -109,14 +109,14 @@ public class VariableManagementTest {
 
     @Test
     @Order(40)
-    void testDeleteTeam() {
-        final VariableManagementPage variableManagementPage = new 
VariableManagementPage(browser);
+    void testDeleteVariable() {
+        final VariablesPage variablesPage = new VariablesPage(browser);
 
-        variableManagementPage.deleteVariable(variableCode);
+        variablesPage.deleteVariable(variableCode);
 
         Awaitility.await()
             .untilAsserted(
-                () -> assertThat(variableManagementPage.variableList())
+                () -> assertThat(variablesPage.variableList())
                     .extracting(WebElement::getText)
                     .noneMatch(it -> it.contains(variableCode)));
     }
diff --git 
a/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/ResourcePage.java
 
b/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/ResourcePage.java
index ac0f784da..9c7b7985c 100644
--- 
a/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/ResourcePage.java
+++ 
b/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/ResourcePage.java
@@ -33,30 +33,40 @@ import java.time.Duration;
 public final class ResourcePage extends NavBarPage implements NavBarItem {
 
     @FindBy(xpath = "//span[contains(@class, 
'streampark-simple-menu-sub-title') and contains(text(), 'Variables')]//..")
-    private WebElement resourceVariableManagement;
+    private WebElement menuVariables;
 
     @FindBy(xpath = "//span[contains(@class, 
'streampark-simple-menu-sub-title') and contains(text(), 'Projects')]//..")
-    private WebElement resourceProjectsManagement;
+    private WebElement menuProjects;
+
+    @FindBy(xpath = "//span[contains(@class, 
'streampark-simple-menu-sub-title') and contains(text(), 'Uploads')]//..")
+    private WebElement menuUploads;
 
     public ResourcePage(RemoteWebDriver driver) {
         super(driver);
     }
 
     public <T extends ResourcePage.Tab> T goToTab(Class<T> tab) {
-        if (tab == VariableManagementPage.class) {
+        if (tab == VariablesPage.class) {
             new WebDriverWait(driver, Duration.ofSeconds(10))
-                
.until(ExpectedConditions.elementToBeClickable(resourceVariableManagement));
-            resourceVariableManagement.click();
-            return tab.cast(new VariableManagementPage(driver));
+                .until(ExpectedConditions.elementToBeClickable(menuVariables));
+            menuVariables.click();
+            return tab.cast(new VariablesPage(driver));
         }
 
         if (tab == ProjectsPage.class) {
             new WebDriverWait(driver, Duration.ofSeconds(10))
-                
.until(ExpectedConditions.elementToBeClickable(resourceProjectsManagement));
-            resourceProjectsManagement.click();
+                .until(ExpectedConditions.elementToBeClickable(menuProjects));
+            menuProjects.click();
             return tab.cast(new ProjectsPage(driver));
         }
 
+        if (tab == UploadsPage.class) {
+            new WebDriverWait(driver, Duration.ofSeconds(10))
+                .until(ExpectedConditions.elementToBeClickable(menuUploads));
+            menuUploads.click();
+            return tab.cast(new UploadsPage(driver));
+        }
+
         throw new UnsupportedOperationException("Unknown tab: " + 
tab.getName());
     }
 
diff --git 
a/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/UploadsPage.java
 
b/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/UploadsPage.java
new file mode 100644
index 000000000..0cfb009c8
--- /dev/null
+++ 
b/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/UploadsPage.java
@@ -0,0 +1,205 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.streampark.e2e.pages.resource;
+
+import org.apache.streampark.e2e.pages.common.NavBarPage;
+
+import lombok.Getter;
+import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.remote.RemoteWebDriver;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.PageFactory;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import java.time.Duration;
+import java.util.List;
+
+@Getter
+public class UploadsPage extends NavBarPage implements ResourcePage.Tab {
+
+    @FindBy(xpath = "//span[contains(., 'Resource 
List')]/..//button[contains(@class, 'ant-btn-primary')]/span[contains(text(), 
'Add New')]")
+    private WebElement buttonCreateResource;
+
+    private final CreateUploadForm createUploadForm = new CreateUploadForm();
+
+    @FindBy(xpath = "//tbody[contains(@class, 'ant-table-tbody')]")
+    private List<WebElement> resourceList;
+
+    @FindBy(className = "swal2-html-container")
+    private List<WebElement> errorMessageList;
+
+    @FindBy(xpath = "//button[contains(text(), 'OK')]")
+    private WebElement errorMessageConfirmButton;
+
+    @FindBy(xpath = "//button[contains(@class, 'ant-btn')]/span[contains(., 
'OK')]")
+    private WebElement deleteConfirmButton;
+
+    public UploadsPage(RemoteWebDriver driver) {
+        super(driver);
+    }
+
+    public UploadsPage createUpload(String engineType, String resourceType, 
String resourceName,
+                                    String resource,
+                                    String description) {
+        waitForPageLoading();
+
+        new WebDriverWait(driver, Duration.ofSeconds(10))
+            
.until(ExpectedConditions.elementToBeClickable(buttonCreateResource));
+        buttonCreateResource.click();
+
+        // select engine type.
+        createUploadForm.btnSelectEngineTypeDropDown().click();
+        new WebDriverWait(driver, Duration.ofSeconds(10))
+            
.until(ExpectedConditions.visibilityOfAllElements(createUploadForm.selectEngineType()));
+        createUploadForm.selectEngineType().stream()
+            .filter(e -> e.getText().equals(engineType))
+            .findFirst()
+            .orElseThrow(
+                () -> new RuntimeException(
+                    String.format("No %s in engineType dropdown list", 
engineType)))
+            .click();
+
+        // select resource type.
+        createUploadForm.btnSelectResourceTypeDropDown().click();
+        new WebDriverWait(driver, Duration.ofSeconds(10))
+            
.until(ExpectedConditions.visibilityOfAllElements(createUploadForm.selectResourceType()));
+        createUploadForm.selectResourceType().stream()
+            .filter(e -> e.getText().equals(resourceType))
+            .findFirst()
+            .orElseThrow(
+                () -> new RuntimeException(
+                    String.format("No %s in resourceType dropdown list", 
resourceType)))
+            .click();
+
+        createUploadForm.inputResourceName().sendKeys(resourceName);
+        createUploadForm.textPom().sendKeys(resource);
+        createUploadForm.inputDescription().sendKeys(description);
+
+        createUploadForm.buttonSubmit().click();
+        return this;
+    }
+
+    public UploadsPage editUpload(String engineType, String resourceType, 
String resourceName,
+                                  String resource, String description) {
+        waitForPageLoading();
+
+        resourceList.stream()
+            .filter(e -> e.getText().contains(resourceName))
+            .flatMap(
+                it -> 
it.findElements(By.xpath("//button[contains(@tooltip,'Modify 
Resource')]")).stream())
+            .filter(WebElement::isDisplayed)
+            .findFirst()
+            .orElseThrow(() -> new RuntimeException("No edit button in 
resource list"))
+            .click();
+
+        // select engine type.
+        createUploadForm.btnSelectEngineTypeDropDown().click();
+        new WebDriverWait(driver, Duration.ofSeconds(10))
+            
.until(ExpectedConditions.visibilityOfAllElements(createUploadForm.selectEngineType()));
+        createUploadForm.selectResourceType.stream()
+            .filter(e -> e.getText().equals(engineType))
+            .findFirst()
+            .orElseThrow(
+                () -> new RuntimeException(
+                    String.format("No %s in resourceType dropdown list", 
resourceType)))
+            .click();
+
+        // select resource type.
+        createUploadForm.btnSelectResourceTypeDropDown().click();
+        new WebDriverWait(driver, Duration.ofSeconds(10))
+            
.until(ExpectedConditions.visibilityOfAllElements(createUploadForm.selectResourceType()));
+        createUploadForm.selectResourceType().stream()
+            .filter(e -> e.getText().equals(resourceType))
+            .findFirst()
+            .orElseThrow(
+                () -> new RuntimeException(
+                    String.format("No %s in resourceType dropdown list", 
resourceType)))
+            .click();
+
+        createUploadForm.textPom().sendKeys(Keys.chord(Keys.CONTROL, "a"), 
Keys.DELETE);
+        createUploadForm.textPom().sendKeys(resource);
+        createUploadForm.inputDescription().clear();
+        createUploadForm.inputDescription().sendKeys(description);
+
+        createUploadForm.buttonSubmit().click();
+        return this;
+    }
+
+    public UploadsPage deleteUpload(String resourceName) {
+        waitForPageLoading();
+
+        resourceList.stream()
+            .filter(e -> e.getText().contains(resourceName))
+            .flatMap(
+                it -> 
it.findElements(By.xpath("//button[contains(@tooltip,'Delete 
Resource')]")).stream())
+            .filter(WebElement::isDisplayed)
+            .findFirst()
+            .orElseThrow(() -> new RuntimeException("No delete button in 
resource list"))
+            .click();
+
+        new WebDriverWait(driver, Duration.ofSeconds(10))
+            
.until(ExpectedConditions.elementToBeClickable(deleteConfirmButton));
+
+        deleteConfirmButton.click();
+
+        return this;
+    }
+
+    private void waitForPageLoading() {
+        new WebDriverWait(driver, Duration.ofSeconds(10))
+            .until(ExpectedConditions.urlContains("/resource/upload"));
+    }
+
+    @Getter
+    public class CreateUploadForm {
+
+        CreateUploadForm() {
+            PageFactory.initElements(driver, this);
+        }
+
+        @FindBy(xpath = 
"//*[@id='form_item_engineType']/ancestor::div[contains(@class, 
'ant-select-selector')]")
+        private WebElement btnSelectEngineTypeDropDown;
+
+        @FindBy(xpath = 
"//*[@id='form_item_engineType']//following::div[@class='ant-select-item-option-content']")
+        private List<WebElement> selectEngineType;
+
+        @FindBy(xpath = 
"//*[@id='form_item_resourceType']/ancestor::div[contains(@class, 
'ant-select-selector')]")
+        private WebElement btnSelectResourceTypeDropDown;
+
+        @FindBy(xpath = 
"//*[@id='form_item_resourceType']//following::div[@class='ant-select-item-option-content']")
+        private List<WebElement> selectResourceType;
+
+        @FindBy(id = "ResourceForm_resourceName")
+        private WebElement inputResourceName;
+
+        @FindBy(css = "textarea.inputarea.monaco-mouse-cursor-text")
+        private WebElement textPom;
+
+        @FindBy(id = "ResourceForm_description")
+        private WebElement inputDescription;
+
+        @FindBy(xpath = "//button[contains(@class, 
'ant-btn')]//span[contains(text(), 'Submit')]")
+        private WebElement buttonSubmit;
+
+        @FindBy(xpath = "//button[contains(@class, 
'ant-btn')]//span[contains(text(), 'Cancel')]")
+        private WebElement buttonCancel;
+    }
+}
diff --git 
a/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/VariableManagementPage.java
 
b/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/VariablesPage.java
similarity index 90%
rename from 
streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/VariableManagementPage.java
rename to 
streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/VariablesPage.java
index 59a712ba2..3d0a78d08 100644
--- 
a/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/VariableManagementPage.java
+++ 
b/streampark-e2e/streampark-e2e-case/src/test/java/org/apache/streampark/e2e/pages/resource/VariablesPage.java
@@ -32,7 +32,7 @@ import java.time.Duration;
 import java.util.List;
 
 @Getter
-public class VariableManagementPage extends NavBarPage implements 
ResourcePage.Tab {
+public class VariablesPage extends NavBarPage implements ResourcePage.Tab {
 
     @FindBy(xpath = "//span[contains(., 'Variable 
List')]/..//button[contains(@class, 'ant-btn-primary')]/span[contains(text(), 
'Add New')]")
     private WebElement buttonCreateVariable;
@@ -51,12 +51,12 @@ public class VariableManagementPage extends NavBarPage 
implements ResourcePage.T
 
     private final CreateVariableForm createVariableForm = new 
CreateVariableForm();
 
-    public VariableManagementPage(RemoteWebDriver driver) {
+    public VariablesPage(RemoteWebDriver driver) {
         super(driver);
     }
 
-    public VariableManagementPage createVariable(String variableCode, String 
variableValue, String description,
-                                                 boolean notVisible) {
+    public VariablesPage createVariable(String variableCode, String 
variableValue, String description,
+                                        boolean notVisible) {
         waitForPageLoading();
 
         new WebDriverWait(driver, Duration.ofSeconds(10))
@@ -73,8 +73,8 @@ public class VariableManagementPage extends NavBarPage 
implements ResourcePage.T
         return this;
     }
 
-    public VariableManagementPage editVariable(String variableCode, String 
variableValue, String description,
-                                               boolean notVisible) {
+    public VariablesPage editVariable(String variableCode, String 
variableValue, String description,
+                                      boolean notVisible) {
         waitForPageLoading();
 
         variableList().stream()
@@ -90,6 +90,7 @@ public class VariableManagementPage extends NavBarPage 
implements ResourcePage.T
 
         new WebDriverWait(driver, Duration.ofSeconds(10))
             
.until(ExpectedConditions.elementToBeClickable(createVariableForm.buttonSubmit));
+        createVariableForm.inputVariableValue().clear();
         createVariableForm.inputVariableValue().sendKeys(variableValue);
         createVariableForm.inputDescription().clear();
         createVariableForm.inputDescription().sendKeys(description);
@@ -101,7 +102,7 @@ public class VariableManagementPage extends NavBarPage 
implements ResourcePage.T
         return this;
     }
 
-    public VariableManagementPage deleteVariable(String variableCode) {
+    public VariablesPage deleteVariable(String variableCode) {
         waitForPageLoading();
 
         variableList().stream()

Reply via email to