Browse Source

e2e add the case of deleting user and tenant   (#2210)

* add e2e
pull/3/MERGE
xingchun-chen 5 years ago committed by gaojun2048
parent
commit
7c54496f5a
  1. 8
      e2e/src/test/java/org/apache/dolphinscheduler/base/BaseDriver.java
  2. 17
      e2e/src/test/java/org/apache/dolphinscheduler/base/BaseTest.java
  3. 2
      e2e/src/test/java/org/apache/dolphinscheduler/data/LoginData.java
  4. 2
      e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreatWorkflowData.java
  5. 4
      e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateProjectData.java
  6. 73
      e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateWorkflowData.java
  7. 10
      e2e/src/test/java/org/apache/dolphinscheduler/data/security/TenantManageData.java
  8. 5
      e2e/src/test/java/org/apache/dolphinscheduler/data/security/UserManageData.java
  9. 69
      e2e/src/test/java/org/apache/dolphinscheduler/locator/project/CreateWorkflowLocator.java
  10. 8
      e2e/src/test/java/org/apache/dolphinscheduler/locator/security/TenantManageLocator.java
  11. 3
      e2e/src/test/java/org/apache/dolphinscheduler/locator/security/UserManageLocator.java
  12. 14
      e2e/src/test/java/org/apache/dolphinscheduler/page/LoginPage.java
  13. 11
      e2e/src/test/java/org/apache/dolphinscheduler/page/project/CreateProjectPage.java
  14. 89
      e2e/src/test/java/org/apache/dolphinscheduler/page/project/CreateWorkflowPage.java
  15. 26
      e2e/src/test/java/org/apache/dolphinscheduler/page/security/TenantManagePage.java
  16. 25
      e2e/src/test/java/org/apache/dolphinscheduler/page/security/UserManagePage.java
  17. 35
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/LoginTest.java
  18. 37
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteTenantTest.java
  19. 36
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteUserTest.java
  20. 7
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/project/CreateProjectTest.java
  21. 10
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/project/CreateWorkflowTest.java
  22. 11
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/security/TenantManageTest.java
  23. 8
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/security/UserManageTest.java
  24. 18
      e2e/suite.xml
  25. 28
      e2e/testng.xml

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

@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.base;
import org.apache.dolphinscheduler.constant.TestConstant;
import org.apache.dolphinscheduler.util.PropertiesReader;
import org.openqa.selenium.Cookie;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
@ -35,7 +36,7 @@ public class BaseDriver {
/**
* driver
*/
private WebDriver driver;
private static WebDriver driver;
/**
* chrome driver path
@ -88,6 +89,7 @@ public class BaseDriver {
chromeOptions.setPageLoadStrategy(PageLoadStrategy.NONE);
chromeOptions.addArguments("--no-sandbox");
chromeOptions.addArguments("--disable-dev-shm-usage");
//Browser client running requires annotation --headless
chromeOptions.addArguments("--headless");
chromeOptions.addArguments("--disable-gpu");
chromeOptions.addArguments("--whitelisted-ips");
@ -120,7 +122,7 @@ public class BaseDriver {
*
* @return driver
*/
public WebDriver getDriver() {
public static WebDriver getDriver() {
return driver;
}
@ -141,7 +143,7 @@ public class BaseDriver {
public void closeBrowser() throws InterruptedException {
// JS Show a pop-up box to indicate the end of the test
Thread.sleep(TestConstant.ONE_THOUSANG);
((JavascriptExecutor) driver).executeScript("alert('Test completed, browser closes after 3s')");
// ((JavascriptExecutor) driver).executeScript("alert('Test completed, browser closes after 3s')");
Thread.sleep(TestConstant.THREE_THOUSANG);
if (driver != null) {
driver.quit();

17
e2e/src/test/java/org/apache/dolphinscheduler/base/BaseTest.java

@ -17,7 +17,6 @@
package org.apache.dolphinscheduler.base;
import org.apache.dolphinscheduler.page.LoginPage;
import org.apache.dolphinscheduler.util.PropertiesReader;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.*;
@ -28,6 +27,7 @@ import java.util.Properties;
/**
* base test class
*/
@Test(groups={"functionTests"})
public class BaseTest {
/**
* properties
@ -43,7 +43,7 @@ public class BaseTest {
/**
* driver
*/
public WebDriver driver;
public static WebDriver driver;
/**
* Executed before executing a test suite 
@ -54,7 +54,7 @@ public class BaseTest {
*/
@BeforeSuite(alwaysRun = true)
@Parameters({"propertiesPath"})
public void beforeSuite(@Optional("src/test/resources/config/config.properties") String propertiesPath) throws IOException {
public void beforeSuite(@Optional("src/test/resources/config/config.properties") String propertiesPath) throws Exception {
// read properties
properties = PropertiesReader.readProperties(propertiesPath);
}
@ -70,14 +70,13 @@ public class BaseTest {
driver = baseDriver.getDriver();
}
/**
* Executed before executing a class method in a test case
*/
@BeforeClass(alwaysRun = true)
public void setUp() throws IOException, InterruptedException {
LoginPage loginPage = new LoginPage(driver);
loginPage.jumpPage();
loginPage.login();
public void setUp() throws Exception {
}
@ -85,7 +84,7 @@ public class BaseTest {
* Execute after executing a class method in a test case
*/
@AfterClass(alwaysRun = true)
public void afterClass() {
public void afterClass() throws InterruptedException {
// logout
}
@ -102,6 +101,6 @@ public class BaseTest {
* Execute after executing a testsuite
*/
@AfterSuite(alwaysRun = true)
public void afterSuite() {
public void afterSuite() throws InterruptedException {
}
}

2
e2e/src/test/java/org/apache/dolphinscheduler/data/LoginData.java

@ -39,5 +39,5 @@ public class LoginData {
*/
public static final String PASSWORD = PropertiesReader.getKey("PASSWORD");
public static final String TENANT = "Tenant Manage - DolphinScheduler";
public static final String TENANT = "租户管理 - DolphinScheduler";
}

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

@ -18,7 +18,7 @@ package org.apache.dolphinscheduler.data.project;
public class CreatWorkflowData {
//input shell task name
public static final String SHELL_TASK_NAME = "shell task description test";
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";

4
e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreatProjectData.java → e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateProjectData.java

@ -16,9 +16,9 @@
*/
package org.apache.dolphinscheduler.data.project;
public class CreatProjectData {
public class CreateProjectData {
// create project name
public static final String PROJECT_NAME = "selenium_project";
public static final String PROJECT_NAME = "selenium_project_3";
// create project description
public static final String DESCRIPTION = "test create project description";
// project page title

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

@ -0,0 +1,73 @@
/*
* 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 CreateWorkflowData {
/**
* create workflow data
*/
//input shell task name
public static final String SHELL_TASK_NAME = "shell_task_selenium_5";
//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";
/**
* save workflow data
*/
//input workflow name
public static final String INPUT_WORKFLOW_NAME = "selenium_shell_1";
//input workflow description
public static final String INPUT_WORKFLOW_DESCRIPTION = "test selenium_shell_1 description";
//input workflow timeout
public static final String INPUT_WORKFLOW_TIMEOUT = "30";
//input workflow global parameters
public static final String INPUT_WORKFLOW_GLOBAL_PARAMETERS = "selenium_global_parameters_1";
//input workflow global parameters value
public static final String INPUT_WORKFLOW_GLOBAL_PARAMETERS_VALUES = "selenium_global_parameters_value_1";
//input to add workflow global parameters
public static final String INPUT_ADD_WORKFLOW_GLOBAL_PARAMETERS = "selenium_global_parameters_2";
//input to add workflow global parameters value
public static final String INPUT_ADD_WORKFLOW_GLOBAL_PARAMETERS_VALUES = "selenium_global_parameters_value_2";
}

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

@ -20,18 +20,12 @@
*/
package org.apache.dolphinscheduler.data.security;
import org.apache.dolphinscheduler.data.LoginData;
public class TenantManageData {
/**
* Tenant URL
*/
public static final String TENANAT_URL = LoginData.URL + "/ui/#/security/tenant";
/**
* Tenant Code
*/
public static final String TENANAT_CODE = "dolphinscheduler_tenant_code2";
public static final String TENANAT_CODE = "dolphinscheduler_tenant_code15";
/**
* Tenant Name
@ -48,7 +42,7 @@ public class TenantManageData {
*/
public static final String DESCRIPTION = "creat tenant test";
public static final String TENANAT_MANAGE = "Tenant Manage - DolphinScheduler";
public static final String TENANAT_MANAGE = "租户管理 - DolphinScheduler";

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

@ -16,12 +16,9 @@
*/
package org.apache.dolphinscheduler.data.security;
import org.apache.dolphinscheduler.data.LoginData;
public class UserManageData {
public static final String USER_URL = LoginData.URL + "/ui/#/security/users";
public static final String USERNAME = "selenium111";
public static final String USERNAME = "selenium_5";
public static final String PASSWORD = "123456qwe";

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

@ -20,12 +20,20 @@ package org.apache.dolphinscheduler.locator.project;
import org.openqa.selenium.By;
public class CreateWorkflowLocator {
/**
* jump workflow define page
*/
// click project name
public static final By CLICK_PROJECT_NAME = By.xpath("//span/a");
// click workflow define
public static final By CLICK_WORKFLOW_DEFINE = By.xpath("//li/span");
/**
* create workflow
*/
// click create workflow button
public static final By CLICK_CREATE_WORKFLOW_BUTTON = By.xpath("//button/span");
@ -96,15 +104,15 @@ public class CreateWorkflowLocator {
public static final By INPUT_CUSTOM_PARAMETERS = By.xpath("//div[2]/div/div/div/div/div/input");
//input custom parameters value
public static final By INPUT_CUSTOM_PARAMETERS_VALUE = By.xpath("//div[2]/input");
public static final By INPUT_CUSTOM_PARAMETERS_VALUE = By.xpath("//div[2]/div/div/div/div[1]/div[2]/input");
//click add custom parameters
public static final By CLICK_ADD_CUSTOM_PARAMETERS = By.xpath("//span[2]/a/em");
//click to add custom parameters
public static final By CLICK_ADD_CUSTOM_PARAMETERS = By.xpath("//div[2]/div/div/div/div/span[2]/a/em");
//input add custom parameters
public static final By INPUT_ADD_CUSTOM_PARAMETERS = By.xpath("//div[2]/div/div/div/div[2]/div/input");
//input to add custom parameters
public static final By INPUT_ADD_CUSTOM_PARAMETERS = By.xpath("//div[2]/div/div/div/div[2]/div[1]/input");
//input add custom parameters value
//input to add custom parameters value
public static final By INPUT_ADD_CUSTOM_PARAMETERS_VALUE = By.xpath("//div[2]/div[2]/input");
//delete custom parameters
@ -112,4 +120,53 @@ public class CreateWorkflowLocator {
//click submit button
public static final By CLICK_SUBMIT_BUTTON = By.xpath("//button[2]/span");
/**
* save workflow
*/
//click save workflow button
public static final By CLICK_SAVE_WORKFLOW_BUTTON = By.xpath("//button/span");
//input workflow name
public static final By INPUT_WORKFLOW_NAME = By.xpath("//input");
//input workflow description
public static final By INPUT_WORKFLOW_DESCRIPTION = By.xpath("//textarea");
//select tenant
public static final By CLICK_TENANT = By.xpath("//div[4]/div/div/div/input");
public static final By SELECT_TENANT = By.xpath("//div[2]/div/div/div/ul/li/span");
//click workflow timeout alarm
public static final By CLICK_WORKFLOW_TIMEOUT_ALARM = By.xpath("//span[2]/span/span");
//input workflow timeout
public static final By INPUT_WORKFLOW_TIMEOUT = By.xpath("//span/div/input");
//click workflow global parameters
public static final By CLICK_WORKFLOW_GLOBAL_PARAMETERS = By.xpath("//span/a/em");
//input workflow global parameters
public static final By INPUT_WORKFLOW_GLOBAL_PARAMETERS = By.xpath("//div[8]/div/div/div/div/input");
//input workflow global parameters value
public static final By INPUT_WORKFLOW_GLOBAL_PARAMETERS_VALUES = By.xpath("//div[2]/input");
//click to add workflow global parameters
public static final By CLICK_ADD_WORKFLOW_GLOBAL_PARAMETERS = By.xpath("//span[2]/a/em");
//input to add workflow global parameters
public static final By INPUT_ADD_WORKFLOW_GLOBAL_PARAMETERS = By.xpath("//div[8]/div/div/div[2]/div/input");
//input to add workflow global parameters value
public static final By INPUT_ADD_WORKFLOW_GLOBAL_PARAMETERS_VALUES = By.xpath("//div[2]/div[2]/input");
//delete workflow global parameters value
public static final By CLICK_DELETE_WORKFLOW_GLOBAL_PARAMETERS = By.xpath("//div[2]/span/a/em");
//click add button
public static final By CLICK_ADD_BUTTON = By.xpath("//button[2]/span");
}

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

@ -19,7 +19,9 @@ package org.apache.dolphinscheduler.locator.security;
import org.openqa.selenium.By;
public class TenantManageLocator{
public static final By CREATE_TENANT_BUTTON = By.xpath("//button[@class='ans-btn ans-btn-ghost ans-btn-small']");
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 TENANT_INPUT_CODE = By.xpath("//div[2]/div/div/div[2]/div/input");
@ -30,4 +32,8 @@ public class TenantManageLocator{
public static final By DESCRIPTION = By.xpath("//textarea");
public static final By SUBMIT_BUTTON = By.xpath("//div[3]/button[2]/span");
public static final By DELETE_TENANT_BUTTON = By.xpath("//div[3]/div[1]/div/table/tr[2]/td[8]/span/button");
public static final By CONFIRM_DELETE_TENANT_BUTTON = By.xpath("//div[2]/div/button[2]/span");
}

3
e2e/src/test/java/org/apache/dolphinscheduler/locator/security/UserManageLocator.java

@ -42,4 +42,7 @@ public class UserManageLocator {
public static final By SUBMIT = By.xpath("//div[3]/button[2]/span");
public static final By DELETE_USER_BUTTON = By.xpath("//span[2]/button/i");
public static final By CONFIRM_DELETE_USER_BUTTON = By.xpath("//div[2]/div/button[2]/span");
}

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

@ -21,6 +21,7 @@ import org.apache.dolphinscheduler.constant.TestConstant;
import org.apache.dolphinscheduler.data.LoginData;
import org.apache.dolphinscheduler.locator.LoginLocator;
import org.apache.dolphinscheduler.util.RedisUtil;
import org.openqa.selenium.Cookie;
import org.openqa.selenium.WebDriver;
@ -38,18 +39,25 @@ public class LoginPage extends PageCommon {
/**
* jump page
*/
public void jumpPage() {
System.out.println("jump login page");
public void jumpPageEnlish() {
System.out.println("jump to English login page");
super.jumpPage(LoginData.URL);
Cookie cookie = new Cookie("language", "en_US", "/", null);
driver.manage().addCookie(cookie);
}
public void jumpPageChinese() {
super.jumpPage(LoginData.URL);
Cookie cookie = new Cookie("language", "zh_CN", "/", null);
driver.manage().addCookie(cookie);
}
/**
* login
*
* @return Whether to enter the specified page after searching
*/
public boolean login() throws InterruptedException {
System.out.println("LoginPage");
// login data
sendInput(LoginLocator.LOGIN_INPUT_USER, LoginData.USER);
sendInput(LoginLocator.LOGIN_INPUT_PASSWORD, LoginData.PASSWORD);

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

@ -18,7 +18,7 @@ package org.apache.dolphinscheduler.page.project;
import org.apache.dolphinscheduler.common.PageCommon;
import org.apache.dolphinscheduler.constant.TestConstant;
import org.apache.dolphinscheduler.data.project.CreatProjectData;
import org.apache.dolphinscheduler.data.project.CreateProjectData;
import org.apache.dolphinscheduler.locator.project.CreateProjectLocator;
import org.openqa.selenium.WebDriver;
@ -26,6 +26,7 @@ public class CreateProjectPage extends PageCommon {
public CreateProjectPage(WebDriver driver) {
super(driver);
}
/**
* jump page
*/
@ -36,7 +37,7 @@ public class CreateProjectPage extends PageCommon {
}
/**
* creatTenant
* createTenant
*
* @return Whether to enter the specified page after creat tenant
*/
@ -46,13 +47,13 @@ public class CreateProjectPage extends PageCommon {
Thread.sleep(TestConstant.ONE_THOUSANG);
// input create project data
sendInput(CreateProjectLocator.PROJECT_NAME, CreatProjectData.PROJECT_NAME);
sendInput(CreateProjectLocator.PROJECT_DESCRIPTION, CreatProjectData.DESCRIPTION);
sendInput(CreateProjectLocator.PROJECT_NAME, CreateProjectData.PROJECT_NAME);
sendInput(CreateProjectLocator.PROJECT_DESCRIPTION, CreateProjectData.DESCRIPTION);
// click submit button
clickButton(CreateProjectLocator.SUBMIT_BUTTON);
// Whether to enter the specified page after submit
return ifTitleContains(CreatProjectData.PROJECT_TITLE);
return ifTitleContains(CreateProjectData.PROJECT_TITLE);
}
}

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

@ -18,7 +18,7 @@ package org.apache.dolphinscheduler.page.project;
import org.apache.dolphinscheduler.common.PageCommon;
import org.apache.dolphinscheduler.constant.TestConstant;
import org.apache.dolphinscheduler.data.project.CreatWorkflowData;
import org.apache.dolphinscheduler.data.project.CreateWorkflowData;
import org.apache.dolphinscheduler.locator.project.CreateWorkflowLocator;
import org.openqa.selenium.WebDriver;
@ -26,29 +26,33 @@ public class CreateWorkflowPage extends PageCommon {
public CreateWorkflowPage(WebDriver driver) {
super(driver);
}
/**
* jump page
* jump create workflow page
*/
public boolean createWorkflow() throws InterruptedException {
System.out.println("Click on the project name to jump to the project homepage");
// click project name
clickElement(CreateWorkflowLocator.CLICK_PROJECT_NAME);
Thread.sleep(TestConstant.ONE_THOUSANG);
System.out.println("Click on workflow define");
// click workflow define
clickElement(CreateWorkflowLocator.CLICK_WORKFLOW_DEFINE);
Thread.sleep(TestConstant.ONE_THOUSANG);
System.out.println("Click create workflow button");
// click create workflow button
clickElement(CreateWorkflowLocator.CLICK_CREATE_WORKFLOW_BUTTON);
Thread.sleep(TestConstant.ONE_THOUSANG);
System.out.println("drag shell task");
//drag shell_task
dragAndDrop(CreateWorkflowLocator.MOUSE_DOWN_AT_SHELL,CreateWorkflowLocator.MOUSE_MOVE_SHELL_AT_DAG);
//input shell task _name
sendInput(CreateWorkflowLocator.INPUT_SHELL_TASK_NAME , CreatWorkflowData.SHELL_TASK_NAME);
sendInput(CreateWorkflowLocator.INPUT_SHELL_TASK_NAME , CreateWorkflowData.SHELL_TASK_NAME);
//click stop run type
clickElement(CreateWorkflowLocator.CLICK_STOP_RUN_TYPE);
@ -57,7 +61,7 @@ public class CreateWorkflowPage extends PageCommon {
clickElement(CreateWorkflowLocator.CLICK_NORMAL_RUN_TYPE);
//input shell task description
sendInput(CreateWorkflowLocator.INPUT_SHELL_TASK_DESCRIPTION , CreatWorkflowData.SHELL_TASK_DESCRIPTION);
sendInput(CreateWorkflowLocator.INPUT_SHELL_TASK_DESCRIPTION , CreateWorkflowData.SHELL_TASK_DESCRIPTION);
//select task priority
clickElement(CreateWorkflowLocator.CLICK_TASK_PRIORITY);
@ -73,19 +77,15 @@ public class CreateWorkflowPage extends PageCommon {
//select failed retry interval
clickElement(CreateWorkflowLocator.SELECT_FAIL_RETRIES_INTERVAL);
//click timeout alarm
clickElement(CreateWorkflowLocator.CLICK_TIMEOUT_ALARM);
//select timeout fail
clickElement(CreateWorkflowLocator.SELECT_TIMEOUT_FAIL);
//cancel timeout alarm
clickElement(CreateWorkflowLocator.CANCEL_TIMEOUT_ALARM);
//select timeout alarm
clickElement(CreateWorkflowLocator.SELECT_TIMEOUT_ALARM);
@ -94,10 +94,10 @@ public class CreateWorkflowPage extends PageCommon {
clearInput(CreateWorkflowLocator.SELECT_TIMEOUT);
//input timeout
sendInput(CreateWorkflowLocator.SELECT_TIMEOUT,CreatWorkflowData.INPUT_TIMEOUT);
sendInput(CreateWorkflowLocator.SELECT_TIMEOUT, CreateWorkflowData.INPUT_TIMEOUT);
//click codeMirror and input script
inputCodeMirror(CreateWorkflowLocator.CLICK_CODE_MIRROR, CreateWorkflowLocator.INPUT_SCRIPT,CreatWorkflowData.SHELL_SCRIPT);
inputCodeMirror(CreateWorkflowLocator.CLICK_CODE_MIRROR, CreateWorkflowLocator.INPUT_SCRIPT, CreateWorkflowData.SHELL_SCRIPT);
scrollToElementBottom();
Thread.sleep(TestConstant.ONE_THOUSANG);
@ -105,10 +105,10 @@ public class CreateWorkflowPage extends PageCommon {
clickElement(CreateWorkflowLocator.CLICK_CUSTOM_PARAMETERS);
//input custom parameters
sendInput(CreateWorkflowLocator.INPUT_CUSTOM_PARAMETERS, CreatWorkflowData.INPUT_CUSTOM_PARAMETERS);
sendInput(CreateWorkflowLocator.INPUT_CUSTOM_PARAMETERS, CreateWorkflowData.INPUT_CUSTOM_PARAMETERS);
//input custom parameters value
sendInput(CreateWorkflowLocator.INPUT_CUSTOM_PARAMETERS_VALUE, CreatWorkflowData.INPUT_CUSTOM_PARAMETERS_VALUE);
sendInput(CreateWorkflowLocator.INPUT_CUSTOM_PARAMETERS_VALUE, CreateWorkflowData.INPUT_CUSTOM_PARAMETERS_VALUE);
//click add custom parameters
clickElement(CreateWorkflowLocator.CLICK_ADD_CUSTOM_PARAMETERS);
@ -117,10 +117,10 @@ public class CreateWorkflowPage extends PageCommon {
Thread.sleep(TestConstant.ONE_THOUSANG);
//input add custom parameters
sendInput(CreateWorkflowLocator.INPUT_ADD_CUSTOM_PARAMETERS,CreatWorkflowData.INPUT_ADD_CUSTOM_PARAMETERS);
sendInput(CreateWorkflowLocator.INPUT_ADD_CUSTOM_PARAMETERS, CreateWorkflowData.INPUT_ADD_CUSTOM_PARAMETERS);
//input add custom parameters value
sendInput(CreateWorkflowLocator.INPUT_ADD_CUSTOM_PARAMETERS_VALUE,CreatWorkflowData.INPUT_ADD_CUSTOM_PARAMETERS_VALUE);
sendInput(CreateWorkflowLocator.INPUT_ADD_CUSTOM_PARAMETERS_VALUE, CreateWorkflowData.INPUT_ADD_CUSTOM_PARAMETERS_VALUE);
//click delete custom parameters
clickElement(CreateWorkflowLocator.CLICK_DELETE_CUSTOM_PARAMETERS);
@ -129,9 +129,64 @@ public class CreateWorkflowPage extends PageCommon {
//click submit button
clickElement(CreateWorkflowLocator.CLICK_SUBMIT_BUTTON);
Thread.sleep(TestConstant.ONE_THOUSANG);
System.out.println("Task node set up successfully");
System.out.println("move to Dag Element ");
moveToDragElement(CreateWorkflowLocator.MOUSE_MOVE_SHELL_AT_DAG,-300,-100);
return ifTitleContains(CreatWorkflowData.WORKFLOW_TITLE);
return ifTitleContains(CreateWorkflowData.WORKFLOW_TITLE);
}
/**
* save workflow
*/
public boolean saveWorkflow() throws InterruptedException {
System.out.println("start to save workflow ");
//click save workflow button
clickElement(CreateWorkflowLocator.CLICK_SAVE_WORKFLOW_BUTTON);
//input workflow name
sendInput(CreateWorkflowLocator.INPUT_WORKFLOW_NAME, CreateWorkflowData.INPUT_WORKFLOW_NAME);
//input workflow description
sendInput(CreateWorkflowLocator.INPUT_WORKFLOW_DESCRIPTION, CreateWorkflowData.INPUT_WORKFLOW_DESCRIPTION);
//select tenant
clickElement(CreateWorkflowLocator.CLICK_TENANT);
clickElement(CreateWorkflowLocator.SELECT_TENANT);
//click workflow timeout alarm
clickElement(CreateWorkflowLocator.CLICK_WORKFLOW_TIMEOUT_ALARM);
clearInput(CreateWorkflowLocator.INPUT_WORKFLOW_TIMEOUT);
//input workflow timeout
sendInput(CreateWorkflowLocator.INPUT_WORKFLOW_TIMEOUT, CreateWorkflowData.INPUT_WORKFLOW_TIMEOUT);
//click workflow global parameters
clickElement(CreateWorkflowLocator.CLICK_WORKFLOW_GLOBAL_PARAMETERS);
//input workflow global parameters
sendInput(CreateWorkflowLocator.INPUT_WORKFLOW_GLOBAL_PARAMETERS, CreateWorkflowData.INPUT_WORKFLOW_GLOBAL_PARAMETERS);
//input workflow global parameters value
sendInput(CreateWorkflowLocator.INPUT_WORKFLOW_GLOBAL_PARAMETERS_VALUES, CreateWorkflowData.INPUT_WORKFLOW_GLOBAL_PARAMETERS_VALUES);
//click to add workflow global parameters
clickElement(CreateWorkflowLocator.CLICK_ADD_WORKFLOW_GLOBAL_PARAMETERS);
//input to add workflow global parameters
sendInput(CreateWorkflowLocator.INPUT_ADD_WORKFLOW_GLOBAL_PARAMETERS, CreateWorkflowData.INPUT_ADD_WORKFLOW_GLOBAL_PARAMETERS);
//input to add workflow global parameters value
sendInput(CreateWorkflowLocator.INPUT_ADD_WORKFLOW_GLOBAL_PARAMETERS_VALUES, CreateWorkflowData.INPUT_ADD_WORKFLOW_GLOBAL_PARAMETERS_VALUES);
//delete workflow global parameters value
clickElement(CreateWorkflowLocator.CLICK_DELETE_WORKFLOW_GLOBAL_PARAMETERS);
Thread.sleep(TestConstant.ONE_THOUSANG);
//click add button
clickElement(CreateWorkflowLocator.CLICK_ADD_BUTTON);
System.out.println("submit workflow");
return ifTitleContains(CreateWorkflowData.WORKFLOW_TITLE);
}
}

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

@ -34,15 +34,6 @@ public class TenantManagePage extends PageCommon {
super(driver);
}
/**
* jump page
*/
public void jumpPage() {
System.out.println("jump tenant page");
super.jumpPage(TenantManageData.TENANAT_URL);
}
/**
* createTenant
*
@ -50,6 +41,7 @@ public class TenantManagePage extends PageCommon {
*/
public boolean createTenant() throws InterruptedException {
Thread.sleep(TestConstant.ONE_THOUSANG);
clickButton(TenantManageLocator.TENANT_MANAGE);
//create tenant
clickButton(TenantManageLocator.CREATE_TENANT_BUTTON);
@ -66,4 +58,20 @@ public class TenantManagePage extends PageCommon {
// Whether to enter the specified page after submit
return ifTitleContains(TenantManageData.TENANAT_MANAGE);
}
public boolean deleteTenant() throws InterruptedException {
Thread.sleep(TestConstant.ONE_THOUSANG);
clickButton(TenantManageLocator.TENANT_MANAGE);
Thread.sleep(TestConstant.ONE_THOUSANG);
// click delete button
clickButton(TenantManageLocator.DELETE_TENANT_BUTTON);
Thread.sleep(TestConstant.ONE_THOUSANG);
//click confirm delete button
clickButton(TenantManageLocator.CONFIRM_DELETE_TENANT_BUTTON);
// Whether to enter the specified page after submit
return ifTitleContains(TenantManageData.TENANAT_MANAGE);
}
}

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

@ -26,16 +26,9 @@ public class UserManagePage extends PageCommon {
public UserManagePage(WebDriver driver) {
super(driver);
}
/**
* jump page
*/
public void jumpPage() {
System.out.println("jump tenant page");
super.jumpPage(UserManageData.USER_URL);
}
/**
* creatTenant
* createTenant
*
* @return Whether to enter the specified page after creat tenant
*/
@ -64,4 +57,20 @@ public class UserManagePage extends PageCommon {
// Whether to enter the specified page after submit
return ifTitleContains(UserManageData.USER_MANAGE);
}
public boolean deleteUser() throws InterruptedException {
Thread.sleep(TestConstant.ONE_THOUSANG);
// click user manage
clickElement(UserManageLocator.CLICK_USER_MANAGE);
Thread.sleep(TestConstant.ONE_THOUSANG);
// click delete user button
clickButton(UserManageLocator.DELETE_USER_BUTTON );
// click confirm delete button
clickButton(UserManageLocator.CONFIRM_DELETE_USER_BUTTON);
// Whether to enter the specified page after submit
return ifTitleContains(UserManageData.USER_MANAGE);
}
}

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

@ -1,37 +1,26 @@
/*
* 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;
import org.apache.dolphinscheduler.base.BaseTest;
import org.apache.dolphinscheduler.page.LoginPage;
import org.testng.Assert;
import org.testng.annotations.Test;
import static org.apache.dolphinscheduler.base.BaseTest.driver;
public class LoginTest extends BaseTest {
@Test(groups={"functionTests","login"})
public class LoginTest {
private LoginPage loginPage;
@Test(description = "LoginTest", priority = 1)
public void testLogin() throws InterruptedException {
// init login page
loginPage = new LoginPage(driver);
System.out.println("===================================");
System.out.println("jump to Chinese login page");
loginPage.jumpPageChinese();
// enter login page
loginPage.jumpPage();
System.out.println("start login");
assert loginPage.login();
System.out.println("end login");
System.out.println("===================================");
//assert login page
assert loginPage.login();
}
}

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

@ -0,0 +1,37 @@
/*
* 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.security.TenantManagePage;
import org.testng.annotations.Test;
public class DeleteTenantTest extends BaseTest {
private TenantManagePage tenantManagePage;
@Test(groups={"functionTests"},dependsOnGroups = { "login","createTenant"},description = "DeleteTenantTest")
public void testDeleteTenant() throws InterruptedException {
tenantManagePage = new TenantManagePage(driver);
//assert tenant manage page
System.out.println("start delete tenant");
assert tenantManagePage.deleteTenant();
System.out.println("end delete tenant");
System.out.println("===================================");
}
}

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

@ -0,0 +1,36 @@
/*
* 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.security.UserManagePage;
import org.testng.annotations.Test;
public class DeleteUserTest extends BaseTest {
private UserManagePage userManagePage;
@Test(groups={"functionTests"},dependsOnGroups = { "login","user" },description = "DeleteUserTest")
public void testDeleteUser() throws InterruptedException {
userManagePage = new UserManagePage(driver);
//assert user manage page
System.out.println("start delete user");
assert userManagePage.deleteUser();
System.out.println("end delete user");
System.out.println("===================================");
}
}

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

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

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

@ -26,12 +26,16 @@ public class CreateWorkflowTest extends BaseTest {
private CreateProjectPage createProjectPage;
@Test(description = "CreateWorkflowTest", priority = 1)
public void CreateWorkflowTest() throws InterruptedException {
@Test(groups={"functionTests"},dependsOnGroups = { "login" },description = "CreateWorkflowTest",priority=5)
public void testCreateWorkflow() throws InterruptedException {
createProjectPage = new CreateProjectPage(driver);
createProjectPage.jumpProjectManagePage();
createWorkflowPage = new CreateWorkflowPage(driver);
//assert create workflow
System.out.println("start create workflow");
assert createWorkflowPage.createWorkflow();
assert createWorkflowPage.saveWorkflow();
System.out.println("end create workflow");
System.out.println("===================================");
}
}

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

@ -20,15 +20,20 @@ import org.apache.dolphinscheduler.base.BaseTest;
import org.apache.dolphinscheduler.page.security.TenantManagePage;
import org.testng.annotations.Test;
public class TenantManageTest extends BaseTest {
private TenantManagePage tenantManagePage;
@Test(description = "TenantTest", priority = 1)
@Test(groups={"functionTests","createTenant"},dependsOnGroups = { "login" },description = "TenantManageTest")
public void testTenantManage() throws InterruptedException {
tenantManagePage = new TenantManagePage(driver);
// enter tenant manage page
tenantManagePage.jumpPage();
//assert tenant manage page
System.out.println("start create tenant");
assert tenantManagePage.createTenant();
System.out.println("end create tenant");
System.out.println("===================================");
}
}

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

@ -23,12 +23,14 @@ import org.testng.annotations.Test;
public class UserManageTest extends BaseTest {
private UserManagePage userManagePage;
@Test(description = "TenantTest", priority = 1)
@Test(groups={"functionTests","user"},dependsOnGroups = { "login" },description = "UserManageTest")
public void testUserManage() throws InterruptedException {
userManagePage = new UserManagePage(driver);
// enter user manage page
userManagePage.jumpPage();
//assert user manage page
System.out.println("start create user");
assert userManagePage.createUser();
System.out.println("end create user");
System.out.println("===================================");
}
}

18
e2e/suite.xml

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="e2e Test Suite" parallel="tests" thread-count="2">
<!-- create tenant -->
<test name="create-tenant" preserve-order="true">
<classes>
<class name="org.apache.dolphinscheduler.testcase.security.TenantManageTest">
</class>
</classes>
</test>
<!-- create user -->
<test name="create-user" preserve-order="true">
<classes>
<class name="org.apache.dolphinscheduler.testcase.security.UserManageTest">
</class>
</classes>
</test>
</suite>

28
e2e/testng.xml

@ -1,19 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="dolphinscheduler_e2e" parallel="false">
<test name="dolphinscheduler_test">
<!--<packages>-->
<!--&lt;!&ndash;<package name="org.apache.dolphinscheduler.testcase.security.TenantManageTest"/>&ndash;&gt;-->
<!--<package name="org.apache.dolphinscheduler.testcase.security.*"/>-->
<!--</packages>-->
<suite name="dolphinscheduler_e2e" parallel="true">
<test name="dolphinscheduler_test" preserve-order="true">
<groups>
<run>
<include name="functionTests" />
</run>
</groups>
<classes>
<class name="org.apache.dolphinscheduler.testcase.security.TenantManageTest"></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.UserManageTest"></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.deleteData.DeleteTenantTest"></class>
<class name="org.apache.dolphinscheduler.testcase.deleteData.DeleteUserTest"></class>
</classes>
</test>
<!--<suite-files>-->
<!--<suite-file path="suite.xml"/>-->
<!--</suite-files>-->
</test>
<listeners>
<listener class-name="org.uncommons.reportng.HTMLReporter" />

Loading…
Cancel
Save