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 39eb01e  SUBMARINE-841. Modify hard-coded URLs in E2E test to 
soft-coded URLs
39eb01e is described below

commit 39eb01e5cf5641b78818ed3c32bc1d69e906ee07
Author: Kai-Hsun Chen <[email protected]>
AuthorDate: Mon May 31 20:52:21 2021 +0800

    SUBMARINE-841. Modify hard-coded URLs in E2E test to soft-coded URLs
    
    ### What is this PR for?
    Currently, some frontend E2E tests determine whether a test passes or fails 
based on a hard-coded URL and port. Take dataIT as an example, the following 
code hard-coded the expected URL to "http://localhost:8080/workbench/data";. 
However, we cannot ensure that Submarine Workbench will always run on 
"http://localhost:8080";. Hence, this issue aims to change the hard-coded URL to 
a soft-coded URL.
    
     ```
    
Assert.assertEquals(driver.getCurrentUrl(),"http://localhost:8080/workbench/data";);
    ```
    
    Hardcoding vs Softcoding: 
https://simplicable.com/new/hardcoding-vs-softcoding
    
    ### What type of PR is it?
    [Improvement]
    
    ### Todos
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/browse/SUBMARINE-841
    
    ### How should this be tested?
    * Run workbench on $URL:$WORKBENCH_PORT (These two variables are specified 
in `run_frontend_e2e.sh`)
    ```
    cd submarine-cloud-v2
    ./hack/run_frontend_e2e.sh $[testcase]
    
    # Example:
    ./hack/run_frontend_e2e.sh loginIT
    ./hack/run_frontend_e2e.sh environmentIT
    ```
    
    ### Screenshots (if appropriate)
    <img width="963" alt="ζˆͺεœ– 2021-05-31 δΈ‹εˆ8 40 04" 
src="https://user-images.githubusercontent.com/20109646/120196922-fe085d80-c252-11eb-9aed-17a52c42478a.png";>
    
    ### Questions:
    * Do the license files need updating? No
    * Are there breaking changes for older versions? No
    * Does this need new documentation? No
    
    Author: Kai-Hsun Chen <[email protected]>
    
    Signed-off-by: Kai-Hsun Chen <[email protected]>
    
    Closes #596 from kevin85421/SUBMARINE-841 and squashes the following 
commits:
    
    03f922a2 [Kai-Hsun Chen] SUBMARINE-841. Modify hard-coded URLs in frontend 
E2E test to soft-coded URLs
---
 submarine-cloud-v2/README.md                          |  3 ++-
 submarine-cloud-v2/hack/run_frontend_e2e.sh           | 12 +++++++-----
 .../org/apache/submarine/AbstractSubmarineIT.java     | 19 +++++++++++++++++++
 .../java/org/apache/submarine/WebDriverManager.java   | 15 +++++++++++++++
 .../java/org/apache/submarine/integration/dataIT.java |  3 ++-
 .../org/apache/submarine/integration/datadictIT.java  |  3 ++-
 .../apache/submarine/integration/departmentIT.java    |  3 ++-
 .../apache/submarine/integration/environmentIT.java   |  3 ++-
 .../apache/submarine/integration/experimentIT.java    |  3 ++-
 .../apache/submarine/integration/interpreterIT.java   |  3 ++-
 .../org/apache/submarine/integration/notebookIT.java  |  3 ++-
 .../org/apache/submarine/integration/registerIT.java  | 10 ++++++----
 .../org/apache/submarine/integration/sidebarIT.java   | 17 +++++++++--------
 .../java/org/apache/submarine/integration/teamIT.java |  3 ++-
 .../org/apache/submarine/integration/workspaceIT.java |  3 ++-
 15 files changed, 76 insertions(+), 27 deletions(-)

