Browse Source

e2e add project and workflow case (#2309)

* add LoginTest license

* Delete useless packages

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

Co-authored-by: chenxingchun <438044805@qq.com>
pull/3/MERGE
xingchun-chen 5 years ago committed by gaojun2048
parent
commit
e496206a88
  1. 8
      e2e/src/main/java/org/apache/dolphinscheduler/constant/TestConstant.java
  2. 4
      e2e/src/main/java/org/apache/dolphinscheduler/util/RedisUtil.java
  3. 16
      e2e/src/test/java/org/apache/dolphinscheduler/base/BaseDriver.java
  4. 22
      e2e/src/test/java/org/apache/dolphinscheduler/common/BrowserCommon.java
  5. 46
      e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreatWorkflowData.java
  6. 2
      e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateProjectData.java
  7. 8
      e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateWorkflowData.java
  8. 8
      e2e/src/test/java/org/apache/dolphinscheduler/data/security/TenantManageData.java
  9. 2
      e2e/src/test/java/org/apache/dolphinscheduler/data/security/UserManageData.java
  10. 15
      e2e/src/test/java/org/apache/dolphinscheduler/locator/project/CreateProjectLocator.java
  11. 11
      e2e/src/test/java/org/apache/dolphinscheduler/locator/project/CreateWorkflowLocator.java
  12. 2
      e2e/src/test/java/org/apache/dolphinscheduler/locator/security/TenantManageLocator.java
  13. 3
      e2e/src/test/java/org/apache/dolphinscheduler/page/LoginPage.java
  14. 33
      e2e/src/test/java/org/apache/dolphinscheduler/page/project/CreateProjectPage.java
  15. 41
      e2e/src/test/java/org/apache/dolphinscheduler/page/project/CreateWorkflowPage.java
  16. 28
      e2e/src/test/java/org/apache/dolphinscheduler/page/security/TenantManagePage.java
  17. 6
      e2e/src/test/java/org/apache/dolphinscheduler/page/security/UserManagePage.java
  18. 1
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/LoginTest.java
  19. 39
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteProjectTest.java
  20. 7
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteTenantTest.java
  21. 8
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteUserTest.java
  22. 43
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteWorkflowTest.java
  23. 3
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/project/CreateProjectTest.java
  24. 6
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/project/CreateWorkflowTest.java
  25. 5
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/security/TenantManageTest.java
  26. 2
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/security/UserManageTest.java
  27. 10
      e2e/testng.xml

8
e2e/src/main/java/org/apache/dolphinscheduler/constant/TestConstant.java

@ -20,18 +20,16 @@ public class TestConstant {
/** /**
* 1000 * 1000
*/ */
public static final int ONE_THOUSANG = 1000; public static final int ONE_THOUSAND = 1000;
/** /**
* 3000 * 3000
*/ */
public static final int THREE_THOUSANG = 3000; public static final int THREE_THOUSAND = 3000;
/** /**
* 10000 * 10000
*/ */
public static final int TEN_THOUSANG = 10000; public static final int TEN_THOUSAND = 10000;
} }

4
e2e/src/main/java/org/apache/dolphinscheduler/util/RedisUtil.java

