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

kaihsun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git


The following commit(s) were added to refs/heads/master by this push:
     new 27567b7  SUBMARINE-881. Sidebar page component object for e2e-test
27567b7 is described below

commit 27567b7ab6053ef767252977976c71b73115c7a7
Author: noidname01 <[email protected]>
AuthorDate: Fri Jul 2 13:23:35 2021 +0800

    SUBMARINE-881. Sidebar page component object for e2e-test
    
    ### What is this PR for?
    Sidebar page component object for e2e-test
    
    ### What type of PR is it?
    [Improvement]
    
    ### Todos
    
    ### What is the Jira issue?
    
    https://issues.apache.org/jira/projects/SUBMARINE/issues/SUBMARINE-881
    
    ### How should this be tested?
    
    ```bash
    # Step1: Run Submarine workbench on 127.0.0.1:8080 by operator
    # Step2: Run testcase
    cd submarine-cloud-v2
    
    # Usage: ./hack/run_frontend_e2e.sh ${testcase}
    # Example:
    ./hack/run_frontend_e2e.sh notebookIT
    ```
    
    ### Screenshots (if appropriate)
    
    
![image](https://user-images.githubusercontent.com/55401762/123927145-22289d00-d9bf-11eb-9570-2fadc87c2ac7.png)
    
    ### Questions:
    * Do the license files need updating? No
    * Are there breaking changes for older versions? No
    * Does this need new documentation? No
    
    Author: noidname01 <[email protected]>
    
    Signed-off-by: Kai-Hsun Chen <[email protected]>
    
    Closes #625 from noidname01/SUBMARINE-881 and squashes the following 
commits:
    
    55e75d1f [noidname01] fix indent
    d71d099b [noidname01] pass URL as a function argument
    37f3d115 [noidname01] remove empty function
    591be12b [noidname01] delete mistake
    410474c5 [noidname01] fix indent and unused code
    0d9b1f04 [noidname01] bug fix
    89e33da7 [noidname01] sidebar current non-used page
    1498bc6d [noidname01] sidebar in page that can use
    5a61d682 [noidname01] test sidebar
    d415da7b [noidname01] add sidebar
---
 .../submarine/integration/components/Sidebars.java | 114 +++++++++++++++++++++
 .../org/apache/submarine/integration/dataIT.java   |   6 +-
 .../apache/submarine/integration/datadictIT.java   |   6 +-
 .../apache/submarine/integration/departmentIT.java |   9 +-
 .../submarine/integration/environmentIT.java       |   7 +-
 .../apache/submarine/integration/experimentIT.java |   5 +-
 .../submarine/integration/interpreterIT.java       |   5 +-
 .../apache/submarine/integration/notebookIT.java   |   6 +-
 .../apache/submarine/integration/sidebarIT.java    |  64 ------------
 .../apache/submarine/integration/workspaceIT.java  |  18 ++--
 10 files changed, 153 insertions(+), 87 deletions(-)

diff --git 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/components/Sidebars.java
 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/components/Sidebars.java
new file mode 100644
index 0000000..8358dc4
--- /dev/null
+++ 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/components/Sidebars.java
@@ -0,0 +1,114 @@
+/*
+ * 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.submarine.integration.components;
+
+import org.openqa.selenium.By;
+import org.apache.submarine.AbstractSubmarineIT;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.interactions.Actions;
+import org.openqa.selenium.support.PageFactory;
+import org.openqa.selenium.support.pagefactory.AjaxElementLocatorFactory;
+
+public class Sidebars extends AbstractSubmarineIT{
+
+    private String URL;
+
+    private By toNoteBook = By.xpath("//span[contains(text(), \"Notebook\")]");
+    private String noteBookURL = "/workbench/notebook";
+
+    private By toExperiment = By.xpath("//span[contains(text(), 
\"Experiment\")]");
+    private String experimentURL = "/workbench/experiment";
+
+    private By toTemplate = By.xpath("//span[contains(text(), \"Template\")]");
+    private String templateURL = "/workbench/template";
+
+    private By toEnvironment = By.xpath("//span[contains(text(), 
\"Environment\")]");
+    private String environmentURL = "/workbench/environment";
+
+    private By toManager = By.xpath("//span[contains(text(), \"Manager\")]");
+    private String managerURL = "/workbench/manager";
+
+    private By toDataDict = 
By.xpath("//a[@href='/workbench/manager/dataDict']");
+    private String dataDictURL = "/workbench/manager/dataDict";
+
+    private By toDepartment = 
By.xpath("//a[@href='/workbench/manager/department']");
+    private String departmentURL = "/workbench/manager/department";
+
+    private By toUser = By.xpath("//a[@href='/workbench/manager/user']");
+    private String userURL = "/workbench/manager/user";
+
+    private By toData = By.xpath("//span[contains(text(), \"Data\")]");
+    private String dataURL = "/workbench/data";
+
+    private By toWorkSpace = By.xpath("//span[contains(text(), 
\"Workspace\")]");
+    private String workSpaceURL = "/workbench/workspace";
+
+    private By toInterpreter = By.xpath("//span[contains(text(), 
\"Interpreter\")]");
+    private String interpreterURL = "/workbench/interpreter";
+
+    public Sidebars(String url) {
+        URL = url;
+    }
+
+    public void gotoNoteBook() {
+        ClickAndNavigate(toNoteBook, MAX_BROWSER_TIMEOUT_SEC, 
URL.concat(noteBookURL));
+    }
+
+    public void gotoExperiment() {
+        ClickAndNavigate(toExperiment, MAX_BROWSER_TIMEOUT_SEC, 
URL.concat(experimentURL));
+    }
+
+    public void gotoTemplate() {
+        ClickAndNavigate(toTemplate, MAX_BROWSER_TIMEOUT_SEC, 
URL.concat(templateURL));
+    }
+
+    public void gotoEnvironment() {
+        ClickAndNavigate(toEnvironment, MAX_BROWSER_TIMEOUT_SEC, 
URL.concat(environmentURL));
+    }
+
+    public void gotoUser() {
+        Click(toManager, MAX_BROWSER_TIMEOUT_SEC);
+        ClickAndNavigate(toUser, MAX_BROWSER_TIMEOUT_SEC, URL.concat(userURL));
+        Click(toManager, MAX_BROWSER_TIMEOUT_SEC);
+    }
+
+    public void gotoDataDict() {
+        Click(toManager, MAX_BROWSER_TIMEOUT_SEC);
+        ClickAndNavigate(toDataDict, MAX_BROWSER_TIMEOUT_SEC, 
URL.concat(dataDictURL));
+        Click(toManager, MAX_BROWSER_TIMEOUT_SEC);
+    }
+
+    public void gotoDepartment() {
+        Click(toManager, MAX_BROWSER_TIMEOUT_SEC);
+        ClickAndNavigate(toDepartment, MAX_BROWSER_TIMEOUT_SEC, 
URL.concat(departmentURL));
+        Click(toManager, MAX_BROWSER_TIMEOUT_SEC);
+    }
+
+    public void gotoData() {
+        ClickAndNavigate(toData, MAX_BROWSER_TIMEOUT_SEC, URL.concat(dataURL));
+    }
+
+    public void gotoWorkSpace() {
+        ClickAndNavigate(toWorkSpace, MAX_BROWSER_TIMEOUT_SEC, 
URL.concat(workSpaceURL));
+    }
+
+    public void gotoInterpreter() {
+        ClickAndNavigate(toInterpreter, MAX_BROWSER_TIMEOUT_SEC, 
URL.concat(interpreterURL));
+    }
+
+}
diff --git 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/dataIT.java
 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/dataIT.java
index e431b53..9a0b9b8 100644
--- 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/dataIT.java
+++ 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/dataIT.java
@@ -18,6 +18,7 @@
 package org.apache.submarine.integration;
 
 import org.apache.submarine.AbstractSubmarineIT;
+import org.apache.submarine.integration.components.Sidebars;
 import org.apache.submarine.WebDriverManager;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -49,6 +50,8 @@ public class dataIT extends AbstractSubmarineIT {
   @Test
   public void dataNavigation() throws Exception {
     String URL = getURL("http://127.0.0.1";, 8080);
+    Sidebars sidebars = new Sidebars(URL);
+
     // Login
     LOG.info("Login");
     pollingWait(By.cssSelector("input[ng-reflect-name='userName']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("admin");
@@ -57,8 +60,7 @@ public class dataIT extends AbstractSubmarineIT {
     pollingWait(By.cssSelector("a[routerlink='/workbench/experiment']"), 
MAX_BROWSER_TIMEOUT_SEC);
 
     // Routing to data page
-    pollingWait(By.xpath("//span[contains(text(), \"Data\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-    Assert.assertEquals(driver.getCurrentUrl(), URL.concat("/workbench/data"));
+    sidebars.gotoData();
 
     // Test create new Table
     pollingWait(By.xpath("//button[@id='createBtn']"), 
MAX_BROWSER_TIMEOUT_SEC).click();
diff --git 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/datadictIT.java
 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/datadictIT.java
index 3626e35..080d2db 100644
--- 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/datadictIT.java
+++ 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/datadictIT.java
@@ -18,6 +18,7 @@
 package org.apache.submarine.integration;
 
 import org.apache.submarine.AbstractSubmarineIT;
+import org.apache.submarine.integration.components.Sidebars;
 import org.apache.submarine.WebDriverManager;
 import org.openqa.selenium.By;
 import org.openqa.selenium.support.ui.ExpectedConditions;
@@ -46,6 +47,8 @@ public class datadictIT extends AbstractSubmarineIT {
   // @Test TODO(kevin85421): Due to the undeterministic behavior of travis, I 
decide to comment it.
   public void dataDictTest() throws Exception {
     String URL = getURL("http://127.0.0.1";, 8080);
+    Sidebars sidebars = new Sidebars(URL);
+
     // Login
     LOG.info("Login");
     pollingWait(By.cssSelector("input[ng-reflect-name='userName']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("admin");
@@ -55,9 +58,8 @@ public class datadictIT extends AbstractSubmarineIT {
 
     // Start Routing & Navigation in data-dict
     LOG.info("Start Routing & Navigation in data-dict");
-    pollingWait(By.xpath("//span[contains(text(), \"Manager\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
+    sidebars.gotoDataDict();
     WebDriverWait wait = new WebDriverWait( driver, 60);
-    pollingWait(By.xpath("//a[@href='/workbench/manager/dataDict']"), 
MAX_BROWSER_TIMEOUT_SEC).click();
     
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[@class='ant-breadcrumb-link
 ng-star-inserted']")));
     Assert.assertEquals(driver.getCurrentUrl(), 
URL.concat("/workbench/manager/dataDict"));
 
diff --git 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/departmentIT.java
 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/departmentIT.java
index e4a2d04..11a144c 100644
--- 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/departmentIT.java
+++ 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/departmentIT.java
@@ -18,6 +18,7 @@
 package org.apache.submarine.integration;
 
 import org.apache.submarine.AbstractSubmarineIT;
+import org.apache.submarine.integration.components.Sidebars;
 import org.apache.submarine.WebDriverManager;
 import org.openqa.selenium.support.ui.ExpectedConditions;
 import org.openqa.selenium.support.ui.WebDriverWait;
@@ -47,19 +48,19 @@ public class departmentIT extends AbstractSubmarineIT{
   @Test
   public void dataNavigation() throws Exception {
     String URL = getURL("http://127.0.0.1";, 8080);
+    Sidebars sidebars = new Sidebars(URL);
+
     // Login
     Login();
 
     // Routing to department page
-    Click(By.xpath("//span[contains(text(), \"Manager\")]"), 
MAX_BROWSER_TIMEOUT_SEC);
-    ClickAndNavigate(By.xpath("//a[@href='/workbench/manager/department']"), 
MAX_BROWSER_TIMEOUT_SEC, 
-                      URL.concat("/workbench/manager/department"));
+    sidebars.gotoDepartment();
 
     // Test create new department
     Click(By.xpath("//button[@id='btnAddDepartment']"), 
MAX_BROWSER_TIMEOUT_SEC);
     SendKeys(By.xpath("//input[@id='codeInput'] "), MAX_BROWSER_TIMEOUT_SEC, 
"e2e Test");
     SendKeys(By.xpath("//input[@id='nameInput']"), MAX_BROWSER_TIMEOUT_SEC, 
"e2e Test");
     Click(By.xpath("//button[@id='btnSubmit']"), MAX_BROWSER_TIMEOUT_SEC);
-    waitToPresent(By.xpath("//td[contains(., 'e2e Test')]"), 
MAX_BROWSER_TIMEOUT_SEC); 
+    waitToPresent(By.xpath("//td[contains(., 'e2e Test')]"), 
MAX_BROWSER_TIMEOUT_SEC);
   }
 }
diff --git 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/environmentIT.java
 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/environmentIT.java
index f55b695..2e26d7f 100644
--- 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/environmentIT.java
+++ 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/environmentIT.java
@@ -19,6 +19,7 @@ package org.apache.submarine.integration;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.submarine.AbstractSubmarineIT;
+import org.apache.submarine.integration.components.Sidebars;
 import org.apache.submarine.WebDriverManager;
 import org.openqa.selenium.By;
 import org.openqa.selenium.support.ui.FluentWait;
@@ -57,11 +58,13 @@ public class environmentIT extends AbstractSubmarineIT {
   @Test
   public void environmentNavigation() throws Exception {
     String URL = getURL("http://127.0.0.1";, 8080);
+    Sidebars sidebars = new Sidebars(URL);
+
     // Login
     Login();
 
     // Routing to workspace
-    ClickAndNavigate(By.xpath("//span[contains(text(), \"Environment\")]"), 
MAX_BROWSER_TIMEOUT_SEC, URL.concat("/workbench/environment"));
+    sidebars.gotoEnvironment();
 
     // Test create new environment
     LOG.info("Create new environment");
@@ -70,7 +73,7 @@ public class environmentIT extends AbstractSubmarineIT {
     SendKeys(By.cssSelector("input[ng-reflect-name='dockerImage']"), 
MAX_BROWSER_TIMEOUT_SEC, "testDockerImage");
     Click(By.xpath("//nz-upload[@id='upload-config']"), 
MAX_BROWSER_TIMEOUT_SEC);
 
-    // Because "//input[@type="file"]" will not display, we cannot use 
SendKeys which calls waitVisibility.   
+    // Because "//input[@type="file"]" will not display, we cannot use 
SendKeys which calls waitVisibility.
     waitToPresent(By.xpath("//input[@type=\"file\"]"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys(System.getProperty("user.dir") + 
"/src/test/resources/test_config_1.yml");
     Click(By.xpath("//button[@id='btn-submit']"), MAX_BROWSER_TIMEOUT_SEC);
 
diff --git 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/experimentIT.java
 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/experimentIT.java
index 9c26fa9..76499e0 100644
--- 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/experimentIT.java
+++ 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/experimentIT.java
@@ -19,6 +19,7 @@ package org.apache.submarine.integration;
 
 import org.apache.submarine.AbstractSubmarineIT;
 import org.apache.submarine.WebDriverManager;
+import org.apache.submarine.integration.components.Sidebars;
 import org.apache.submarine.integration.pages.ExperimentPage;
 import org.openqa.selenium.By;
 import org.slf4j.Logger;
@@ -46,16 +47,18 @@ public class experimentIT extends AbstractSubmarineIT {
   @Test
   public void experimentNavigation() throws Exception {
     String URL = getURL("http://127.0.0.1";, 8080);
+
     LOG.info("[Test case]: experimentNavigation]");
     // Init the page object
     ExperimentPage experimentPage = new ExperimentPage(driver);
+    Sidebars sidebars = new Sidebars(URL);
     // Login
     LOG.info("Login");
     Login();
 
     // Routing to workspace
     LOG.info("url");
-    ClickAndNavigate(By.xpath("//span[contains(text(), \"Experiment\")]"), 
MAX_BROWSER_TIMEOUT_SEC, URL.concat("/workbench/experiment"));
+    sidebars.gotoExperiment();
 
     // Test create new experiment
     LOG.info("First step");
diff --git 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/interpreterIT.java
 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/interpreterIT.java
index d4cf80c..6c8bd3c 100644
--- 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/interpreterIT.java
+++ 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/interpreterIT.java
@@ -19,6 +19,7 @@ package org.apache.submarine.integration;
 
 import org.apache.submarine.AbstractSubmarineIT;
 import org.apache.submarine.WebDriverManager;
+import org.apache.submarine.integration.components.Sidebars;
 import org.junit.Ignore;
 import org.openqa.selenium.By;
 import org.slf4j.Logger;
@@ -47,6 +48,7 @@ public class interpreterIT extends AbstractSubmarineIT {
   @Test
   public void workspaceNavigation() throws Exception {
     String URL = getURL("http://127.0.0.1";, 8080);
+    Sidebars sidebars = new Sidebars(URL);
     // Login
     LOG.info("Login");
     pollingWait(By.cssSelector("input[ng-reflect-name='userName']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("admin");
@@ -55,8 +57,7 @@ public class interpreterIT extends AbstractSubmarineIT {
     pollingWait(By.cssSelector("a[routerlink='/workbench/experiment']"), 
MAX_BROWSER_TIMEOUT_SEC);
 
     // Routing to Interpreter
-    pollingWait(By.xpath("//span[contains(text(), \"Interpreter\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-    Assert.assertEquals(driver.getCurrentUrl(), 
URL.concat("/workbench/interpreter"));
+    sidebars.gotoInterpreter();
 
     // Test create new Interpreter
     pollingWait(By.xpath("//button[@id='interpreterAddButton']"), 
MAX_BROWSER_TIMEOUT_SEC).click();
diff --git 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/notebookIT.java
 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/notebookIT.java
index b42f77f..df168da 100644
--- 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/notebookIT.java
+++ 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/notebookIT.java
@@ -18,6 +18,7 @@
 package org.apache.submarine.integration;
 
 import org.apache.submarine.AbstractSubmarineIT;
+import org.apache.submarine.integration.components.Sidebars;
 import org.apache.submarine.WebDriverManager;
 import org.apache.submarine.SubmarineITUtils;
 import org.openqa.selenium.By;
@@ -46,11 +47,12 @@ public class notebookIT extends AbstractSubmarineIT {
   @Test
   public void notebookNavigation() throws Exception {
     String URL = getURL("http://127.0.0.1";, 8080);
-    // Login
+    Sidebars sidebars = new Sidebars(URL);
+      // Login
     Login();
 
     // Routing to Notebook
-    ClickAndNavigate(By.xpath("//span[contains(text(), \"Notebook\")]"), 
MAX_BROWSER_TIMEOUT_SEC, URL.concat("/workbench/notebook"));
+    sidebars.gotoNoteBook();
 
     // Test for creating new notebook
     LOG.info("Create Notebook Test");
diff --git 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/sidebarIT.java
 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/sidebarIT.java
deleted file mode 100644
index eba9f1e..0000000
--- 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/sidebarIT.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.submarine.integration;
-
-import org.apache.submarine.AbstractSubmarineIT;
-import org.apache.submarine.WebDriverManager;
-import org.apache.submarine.SubmarineITUtils;
-import org.openqa.selenium.support.ui.ExpectedConditions;
-import org.openqa.selenium.support.ui.WebDriverWait;
-import org.openqa.selenium.By;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-import org.testng.Assert;
-
-public class sidebarIT extends AbstractSubmarineIT {
-
-  public final static Logger LOG = LoggerFactory.getLogger(sidebarIT.class);
-
-  @BeforeClass
-  public static void startUp(){
-    LOG.info("[Testcase]: sidebarIT");
-    driver =  WebDriverManager.getWebDriver();
-  }
-
-  @AfterClass
-  public static void tearDown(){
-    driver.quit();
-  }
-
-  @Test
-  public void sidebarNavigation() throws Exception {
-    String URL = getURL("http://127.0.0.1";, 8080);
-    // Login
-    Login();
-
-    // Start Routing & Navigation in sidebar
-    LOG.info("Start Routing & Navigation in sidebar");
-    ClickAndNavigate(By.xpath("//span[contains(text(), \"Experiment\")]"), 
MAX_BROWSER_TIMEOUT_SEC, URL.concat("/workbench/experiment"));
-    Click(By.xpath("//span[contains(text(), \"Manager\")]"), 
MAX_BROWSER_TIMEOUT_SEC);
-    Click(By.xpath("//a[@href='/workbench/manager/user']"), 
MAX_BROWSER_TIMEOUT_SEC);
-
-    // Lazy-loading
-    ClickAndNavigate(By.xpath("//a[@href='/workbench/manager/user']"), 
MAX_BROWSER_TIMEOUT_SEC, URL.concat("/workbench/manager/user"));
-    ClickAndNavigate(By.xpath("//a[@href='/workbench/manager/dataDict']"), 
MAX_BROWSER_TIMEOUT_SEC, URL.concat("/workbench/manager/dataDict"));
-  }
-}
diff --git 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/workspaceIT.java
 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/workspaceIT.java
index eaea6d3..479e101 100644
--- 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/workspaceIT.java
+++ 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/workspaceIT.java
@@ -18,6 +18,7 @@
 package org.apache.submarine.integration;
 
 import org.apache.submarine.AbstractSubmarineIT;
+import org.apache.submarine.integration.components.Sidebars;
 import org.apache.submarine.WebDriverManager;
 import org.junit.Ignore;
 import org.openqa.selenium.support.ui.ExpectedConditions;
@@ -49,6 +50,8 @@ public class workspaceIT extends AbstractSubmarineIT {
   @Test
   public void workspaceNavigation() throws Exception {
     String URL = getURL("http://127.0.0.1";, 8080);
+    Sidebars sidebars = new Sidebars(URL);
+
     // Login
     LOG.info("Login");
     pollingWait(By.cssSelector("input[ng-reflect-name='userName']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("admin");
@@ -57,8 +60,7 @@ public class workspaceIT extends AbstractSubmarineIT {
     pollingWait(By.cssSelector("a[routerlink='/workbench/experiment']"), 
MAX_BROWSER_TIMEOUT_SEC);
 
     // Routing to workspace
-    pollingWait(By.xpath("//span[contains(text(), \"Workspace\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-    Assert.assertEquals(driver.getCurrentUrl(), 
URL.concat("/workbench/workspace"));
+    sidebars.gotoWorkSpace();
 
     WebDriverWait wait = new WebDriverWait( driver, 60);
     
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//li[contains(text(),
 \"Release\")]")));
@@ -90,13 +92,13 @@ public class workspaceIT extends AbstractSubmarineIT {
     pollingWait(By.xpath("//input[@id='username']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("e2e test Project");
     pollingWait(By.xpath("//textarea[@name='projectDescription']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("e2e test Project description");
     Assert.assertEquals(pollingWait(nextStepButton, 
MAX_BROWSER_TIMEOUT_SEC).getAttribute("disabled"), "true"); // nextStepButton 
disabled (no set visibility)
-    
+
     
pollingWait(By.xpath("//nz-radio-group[@name='visibility']/label[1]/span/input"),
 MAX_BROWSER_TIMEOUT_SEC).click(); // select Private
     Assert.assertEquals(pollingWait(nextStepButton, 
MAX_BROWSER_TIMEOUT_SEC).getAttribute("disabled"), null); // nextStepButton 
enabled
-    
+
     
pollingWait(By.xpath("//nz-radio-group[@name='visibility']/label[last()]/span/input"),
 MAX_BROWSER_TIMEOUT_SEC).click(); // select Public
     Assert.assertEquals(pollingWait(nextStepButton, 
MAX_BROWSER_TIMEOUT_SEC).getAttribute("disabled"), "true"); // nextStepButton 
disabled (no set permission)
-    
+
     
pollingWait(By.xpath("//nz-radio-group[@name='permission']/label[last()]/span/input"),
 MAX_BROWSER_TIMEOUT_SEC).click(); // select Can View
     Assert.assertEquals(pollingWait(nextStepButton, 
MAX_BROWSER_TIMEOUT_SEC).getAttribute("disabled"), null); // nextStepButton 
enabled
 
@@ -106,13 +108,13 @@ public class workspaceIT extends AbstractSubmarineIT {
     pollingWait(By.xpath("//nz-select[@name='team']"), 
MAX_BROWSER_TIMEOUT_SEC).click(); // expand team options
     pollingWait(By.xpath("//li[@nz-option-li][last()]"), 
MAX_BROWSER_TIMEOUT_SEC).click(); // select a team
     Assert.assertEquals(pollingWait(nextStepButton, 
MAX_BROWSER_TIMEOUT_SEC).getAttribute("disabled"), null); // nextStepButton 
enabled
-    
+
     pollingWait(nextStepButton, MAX_BROWSER_TIMEOUT_SEC).click();
-    
+
     //step2
     Assert.assertEquals(pollingWait(By.xpath("//nz-tabset"), 
MAX_BROWSER_TIMEOUT_SEC).isDisplayed(), true);
     pollingWait(By.xpath("//div[@class='centerDiv']/button[last()]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-    
+
     //step3
     Assert.assertEquals(pollingWait(By.xpath("//thead"), 
MAX_BROWSER_TIMEOUT_SEC).isDisplayed(), true);
     pollingWait(By.xpath("//div[@class='centerDiv']/button[last()-1]"), 
MAX_BROWSER_TIMEOUT_SEC).click();

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to