diff --git a/submarine-cloud-v2/README.md b/submarine-cloud-v2/README.md
index ace3abf..cb87817 100644
--- a/submarine-cloud-v2/README.md
+++ b/submarine-cloud-v2/README.md
@@ -9,6 +9,7 @@ For `yaml` files, please use [prettier](https://prettier.io/) 
to format the code
 
 # Initialization
 ```bash
+minikube start --vm-driver=docker  --kubernetes-version v1.15.11
 go mod vendor
 chmod -R 777 vendor
 ```
@@ -161,7 +162,7 @@ Examples:
 Use the following helper script to run frontend E2E tests.
 
 ```
-# Prerequisite: Make sure Workbench is running on 127.0.0.1:8080.
+# Prerequisite: Make sure Workbench is running on $URL:$WORKBENCH_PORT.
 ./hack/run_frontend_e2e.sh [testcase]
 ```
 * [testcase]: Check the directory 
[integration](../submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/).
diff --git a/submarine-cloud-v2/hack/run_frontend_e2e.sh 
b/submarine-cloud-v2/hack/run_frontend_e2e.sh
index 61369c4..95b2d29 100755
--- a/submarine-cloud-v2/hack/run_frontend_e2e.sh
+++ b/submarine-cloud-v2/hack/run_frontend_e2e.sh
@@ -22,12 +22,14 @@
 #       Testcase: Check the directory 
"submarine-test/test-e2e/src/test/java/org/apache/submarine/integration"
 #       Example : ./run_frontend_e2e.sh loginIT
 
-SUBMARINE_HOME=`git rev-parse --show-toplevel`
-
-# Do not modify these two variables.
+# ======= Modifiable Variables ======= #
+# Note: URL must start with "http" 
+# (Ref: 
https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/WebDriver.html#get(java.lang.String))
 WORKBENCH_PORT=8080
-URL="127.0.0.1"
+URL="http://127.0.0.1";
+# ==================================== #
 
+SUBMARINE_HOME=`git rev-parse --show-toplevel`
 cd "$SUBMARINE_HOME"
 
 HTTP_CODE=$(curl -sL -w "%{http_code}\\n" $URL:$WORKBENCH_PORT -o /dev/null)
@@ -40,4 +42,4 @@ fi
 
 set -e
 TESTCASE=$1
-mvn -f submarine-test/test-e2e/ -Dtest=$TESTCASE -DSUBMARINE_E2E_LOCAL=true 
test
\ No newline at end of file
+mvn -f submarine-test/test-e2e/ -DSUBMARINE_WORKBENCH_URL=$URL 
-DSUBMARINE_WORKBENCH_PORT=$WORKBENCH_PORT -Dtest=$TESTCASE 
-DSUBMARINE_E2E_LOCAL=true test
\ No newline at end of file
diff --git 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/AbstractSubmarineIT.java
 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/AbstractSubmarineIT.java
index 87fd83a..c7ec3a7 100644
--- 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/AbstractSubmarineIT.java
+++ 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/AbstractSubmarineIT.java
@@ -115,6 +115,25 @@ abstract public class AbstractSubmarineIT {
     });
   }
 