@ -115,9 +115,9 @@ public class RedisUtil {
try { try {
System.out.println("redis init"); System.out.println("redis init");
if (redisPwd.isEmpty()) if (redisPwd.isEmpty())
jedisPool = new JedisPool(jedisPoolConfig, redisIp, redisPort, TestConstant.THREE_THOUSANG); jedisPool = new JedisPool(jedisPoolConfig, redisIp, redisPort, TestConstant.THREE_THOUSAND);
else { else {
jedisPool = new JedisPool(jedisPoolConfig, redisIp, redisPort, TestConstant.TEN_THOUSANG, redisPwd); jedisPool = new JedisPool(jedisPoolConfig, redisIp, redisPort, TestConstant.TEN_THOUSAND, redisPwd);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

16
e2e/src/test/java/org/apache/dolphinscheduler/base/BaseDriver.java

@ -19,14 +19,14 @@ package org.apache.dolphinscheduler.base;
import org.apache.dolphinscheduler.constant.TestConstant; import org.apache.dolphinscheduler.constant.TestConstant;
import org.apache.dolphinscheduler.util.PropertiesReader; import org.apache.dolphinscheduler.util.PropertiesReader;
import org.openqa.selenium.Cookie; import org.openqa.selenium.PageLoadStrategy;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.CapabilityType;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.openqa.selenium.PageLoadStrategy;
/** /**
@ -83,6 +83,7 @@ public class BaseDriver {
* start chrome browser * start chrome browser
*/ */
public void startBrowser() throws Exception { public void startBrowser() throws Exception {
System.out.println("===================test start===================");
// set chrome driver // set chrome driver
System.setProperty("webdriver.chrome.driver", chromeDriverPath); System.setProperty("webdriver.chrome.driver", chromeDriverPath);
ChromeOptions chromeOptions = new ChromeOptions(); ChromeOptions chromeOptions = new ChromeOptions();
@ -104,9 +105,6 @@ public class BaseDriver {
// page load timeout // page load timeout
driver.manage().timeouts().pageLoadTimeout(pageLoadTimeout, TimeUnit.SECONDS); driver.manage().timeouts().pageLoadTimeout(pageLoadTimeout, TimeUnit.SECONDS);
// page load timeout
driver.manage().timeouts().pageLoadTimeout(pageLoadTimeout, TimeUnit.SECONDS);
// script timeout // script timeout
driver.manage().timeouts().setScriptTimeout(setScriptTimeout, TimeUnit.SECONDS); driver.manage().timeouts().setScriptTimeout(setScriptTimeout, TimeUnit.SECONDS);
@ -141,12 +139,10 @@ public class BaseDriver {
* close browser * close browser
*/ */
public void closeBrowser() throws InterruptedException { public void closeBrowser() throws InterruptedException {
// JS Show a pop-up box to indicate the end of the test Thread.sleep(TestConstant.THREE_THOUSAND);
Thread.sleep(TestConstant.ONE_THOUSANG);
// ((JavascriptExecutor) driver).executeScript("alert('Test completed, browser closes after 3s')");
Thread.sleep(TestConstant.THREE_THOUSANG);
if (driver != null) { if (driver != null) {
driver.quit(); driver.quit();
System.out.println("===================test end===================");
} }
} }
} }

22
e2e/src/test/java/org/apache/dolphinscheduler/common/BrowserCommon.java

@ -126,6 +126,18 @@ public class BrowserCommon {
return buttonElement; return buttonElement;
} }
/**
* Click Navigation Bar element
* @param locator By
* @return clickButton
*/
public void clickTopElement(By locator) {
WebElement element = driver.findElement(locator);
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);
}
/** /**
* Click element * Click element
* *
@ -138,6 +150,7 @@ public class BrowserCommon {
return clickElement; return clickElement;
} }
/** /**
* input element * input element
* *
@ -236,6 +249,10 @@ public class BrowserCommon {
return driver; return driver;
} }
/** /**
* Multi-window switch handle, according to the handle number passed in * Multi-window switch handle, according to the handle number passed in
* *
@ -314,9 +331,8 @@ public class BrowserCommon {
executeScript("window.scrollTo(0, document.body.scrollHeight)"); executeScript("window.scrollTo(0, document.body.scrollHeight)");
} }
public void scrollToElementBottom() { public void scrollToElementBottom(By locator) {
WebElement webElement = locateElement(locator);
WebElement webElement = driver.findElement(By.xpath("/html/body/div[4]/div/div[2]/div/div[2]/div/div[7]/div[3]"));
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", webElement); ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", webElement);
} }

46
e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreatWorkflowData.java

@ -1,46 +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.dolphinscheduler.data.project;
public class CreatWorkflowData {
//input shell task name
public static final String SHELL_TASK_NAME = "shell task description test1";
//input shell task description
public static final String SHELL_TASK_DESCRIPTION = "shell task description test";
//input timeout
public static final String INPUT_TIMEOUT = "60";
//input shell script
public static final String SHELL_SCRIPT = "echo 1111111";
//input custom parameters
public static final String INPUT_CUSTOM_PARAMETERS = "selenium_parameter";
//input custom parameters value
public static final String INPUT_CUSTOM_PARAMETERS_VALUE = "selenium_parameter_123";
//input add custom parameters
public static final String INPUT_ADD_CUSTOM_PARAMETERS = "selenium_parameter_delete";
//input add custom parameters value
public static final String INPUT_ADD_CUSTOM_PARAMETERS_VALUE = "selenium_parameter_delete_456";
//create workflow title
public static final String WORKFLOW_TITLE = "创建流程定义 - DolphinScheduler";
}

2
e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateProjectData.java

@ -18,7 +18,7 @@ package org.apache.dolphinscheduler.data.project;
public class CreateProjectData { public class CreateProjectData {
// create project name // create project name
public static final String PROJECT_NAME = "selenium_project_3"; public static final String PROJECT_NAME = "selenium_project_1";
// create project description // create project description
public static final String DESCRIPTION = "test create project description"; public static final String DESCRIPTION = "test create project description";
// project page title // project page title

8
e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateWorkflowData.java

@ -21,7 +21,7 @@ public class CreateWorkflowData {
* create workflow data * create workflow data
*/ */
//input shell task name //input shell task name
public static final String SHELL_TASK_NAME = "shell_task_selenium_5"; public static final String SHELL_TASK_NAME = "shell_task_selenium_1";
//input shell task description //input shell task description
public static final String SHELL_TASK_DESCRIPTION = "shell task description test"; public static final String SHELL_TASK_DESCRIPTION = "shell task description test";
@ -44,8 +44,12 @@ public class CreateWorkflowData {
//input add custom parameters value //input add custom parameters value
public static final String INPUT_ADD_CUSTOM_PARAMETERS_VALUE = "selenium_parameter_delete_456"; public static final String INPUT_ADD_CUSTOM_PARAMETERS_VALUE = "selenium_parameter_delete_456";
//workflow define title
public static final String WORKFLOW_TITLE = "工作流定义 - DolphinScheduler";
//create workflow title //create workflow title
public static final String WORKFLOW_TITLE = "创建流程定义 - DolphinScheduler"; public static final String CREATE_WORKFLOW_TITLE = "创建流程定义 - DolphinScheduler";
/** /**
* save workflow data * save workflow data

8
e2e/src/test/java/org/apache/dolphinscheduler/data/security/TenantManageData.java

@ -25,12 +25,12 @@ public class TenantManageData {
/** /**
* Tenant Code * Tenant Code
*/ */
public static final String TENANAT_CODE = "dolphinscheduler_tenant_code15"; public static final String TENANT_CODE = "selenium_tenant_code_1";
/** /**
* Tenant Name * Tenant Name
*/ */
public static final String TENANAT_NAME = "dolphinscheduler_tenant_Name"; public static final String TENANT_NAME = "selenium_tenant_Name";
/** /**
* Queue * Queue
@ -40,9 +40,9 @@ public class TenantManageData {
/** /**
* Description * Description
*/ */
public static final String DESCRIPTION = "creat tenant test"; public static final String DESCRIPTION = "create tenant test";
public static final String TENANAT_MANAGE = "租户管理 - DolphinScheduler"; public static final String TENANT_MANAGE = "租户管理 - DolphinScheduler";

2
e2e/src/test/java/org/apache/dolphinscheduler/data/security/UserManageData.java

@ -18,7 +18,7 @@ package org.apache.dolphinscheduler.data.security;
public class UserManageData { public class UserManageData {
public static final String USERNAME = "selenium_5"; public static final String USERNAME = "selenium_user_1";
public static final String PASSWORD = "123456qwe"; public static final String PASSWORD = "123456qwe";

15
e2e/src/test/java/org/apache/dolphinscheduler/locator/project/CreateProjectLocator.java

@ -20,10 +20,15 @@ import org.openqa.selenium.By;
public class CreateProjectLocator { public class CreateProjectLocator {
//click project manage //click project manage
public static final By PROJECT_MANAGE = By.xpath("//div[2]/div/a/span"); // public static final By PROJECT_MANAGE = By.xpath("//div[@class='clearfix list'][2]");
public static final By PROJECT_MANAGE = By.xpath("//div[2]/div[2]/div/a/span");
// public static final By SECURITY_MANAGE = By.xpath("//div[@class='m-top']/div/div[2]/dev[@class='clearfix list'][6]");
public static final By SECURITY_MANAGE = By.xpath("//div[2]/div[6]/div/a/span");
//click create project button //click create project button
public static final By CREATE_PROJECT_BUTTON = By.xpath("//button/span"); public static final By CREATE_PROJECT_BUTTON = By.xpath("//div[2]/div/div[1]/button/span");
//input project name //input project name
public static final By PROJECT_NAME = By.xpath("//div[2]/div/div/div[2]/div/input"); public static final By PROJECT_NAME = By.xpath("//div[2]/div/div/div[2]/div/input");
@ -33,4 +38,10 @@ public class CreateProjectLocator {
//submit button //submit button
public static final By SUBMIT_BUTTON = By.xpath("//div[3]/button[2]/span"); public static final By SUBMIT_BUTTON = By.xpath("//div[3]/button[2]/span");
//delete project button
public static final By DELETE_PROJECT_BUTTON = By.xpath("//div[3]/div[1]/div/table/tr[2]/td[9]/span/button");
//confirm delete project button
public static final By CONFIRM_DELETE_PROJECT_BUTTON = By.xpath("//div[2]/div/button[2]/span");
} }

11
e2e/src/test/java/org/apache/dolphinscheduler/locator/project/CreateWorkflowLocator.java

@ -169,4 +169,15 @@ public class CreateWorkflowLocator {
//click add button //click add button
public static final By CLICK_ADD_BUTTON = By.xpath("//button[2]/span"); public static final By CLICK_ADD_BUTTON = By.xpath("//button[2]/span");
//scroll to element bottom
public static final By SCROLL_BOTTOM = By.xpath("//span/a/em");
/**
* delete workflow
*/
//click delete workflow button
public static final By DELETE_WORKFLOW_BOTTOM = By.xpath("//span/button/i");
//click confirm delete workflow button
public static final By CONFIRM_DELETE_WORKFLOW_BOTTOM = By.xpath("//div[2]/div/button[2]/span");
} }

2
e2e/src/test/java/org/apache/dolphinscheduler/locator/security/TenantManageLocator.java

@ -19,6 +19,8 @@ package org.apache.dolphinscheduler.locator.security;
import org.openqa.selenium.By; import org.openqa.selenium.By;
public class TenantManageLocator{ public class TenantManageLocator{
public static final By SECURITY_CENTER = By.xpath("//div[2]/div[6]/div/a/span/em");
public static final By TENANT_MANAGE = By.xpath("//div[2]/div/a/div/a/span"); public static final By TENANT_MANAGE = By.xpath("//div[2]/div/a/div/a/span");
public static final By CREATE_TENANT_BUTTON = By.xpath("//button/span"); public static final By CREATE_TENANT_BUTTON = By.xpath("//button/span");

3
e2e/src/test/java/org/apache/dolphinscheduler/page/LoginPage.java

@ -17,10 +17,8 @@
package org.apache.dolphinscheduler.page; package org.apache.dolphinscheduler.page;
import org.apache.dolphinscheduler.common.PageCommon; import org.apache.dolphinscheduler.common.PageCommon;
import org.apache.dolphinscheduler.constant.TestConstant;
import org.apache.dolphinscheduler.data.LoginData; import org.apache.dolphinscheduler.data.LoginData;
import org.apache.dolphinscheduler.locator.LoginLocator; import org.apache.dolphinscheduler.locator.LoginLocator;
import org.apache.dolphinscheduler.util.RedisUtil;
import org.openqa.selenium.Cookie; import org.openqa.selenium.Cookie;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
@ -49,7 +47,6 @@ public class LoginPage extends PageCommon {
public void jumpPageChinese() { public void jumpPageChinese() {
super.jumpPage(LoginData.URL); super.jumpPage(LoginData.URL);
Cookie cookie = new Cookie("language", "zh_CN", "/", null); Cookie cookie = new Cookie("language", "zh_CN", "/", null);
driver.manage().addCookie(cookie); driver.manage().addCookie(cookie);
} }
/** /**

33
e2e/src/test/java/org/apache/dolphinscheduler/page/project/CreateProjectPage.java

@ -28,23 +28,22 @@ public class CreateProjectPage extends PageCommon {
} }
/** /**
* jump page * jump to ProjectManagePage
*/ */
public void jumpProjectManagePage() throws InterruptedException { public boolean jumpProjectManagePage() throws InterruptedException {
Thread.sleep(TestConstant.ONE_THOUSANG); Thread.sleep(TestConstant.THREE_THOUSAND);
clickElement(CreateProjectLocator.PROJECT_MANAGE); clickTopElement(CreateProjectLocator.PROJECT_MANAGE);
Thread.sleep(TestConstant.ONE_THOUSANG); Thread.sleep(TestConstant.ONE_THOUSAND);
return ifTitleContains(CreateProjectData.PROJECT_TITLE);
} }
/** /**
* createTenant * create project
* *
* @return Whether to enter the specified page after creat tenant * @return Whether to enter the specified page after create project
*/ */
public boolean createProject() throws InterruptedException { public boolean createProject() throws InterruptedException {
//click create project
clickElement(CreateProjectLocator.CREATE_PROJECT_BUTTON); clickElement(CreateProjectLocator.CREATE_PROJECT_BUTTON);
Thread.sleep(TestConstant.ONE_THOUSANG);
// input create project data // input create project data
sendInput(CreateProjectLocator.PROJECT_NAME, CreateProjectData.PROJECT_NAME); sendInput(CreateProjectLocator.PROJECT_NAME, CreateProjectData.PROJECT_NAME);
@ -56,4 +55,20 @@ public class CreateProjectPage extends PageCommon {
// Whether to enter the specified page after submit // Whether to enter the specified page after submit
return ifTitleContains(CreateProjectData.PROJECT_TITLE); return ifTitleContains(CreateProjectData.PROJECT_TITLE);
} }
/**
* delete project
*
* @return Whether to enter the specified page after delete project
*/
public boolean deleteProject() throws InterruptedException {
//click delete project
clickElement(CreateProjectLocator.DELETE_PROJECT_BUTTON);
//click confirm delete project
clickElement(CreateProjectLocator.CONFIRM_DELETE_PROJECT_BUTTON);
// Whether to enter the specified page after submit
return ifTitleContains(CreateProjectData.PROJECT_TITLE);
}
} }

41
e2e/src/test/java/org/apache/dolphinscheduler/page/project/CreateWorkflowPage.java

@ -30,22 +30,23 @@ public class CreateWorkflowPage extends PageCommon {
/** /**
* jump create workflow page * jump create workflow page
*/ */
public boolean createWorkflow() throws InterruptedException {
System.out.println("Click on the project name to jump to the project homepage"); public boolean jumpWorkflowPage() throws InterruptedException {
// click project name // click project name
clickElement(CreateWorkflowLocator.CLICK_PROJECT_NAME); clickElement(CreateWorkflowLocator.CLICK_PROJECT_NAME);
Thread.sleep(TestConstant.ONE_THOUSANG); Thread.sleep(TestConstant.ONE_THOUSAND);
System.out.println("Click on workflow define"); System.out.println("Click on workflow define to jump to workflow define page");
// click workflow define // click workflow define
clickElement(CreateWorkflowLocator.CLICK_WORKFLOW_DEFINE); clickElement(CreateWorkflowLocator.CLICK_WORKFLOW_DEFINE);
Thread.sleep(TestConstant.ONE_THOUSANG);
return ifTitleContains(CreateWorkflowData.WORKFLOW_TITLE);
}
public boolean createWorkflow() throws InterruptedException {
System.out.println("Click create workflow button"); System.out.println("Click create workflow button");
// click create workflow button // click create workflow button
clickElement(CreateWorkflowLocator.CLICK_CREATE_WORKFLOW_BUTTON); clickElement(CreateWorkflowLocator.CLICK_CREATE_WORKFLOW_BUTTON);
Thread.sleep(TestConstant.ONE_THOUSANG);
System.out.println("drag shell task"); System.out.println("drag shell task");
//drag shell_task //drag shell_task
@ -98,8 +99,7 @@ public class CreateWorkflowPage extends PageCommon {
//click codeMirror and input script //click codeMirror and input script
inputCodeMirror(CreateWorkflowLocator.CLICK_CODE_MIRROR, CreateWorkflowLocator.INPUT_SCRIPT, CreateWorkflowData.SHELL_SCRIPT); inputCodeMirror(CreateWorkflowLocator.CLICK_CODE_MIRROR, CreateWorkflowLocator.INPUT_SCRIPT, CreateWorkflowData.SHELL_SCRIPT);
scrollToElementBottom(); scrollToElementBottom(CreateWorkflowLocator.SCROLL_BOTTOM);
Thread.sleep(TestConstant.ONE_THOUSANG);
//click custom parameters //click custom parameters
clickElement(CreateWorkflowLocator.CLICK_CUSTOM_PARAMETERS); clickElement(CreateWorkflowLocator.CLICK_CUSTOM_PARAMETERS);
@ -113,8 +113,7 @@ public class CreateWorkflowPage extends PageCommon {
//click add custom parameters //click add custom parameters
clickElement(CreateWorkflowLocator.CLICK_ADD_CUSTOM_PARAMETERS); clickElement(CreateWorkflowLocator.CLICK_ADD_CUSTOM_PARAMETERS);
scrollToElementBottom(); scrollToElementBottom(CreateWorkflowLocator.SCROLL_BOTTOM);
Thread.sleep(TestConstant.ONE_THOUSANG);
//input add custom parameters //input add custom parameters
sendInput(CreateWorkflowLocator.INPUT_ADD_CUSTOM_PARAMETERS, CreateWorkflowData.INPUT_ADD_CUSTOM_PARAMETERS); sendInput(CreateWorkflowLocator.INPUT_ADD_CUSTOM_PARAMETERS, CreateWorkflowData.INPUT_ADD_CUSTOM_PARAMETERS);
@ -124,16 +123,15 @@ public class CreateWorkflowPage extends PageCommon {
//click delete custom parameters //click delete custom parameters
clickElement(CreateWorkflowLocator.CLICK_DELETE_CUSTOM_PARAMETERS); clickElement(CreateWorkflowLocator.CLICK_DELETE_CUSTOM_PARAMETERS);
Thread.sleep(TestConstant.ONE_THOUSANG);
//click submit button //click submit button
clickElement(CreateWorkflowLocator.CLICK_SUBMIT_BUTTON); clickElement(CreateWorkflowLocator.CLICK_SUBMIT_BUTTON);
Thread.sleep(TestConstant.ONE_THOUSANG); Thread.sleep(TestConstant.ONE_THOUSAND);
System.out.println("Task node set up successfully"); System.out.println("Task node set up successfully");
System.out.println("move to Dag Element "); System.out.println("move to Dag Element ");
moveToDragElement(CreateWorkflowLocator.MOUSE_MOVE_SHELL_AT_DAG,-300,-100); moveToDragElement(CreateWorkflowLocator.MOUSE_MOVE_SHELL_AT_DAG,-300,-100);
return ifTitleContains(CreateWorkflowData.WORKFLOW_TITLE); return ifTitleContains(CreateWorkflowData.CREATE_WORKFLOW_TITLE);
} }
/** /**
@ -182,11 +180,22 @@ public class CreateWorkflowPage extends PageCommon {
//delete workflow global parameters value //delete workflow global parameters value
clickElement(CreateWorkflowLocator.CLICK_DELETE_WORKFLOW_GLOBAL_PARAMETERS); clickElement(CreateWorkflowLocator.CLICK_DELETE_WORKFLOW_GLOBAL_PARAMETERS);
Thread.sleep(TestConstant.ONE_THOUSANG); Thread.sleep(TestConstant.ONE_THOUSAND);
//click add button //click add button
clickElement(CreateWorkflowLocator.CLICK_ADD_BUTTON); clickButton(CreateWorkflowLocator.CLICK_ADD_BUTTON);
System.out.println("submit workflow"); System.out.println("submit workflow");
return ifTitleContains(CreateWorkflowData.CREATE_WORKFLOW_TITLE);
}
public boolean deleteWorkflow() throws InterruptedException {
//click delete project
clickButton(CreateWorkflowLocator.DELETE_WORKFLOW_BOTTOM);
//click confirm delete project
clickButton(CreateWorkflowLocator.CONFIRM_DELETE_WORKFLOW_BOTTOM);
// Whether to enter the specified page after submit
return ifTitleContains(CreateWorkflowData.WORKFLOW_TITLE); return ifTitleContains(CreateWorkflowData.WORKFLOW_TITLE);
} }
} }

28
e2e/src/test/java/org/apache/dolphinscheduler/page/security/TenantManagePage.java

@ -17,12 +17,8 @@
package org.apache.dolphinscheduler.page.security; package org.apache.dolphinscheduler.page.security;
import org.apache.dolphinscheduler.common.PageCommon; import org.apache.dolphinscheduler.common.PageCommon;
import org.apache.dolphinscheduler.constant.TestConstant;
import org.apache.dolphinscheduler.data.LoginData;
import org.apache.dolphinscheduler.data.security.TenantManageData; import org.apache.dolphinscheduler.data.security.TenantManageData;
import org.apache.dolphinscheduler.locator.LoginLocator;
import org.apache.dolphinscheduler.locator.security.TenantManageLocator; import org.apache.dolphinscheduler.locator.security.TenantManageLocator;
import org.apache.dolphinscheduler.util.RedisUtil;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
public class TenantManagePage extends PageCommon { public class TenantManagePage extends PageCommon {
@ -34,21 +30,30 @@ public class TenantManagePage extends PageCommon {
super(driver); super(driver);
} }
/**
* jump security page
*
* @return Whether to enter the specified page after create tenant
*/
public boolean jumpSecurity() throws InterruptedException {
clickTopElement(TenantManageLocator.SECURITY_CENTER);
return ifTitleContains(TenantManageData.TENANT_MANAGE);
}
/** /**
* createTenant * createTenant
* *
* @return Whether to enter the specified page after creat tenant * @return Whether to enter the specified page after create tenant
*/ */
public boolean createTenant() throws InterruptedException { public boolean createTenant() throws InterruptedException {
Thread.sleep(TestConstant.ONE_THOUSANG);
clickButton(TenantManageLocator.TENANT_MANAGE); clickButton(TenantManageLocator.TENANT_MANAGE);
//create tenant //create tenant
clickButton(TenantManageLocator.CREATE_TENANT_BUTTON); clickButton(TenantManageLocator.CREATE_TENANT_BUTTON);
// tenant data // tenant data
sendInput(TenantManageLocator.TENANT_INPUT_CODE, TenantManageData.TENANAT_CODE); sendInput(TenantManageLocator.TENANT_INPUT_CODE, TenantManageData.TENANT_CODE);
sendInput(TenantManageLocator.TENANT_INPUT_NAME, TenantManageData.TENANAT_NAME); sendInput(TenantManageLocator.TENANT_INPUT_NAME, TenantManageData.TENANT_NAME);
sendInput(TenantManageLocator.QUEUE, TenantManageData.QUEUE); sendInput(TenantManageLocator.QUEUE, TenantManageData.QUEUE);
sendInput(TenantManageLocator.DESCRIPTION, TenantManageData.DESCRIPTION); sendInput(TenantManageLocator.DESCRIPTION, TenantManageData.DESCRIPTION);
@ -56,22 +61,19 @@ public class TenantManagePage extends PageCommon {
clickButton(TenantManageLocator.SUBMIT_BUTTON); clickButton(TenantManageLocator.SUBMIT_BUTTON);
// Whether to enter the specified page after submit // Whether to enter the specified page after submit
return ifTitleContains(TenantManageData.TENANAT_MANAGE); return ifTitleContains(TenantManageData.TENANT_MANAGE);
} }
public boolean deleteTenant() throws InterruptedException { public boolean deleteTenant() throws InterruptedException {
Thread.sleep(TestConstant.ONE_THOUSANG);
clickButton(TenantManageLocator.TENANT_MANAGE); clickButton(TenantManageLocator.TENANT_MANAGE);
Thread.sleep(TestConstant.ONE_THOUSANG);
// click delete button // click delete button
clickButton(TenantManageLocator.DELETE_TENANT_BUTTON); clickButton(TenantManageLocator.DELETE_TENANT_BUTTON);
Thread.sleep(TestConstant.ONE_THOUSANG);
//click confirm delete button //click confirm delete button
clickButton(TenantManageLocator.CONFIRM_DELETE_TENANT_BUTTON); clickButton(TenantManageLocator.CONFIRM_DELETE_TENANT_BUTTON);
// Whether to enter the specified page after submit // Whether to enter the specified page after submit
return ifTitleContains(TenantManageData.TENANAT_MANAGE); return ifTitleContains(TenantManageData.TENANT_MANAGE);
} }
} }

6
e2e/src/test/java/org/apache/dolphinscheduler/page/security/UserManagePage.java

@ -17,7 +17,6 @@
package org.apache.dolphinscheduler.page.security; package org.apache.dolphinscheduler.page.security;
import org.apache.dolphinscheduler.common.PageCommon; import org.apache.dolphinscheduler.common.PageCommon;
import org.apache.dolphinscheduler.constant.TestConstant;
import org.apache.dolphinscheduler.data.security.UserManageData; import org.apache.dolphinscheduler.data.security.UserManageData;
import org.apache.dolphinscheduler.locator.security.UserManageLocator; import org.apache.dolphinscheduler.locator.security.UserManageLocator;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
@ -33,10 +32,8 @@ public class UserManagePage extends PageCommon {
* @return Whether to enter the specified page after creat tenant * @return Whether to enter the specified page after creat tenant
*/ */
public boolean createUser() throws InterruptedException { public boolean createUser() throws InterruptedException {
Thread.sleep(TestConstant.ONE_THOUSANG);
// click user manage // click user manage
clickElement(UserManageLocator.CLICK_USER_MANAGE); clickElement(UserManageLocator.CLICK_USER_MANAGE);
Thread.sleep(TestConstant.ONE_THOUSANG);
// click create user button // click create user button
clickButton(UserManageLocator.CLICK_CREATE_USER_BUTTON); clickButton(UserManageLocator.CLICK_CREATE_USER_BUTTON);
@ -59,10 +56,9 @@ public class UserManagePage extends PageCommon {
} }
public boolean deleteUser() throws InterruptedException { public boolean deleteUser() throws InterruptedException {
Thread.sleep(TestConstant.ONE_THOUSANG);
// click user manage // click user manage
clickElement(UserManageLocator.CLICK_USER_MANAGE); clickElement(UserManageLocator.CLICK_USER_MANAGE);
Thread.sleep(TestConstant.ONE_THOUSANG);
// click delete user button // click delete user button
clickButton(UserManageLocator.DELETE_USER_BUTTON ); clickButton(UserManageLocator.DELETE_USER_BUTTON );

1
e2e/src/test/java/org/apache/dolphinscheduler/testcase/LoginTest.java

@ -17,7 +17,6 @@
package org.apache.dolphinscheduler.testcase; package org.apache.dolphinscheduler.testcase;
import org.apache.dolphinscheduler.page.LoginPage; import org.apache.dolphinscheduler.page.LoginPage;
import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import static org.apache.dolphinscheduler.base.BaseTest.driver; import static org.apache.dolphinscheduler.base.BaseTest.driver;

39
e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteProjectTest.java

@ -0,0 +1,39 @@
/*
* 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.dolphinscheduler.testcase.deleteData;
import org.apache.dolphinscheduler.base.BaseTest;
import org.apache.dolphinscheduler.page.project.CreateProjectPage;
import org.testng.annotations.Test;
public class DeleteProjectTest extends BaseTest {
private CreateProjectPage createProjectPage;
@Test(groups={"functionTests"},dependsOnGroups = { "login","project"},description = "DeleteProjectTest",priority=7)
public void testDeleteProject() throws InterruptedException {
createProjectPage = new CreateProjectPage(driver);
//jump to project manage page
System.out.println("jump to the project manage page to delete project");
createProjectPage.jumpProjectManagePage();
//assert tenant manage page
System.out.println("start delete project");
assert createProjectPage.deleteProject();
System.out.println("end delete project");
System.out.println("===================================");
}
}

7
e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteTenantTest.java

@ -23,15 +23,16 @@ import org.testng.annotations.Test;
public class DeleteTenantTest extends BaseTest { public class DeleteTenantTest extends BaseTest {
private TenantManagePage tenantManagePage; private TenantManagePage tenantManagePage;
@Test(groups={"functionTests"},dependsOnGroups = { "login","createTenant"},description = "DeleteTenantTest") @Test(groups={"functionTests"},dependsOnGroups = { "login","createTenant"},description = "DeleteTenantTest",priority=9)
public void testDeleteTenant() throws InterruptedException { public void testDeleteTenant() throws InterruptedException {
tenantManagePage = new TenantManagePage(driver); tenantManagePage = new TenantManagePage(driver);
//assert tenant manage page //assert tenant manage page
System.out.println("jump to security to delete tenant");
tenantManagePage.jumpSecurity();
System.out.println("start delete tenant"); System.out.println("start delete tenant");
assert tenantManagePage.deleteTenant(); assert tenantManagePage.deleteTenant();
System.out.println("end delete tenant"); System.out.println("end delete tenant");
System.out.println("==================================="); System.out.println("===================================");
} }
} }

8
e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteUserTest.java

@ -17,14 +17,20 @@
package org.apache.dolphinscheduler.testcase.deleteData; package org.apache.dolphinscheduler.testcase.deleteData;
import org.apache.dolphinscheduler.base.BaseTest; import org.apache.dolphinscheduler.base.BaseTest;
import org.apache.dolphinscheduler.page.security.TenantManagePage;
import org.apache.dolphinscheduler.page.security.UserManagePage; import org.apache.dolphinscheduler.page.security.UserManagePage;
import org.testng.annotations.Test; import org.testng.annotations.Test;
public class DeleteUserTest extends BaseTest { public class DeleteUserTest extends BaseTest {
private UserManagePage userManagePage; private UserManagePage userManagePage;
private TenantManagePage tenantManagePage;
@Test(groups={"functionTests"},dependsOnGroups = { "login","user" },description = "DeleteUserTest") @Test(groups={"functionTests"},dependsOnGroups = { "login","user" },description = "DeleteUserTest",priority=8)
public void testDeleteUser() throws InterruptedException { public void testDeleteUser() throws InterruptedException {
tenantManagePage = new TenantManagePage(driver);
System.out.println("jump to security to delete user");
tenantManagePage.jumpSecurity();
userManagePage = new UserManagePage(driver); userManagePage = new UserManagePage(driver);
//assert user manage page //assert user manage page
System.out.println("start delete user"); System.out.println("start delete user");

43
e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteWorkflowTest.java

@ -0,0 +1,43 @@
/*
* 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.dolphinscheduler.testcase.deleteData;
import org.apache.dolphinscheduler.base.BaseTest;
import org.apache.dolphinscheduler.page.project.CreateProjectPage;
import org.apache.dolphinscheduler.page.project.CreateWorkflowPage;
import org.testng.annotations.Test;
public class DeleteWorkflowTest extends BaseTest {
private CreateWorkflowPage createWorkflowPage;
private CreateProjectPage createProjectPage;
@Test(groups={"functionTests"},dependsOnGroups = { "login","workflow"},description = "DeleteWorkflowTest",priority=6)
public void testDeleteWorkflow() throws InterruptedException {
createProjectPage = new CreateProjectPage(driver);
//jump to project manage page
System.out.println("jump to the project manage page to delete workflow");
createProjectPage.jumpProjectManagePage();
createWorkflowPage = new CreateWorkflowPage(driver);
createWorkflowPage.jumpWorkflowPage();
//assert tenant manage page
System.out.println("start delete workflow");
assert createWorkflowPage.deleteWorkflow();
System.out.println("end delete workflow");
System.out.println("===================================");
}
}

3
e2e/src/test/java/org/apache/dolphinscheduler/testcase/project/CreateProjectTest.java

@ -23,10 +23,11 @@ import org.testng.annotations.Test;
public class CreateProjectTest extends BaseTest { public class CreateProjectTest extends BaseTest {
private CreateProjectPage createProjectPage; private CreateProjectPage createProjectPage;
@Test(groups={"functionTests"},dependsOnGroups = { "login" },description = "CreateProjectTest",priority=4) @Test(groups={"functionTests","project"},dependsOnGroups = { "login" },description = "CreateProjectTest",priority=4)
public void testCreateProject() throws InterruptedException { public void testCreateProject() throws InterruptedException {
createProjectPage = new CreateProjectPage(driver); createProjectPage = new CreateProjectPage(driver);
// enter user manage page // enter user manage page
System.out.println("jump to the projectManage page to create project ");
createProjectPage.jumpProjectManagePage(); createProjectPage.jumpProjectManagePage();
//assert user manage page //assert user manage page
System.out.println("start create project"); System.out.println("start create project");

6
e2e/src/test/java/org/apache/dolphinscheduler/testcase/project/CreateWorkflowTest.java

@ -26,12 +26,16 @@ public class CreateWorkflowTest extends BaseTest {
private CreateProjectPage createProjectPage; private CreateProjectPage createProjectPage;
@Test(groups={"functionTests"},dependsOnGroups = { "login" },description = "CreateWorkflowTest",priority=5) @Test(groups={"functionTests","workflow"},dependsOnGroups = { "login" },description = "CreateWorkflowTest",priority=5)
public void testCreateWorkflow() throws InterruptedException { public void testCreateWorkflow() throws InterruptedException {
createProjectPage = new CreateProjectPage(driver); createProjectPage = new CreateProjectPage(driver);
System.out.println("jump to the projectManage page to create workflow");
createProjectPage.jumpProjectManagePage(); createProjectPage.jumpProjectManagePage();
createWorkflowPage = new CreateWorkflowPage(driver); createWorkflowPage = new CreateWorkflowPage(driver);
System.out.println("Click on the project name to jump to the project homepage");
createWorkflowPage.jumpWorkflowPage();
System.out.println("start create workflow"); System.out.println("start create workflow");
assert createWorkflowPage.createWorkflow(); assert createWorkflowPage.createWorkflow();
assert createWorkflowPage.saveWorkflow(); assert createWorkflowPage.saveWorkflow();

5
e2e/src/test/java/org/apache/dolphinscheduler/testcase/security/TenantManageTest.java

@ -24,7 +24,7 @@ import org.testng.annotations.Test;
public class TenantManageTest extends BaseTest { public class TenantManageTest extends BaseTest {
private TenantManagePage tenantManagePage; private TenantManagePage tenantManagePage;
@Test(groups={"functionTests","createTenant"},dependsOnGroups = { "login" },description = "TenantManageTest") @Test(groups={"functionTests","createTenant"},dependsOnGroups = { "login" },description = "TenantManageTest",priority=2)
public void testTenantManage() throws InterruptedException { public void testTenantManage() throws InterruptedException {
tenantManagePage = new TenantManagePage(driver); tenantManagePage = new TenantManagePage(driver);
//assert tenant manage page //assert tenant manage page
@ -32,8 +32,5 @@ public class TenantManageTest extends BaseTest {
assert tenantManagePage.createTenant(); assert tenantManagePage.createTenant();
System.out.println("end create tenant"); System.out.println("end create tenant");
System.out.println("==================================="); System.out.println("===================================");
} }
} }

2
e2e/src/test/java/org/apache/dolphinscheduler/testcase/security/UserManageTest.java

@ -23,7 +23,7 @@ import org.testng.annotations.Test;
public class UserManageTest extends BaseTest { public class UserManageTest extends BaseTest {
private UserManagePage userManagePage; private UserManagePage userManagePage;
@Test(groups={"functionTests","user"},dependsOnGroups = { "login" },description = "UserManageTest") @Test(groups={"functionTests","user"},dependsOnGroups = { "login" },description = "UserManageTest",priority=3)
public void testUserManage() throws InterruptedException { public void testUserManage() throws InterruptedException {
userManagePage = new UserManagePage(driver); userManagePage = new UserManagePage(driver);
//assert user manage page //assert user manage page

10
e2e/testng.xml

@ -20,7 +20,7 @@
<test name="dolphinscheduler_test" preserve-order="true"> <test name="dolphinscheduler_test" preserve-order="true">
<groups> <groups>
<run> <run>
<include name="functionTests" /> <include name="functionTests"/>
</run> </run>
</groups> </groups>
@ -28,10 +28,12 @@
<class name="org.apache.dolphinscheduler.testcase.LoginTest"></class> <class name="org.apache.dolphinscheduler.testcase.LoginTest"></class>
<class name="org.apache.dolphinscheduler.testcase.security.TenantManageTest"></class> <class name="org.apache.dolphinscheduler.testcase.security.TenantManageTest"></class>
<class name="org.apache.dolphinscheduler.testcase.security.UserManageTest"></class> <class name="org.apache.dolphinscheduler.testcase.security.UserManageTest"></class>
<!--<class name="org.apache.dolphinscheduler.testcase.project.CreateProjectTest"></class>--> <class name="org.apache.dolphinscheduler.testcase.project.CreateProjectTest"></class>
<!--&lt;!&ndash;<class name="org.apache.dolphinscheduler.testcase.project.CreateWorkflowTest"></class>&ndash;&gt;--> <class name="org.apache.dolphinscheduler.testcase.project.CreateWorkflowTest"></class>
<class name="org.apache.dolphinscheduler.testcase.deleteData.DeleteTenantTest"></class> <class name="org.apache.dolphinscheduler.testcase.deleteData.DeleteWorkflowTest"></class>
<class name="org.apache.dolphinscheduler.testcase.deleteData.DeleteProjectTest"></class>
<class name="org.apache.dolphinscheduler.testcase.deleteData.DeleteUserTest"></class> <class name="org.apache.dolphinscheduler.testcase.deleteData.DeleteUserTest"></class>
<class name="org.apache.dolphinscheduler.testcase.deleteData.DeleteTenantTest"></class>
</classes> </classes>
</test> </test>

Loading…
Cancel
Save