+  protected String getURL(final String defaultURL, final int defaultPort) {
+    String URL;
+    if (System.getProperty("SUBMARINE_WORKBENCH_URL") == null) {
+      URL = defaultURL;
+    } else {
+      URL = System.getProperty("SUBMARINE_WORKBENCH_URL"); 
+    }
+
+    URL = URL.concat(":");
+
+    if (System.getProperty("SUBMARINE_WORKBENCH_PORT") == null) {
+      URL = URL.concat(String.valueOf(defaultPort));      
+    } else {
+      String port = System.getProperty("SUBMARINE_WORKBENCH_PORT");
+      URL = URL.concat(String.valueOf(port));
+    }
+    return URL;
+  }
+
   protected WebElement buttonCheck(final By locator, final long timeWait) {
     Wait<WebDriver> wait = new FluentWait<>(driver)
         .withTimeout(timeWait, TimeUnit.SECONDS)
diff --git 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/WebDriverManager.java
 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/WebDriverManager.java
index d0f17e1..3376557 100644
--- 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/WebDriverManager.java
+++ 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/WebDriverManager.java
@@ -66,6 +66,21 @@ public class WebDriverManager {
     String url;
     if (System.getenv("url") != null) {
       url = System.getenv("url");
+    } else if ((System.getProperty("SUBMARINE_WORKBENCH_URL") != null) || 
(System.getProperty("SUBMARINE_WORKBENCH_PORT") == null)) {
+      if (System.getProperty("SUBMARINE_WORKBENCH_URL") == null) {
+        url = "http://localhost";;
+      } else {
+        url = System.getProperty("SUBMARINE_WORKBENCH_URL"); 
+      }
+
+      url = url.concat(":");
+
+      if (System.getProperty("SUBMARINE_WORKBENCH_PORT") == null) {
+        url = url.concat("8080");      
+      } else {
+        String port = System.getProperty("SUBMARINE_WORKBENCH_PORT");
+        url = url.concat(String.valueOf(port));
+      }
     } else {
       url = "http://localhost:8080";;
     }
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 755dc64..96bdee9 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
@@ -48,6 +48,7 @@ public class dataIT extends AbstractSubmarineIT {
 
   @Test
   public void dataNavigation() throws Exception {
+    String URL = getURL("http://localhost";, 8080);
     // Login
     LOG.info("Login");
     pollingWait(By.cssSelector("input[ng-reflect-name='userName']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("admin");
@@ -57,7 +58,7 @@ public class dataIT extends AbstractSubmarineIT {
 
     // Routing to data page
     pollingWait(By.xpath("//span[contains(text(), \"Data\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/workbench/data";);
+    Assert.assertEquals(driver.getCurrentUrl(), URL.concat("/workbench/data"));
 
     // 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 fb7035b..78f2ba5 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
@@ -45,6 +45,7 @@ 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://localhost";, 8080);
     // Login
     LOG.info("Login");
     pollingWait(By.cssSelector("input[ng-reflect-name='userName']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("admin");
@@ -58,7 +59,7 @@ public class datadictIT extends AbstractSubmarineIT {
     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(), 
"http://localhost:8080/workbench/manager/dataDict";);
+    Assert.assertEquals(driver.getCurrentUrl(), 
URL.concat("/workbench/manager/dataDict"));
 
     // Add button
     LOG.info("[TEST] Add button");
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 5f4f756..85bda7f 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
@@ -46,6 +46,7 @@ public class departmentIT extends AbstractSubmarineIT{
 
   @Test
   public void dataNavigation() throws Exception {
+    String URL = getURL("http://localhost";, 8080);
     // Login
     LOG.info("Login");
     pollingWait(By.cssSelector("input[ng-reflect-name='userName']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("admin");
@@ -58,7 +59,7 @@ public class departmentIT extends AbstractSubmarineIT{
     WebDriverWait wait = new WebDriverWait( driver, 60);
     pollingWait(By.xpath("//a[@href='/workbench/manager/department']"), 
MAX_BROWSER_TIMEOUT_SEC).click();
     
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[@class='ant-breadcrumb-link
 ng-star-inserted']")));
-    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/workbench/manager/department";);
+    Assert.assertEquals(driver.getCurrentUrl(), 
URL.concat("/workbench/manager/department"));
 
     // Test create new department
     pollingWait(By.xpath("//button[@id='btnAddDepartment']"), 
MAX_BROWSER_TIMEOUT_SEC).click();
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 04665a1..2558e4a 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
@@ -56,6 +56,7 @@ public class environmentIT extends AbstractSubmarineIT {
 
   @Test
   public void environmentNavigation() throws Exception {
+    String URL = getURL("http://localhost";, 8080);
     // Login
     LOG.info("Login");
     pollingWait(By.cssSelector("input[ng-reflect-name='userName']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("admin");
@@ -66,7 +67,7 @@ public class environmentIT extends AbstractSubmarineIT {
     // Routing to workspace
     LOG.info("url");
     pollingWait(By.xpath("//span[contains(text(), \"Environment\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/workbench/environment";);
+    Assert.assertEquals(driver.getCurrentUrl(), 
URL.concat("/workbench/environment"));
 
     // Test create new environment
     LOG.info("Create new environment");
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 7858d50..847d84e 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
@@ -45,6 +45,7 @@ public class experimentIT extends AbstractSubmarineIT {
 
   @Test
   public void experimentNavigation() throws Exception {
+    String URL = getURL("http://localhost";, 8080);
     LOG.info("[Test case]: experimentNavigation]");
     // Init the page object
     ExperimentPage experimentPage = new ExperimentPage(driver);
@@ -58,7 +59,7 @@ public class experimentIT extends AbstractSubmarineIT {
     // Routing to workspace
     LOG.info("url");
     pollingWait(By.xpath("//span[contains(text(), \"Experiment\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/workbench/experiment";);
+    Assert.assertEquals(driver.getCurrentUrl(), 
URL.concat("/workbench/experiment"));
 
     // 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 df8def0..1042fd2 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
@@ -46,6 +46,7 @@ public class interpreterIT extends AbstractSubmarineIT {
 
   @Test
   public void workspaceNavigation() throws Exception {
+    String URL = getURL("http://localhost";, 8080);
     // Login
     LOG.info("Login");
     pollingWait(By.cssSelector("input[ng-reflect-name='userName']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("admin");
@@ -55,7 +56,7 @@ public class interpreterIT extends AbstractSubmarineIT {
 
     // Routing to Interpreter
     pollingWait(By.xpath("//span[contains(text(), \"Interpreter\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/workbench/interpreter";);
+    Assert.assertEquals(driver.getCurrentUrl(), 
URL.concat("/workbench/interpreter"));
 
     // 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 cfcb2a9..99d5d71 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
@@ -45,6 +45,7 @@ public class notebookIT extends AbstractSubmarineIT {
 
   @Test
   public void notebookNavigation() throws Exception {
+    String URL = getURL("http://localhost";, 8080);
     // Login
     LOG.info("Login");
     pollingWait(By.cssSelector("input[ng-reflect-name='userName']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("admin");
@@ -54,7 +55,7 @@ public class notebookIT extends AbstractSubmarineIT {
 
     // Routing to Notebook
     pollingWait(By.xpath("//span[contains(text(), \"Notebook\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/workbench/notebook";);
+    Assert.assertEquals(driver.getCurrentUrl(), 
URL.concat("/workbench/notebook"));
 
     // Test for creating new notebook
     LOG.info("Create Notebook Test");
diff --git 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/registerIT.java
 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/registerIT.java
index 4b357d0..d694e19 100644
--- 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/registerIT.java
+++ 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/registerIT.java
@@ -46,10 +46,11 @@ public class registerIT extends AbstractSubmarineIT {
 
   @Test
   public void registerFrontEndInvalidTest() throws Exception {
+    String URL = getURL("http://localhost";, 8080);
     // Navigate from Login page to Registration page
     LOG.info("Navigate from Login page to Registration page");
     pollingWait(By.xpath("//a[contains(text(), \"Create an account!\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/user/register";);
+    Assert.assertEquals(driver.getCurrentUrl(), URL.concat("/user/register"));
 
     // Username test
     //   Case1: empty username
@@ -93,20 +94,21 @@ public class registerIT extends AbstractSubmarineIT {
     pollingWait(By.cssSelector("input[formcontrolname='checkPassword']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("1234"); // "1234" != "testtesttest"
     Assert.assertEquals( driver.findElements(By.xpath("//div[contains(text(), 
\"Passwords must match!\")]")).size(), 1);
     pollingWait(By.xpath("//a[@href='/user/login']"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/user/login";); 
+    Assert.assertEquals(driver.getCurrentUrl(), URL.concat("/user/login")); 
   }
 
   @Test
   public void registerFrontEndValidTest() throws Exception {
+    String URL = getURL("http://localhost";, 8080);
     // Sign-Up successfully
     pollingWait(By.xpath("//a[contains(text(), \"Create an account!\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/user/register";);
+    Assert.assertEquals(driver.getCurrentUrl(), URL.concat("/user/register"));
     pollingWait(By.cssSelector("input[formcontrolname='username']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("validusername");
     pollingWait(By.cssSelector("input[formcontrolname='email']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("[email protected]");
     pollingWait(By.cssSelector("input[formcontrolname='password']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("validpassword");
     pollingWait(By.cssSelector("input[formcontrolname='checkPassword']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("validpassword");
     pollingWait(By.cssSelector("label[formcontrolname='agree']"), 
MAX_BROWSER_TIMEOUT_SEC).click();
     pollingWait(By.cssSelector("button[class='ant-btn ant-btn-primary 
ant-btn-block']"), MAX_BROWSER_TIMEOUT_SEC).click(); 
-    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/user/login";);
+    Assert.assertEquals(driver.getCurrentUrl(), URL.concat("/user/login"));
   }
 }
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
index 075a7f8..7dc08c5 100644
--- 
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
@@ -47,6 +47,7 @@ public class sidebarIT extends AbstractSubmarineIT {
 
   @Test
   public void sidebarNavigation() throws Exception {
+    String URL = getURL("http://localhost";, 8080);
     // Login
     LOG.info("Login");
     pollingWait(By.cssSelector("input[ng-reflect-name='userName']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("admin");
@@ -57,29 +58,29 @@ public class sidebarIT extends AbstractSubmarineIT {
     // Start Routing & Navigation in sidebar
     LOG.info("Start Routing & Navigation in sidebar");
     pollingWait(By.xpath("//span[contains(text(), \"Experiment\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/workbench/experiment";);
+    Assert.assertEquals(driver.getCurrentUrl(), 
URL.concat("/workbench/experiment"));
     pollingWait(By.xpath("//span[contains(text(), \"Manager\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
     pollingWait(By.xpath("//a[@href='/workbench/manager/user']"), 
MAX_BROWSER_TIMEOUT_SEC).click();
 
     // SUBMARINE-628. [WEB] Disable WIP page link
 //    pollingWait(By.xpath("//span[contains(text(), \"Workspace\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click()
-//    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/workbench/workspace";);
+//    Assert.assertEquals(driver.getCurrentUrl(), 
URL.concat("/workbench/workspace"));
 //    pollingWait(By.xpath("//span[contains(text(), \"Interpreter\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-//    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/workbench/interpreter";);
+//    Assert.assertEquals(driver.getCurrentUrl(), 
URL.concat("/workbench/interpreter"));
 //    pollingWait(By.xpath("//span[contains(text(), \"Data\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-//    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/workbench/data";);
+//    Assert.assertEquals(driver.getCurrentUrl(), 
URL.concat("/workbench/data"));
 //    pollingWait(By.xpath("//span[contains(text(), \"Model\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-//    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/workbench/model";);
+//    Assert.assertEquals(driver.getCurrentUrl(), 
URL.concat("/workbench/model"));
 //    pollingWait(By.xpath("//span[contains(text(), \"Home\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-//    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/workbench/home";);
+//    Assert.assertEquals(driver.getCurrentUrl(), 
URL.concat("/workbench/home"));
 
     // Lazy-loading
     WebDriverWait wait = new WebDriverWait( driver, 15, 5000);
     pollingWait(By.xpath("//a[@href='/workbench/manager/user']"), 
MAX_BROWSER_TIMEOUT_SEC).click();
     
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[@class='ant-breadcrumb-link
 ng-star-inserted']")));
-    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/workbench/manager/user";);
+    Assert.assertEquals(driver.getCurrentUrl(), 
URL.concat("/workbench/manager/user"));
 
     pollingWait(By.xpath("//a[@href='/workbench/manager/dataDict']"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/workbench/manager/dataDict";);
+    Assert.assertEquals(driver.getCurrentUrl(), 
URL.concat("/workbench/manager/dataDict"));
   }
 }
diff --git 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/teamIT.java
 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/teamIT.java
index 8cd2b24..26ffb4a 100644
--- 
a/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/teamIT.java
+++ 
b/submarine-test/test-e2e/src/test/java/org/apache/submarine/integration/teamIT.java
@@ -46,6 +46,7 @@ public class teamIT extends AbstractSubmarineIT {
 
   @Test
   public void teamTest() throws Exception {
+    String URL = getURL("http://localhost";, 8080);
     // Login
     LOG.info("Login");
     pollingWait(By.cssSelector("input[ng-reflect-name='userName']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("admin");
@@ -55,7 +56,7 @@ public class teamIT extends AbstractSubmarineIT {
 
     // Routing to workspace
     pollingWait(By.xpath("//span[contains(text(), \"Workspace\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/workbench/workspace";);
+    Assert.assertEquals(driver.getCurrentUrl(), 
URL.concat("/workbench/workspace"));
 
     //Test team part
     pollingWait(By.xpath("//li[contains(text(), \"Team\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
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 b111d87..663396e 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
@@ -48,6 +48,7 @@ public class workspaceIT extends AbstractSubmarineIT {
 
   @Test
   public void workspaceNavigation() throws Exception {
+    String URL = getURL("http://localhost";, 8080);
     // Login
     LOG.info("Login");
     pollingWait(By.cssSelector("input[ng-reflect-name='userName']"), 
MAX_BROWSER_TIMEOUT_SEC).sendKeys("admin");
@@ -57,7 +58,7 @@ public class workspaceIT extends AbstractSubmarineIT {
 
     // Routing to workspace
     pollingWait(By.xpath("//span[contains(text(), \"Workspace\")]"), 
MAX_BROWSER_TIMEOUT_SEC).click();
-    Assert.assertEquals(driver.getCurrentUrl(), 
"http://localhost:8080/workbench/workspace";);
+    Assert.assertEquals(driver.getCurrentUrl(), 
URL.concat("/workbench/workspace"));
 
     WebDriverWait wait = new WebDriverWait( driver, 60);
     
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//li[contains(text(),
 \"Release\")]")));

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

Reply via email to