diff --git a/e2e/src/main/java/org/apache/dolphinscheduler/constant/TestConstant.java b/e2e/src/main/java/org/apache/dolphinscheduler/constant/TestConstant.java index 8a3b8eb6b3..2cc78d58a4 100644 --- a/e2e/src/main/java/org/apache/dolphinscheduler/constant/TestConstant.java +++ b/e2e/src/main/java/org/apache/dolphinscheduler/constant/TestConstant.java @@ -20,18 +20,16 @@ public class TestConstant { /** * 1000 */ - public static final int ONE_THOUSANG = 1000; - - + public static final int ONE_THOUSAND = 1000; /** * 3000 */ - public static final int THREE_THOUSANG = 3000; + public static final int THREE_THOUSAND = 3000; /** * 10000 */ - public static final int TEN_THOUSANG = 10000; + public static final int TEN_THOUSAND = 10000; } diff --git a/e2e/src/main/java/org/apache/dolphinscheduler/util/RedisUtil.java b/e2e/src/main/java/org/apache/dolphinscheduler/util/RedisUtil.java index 7f9340f0ca..14261a5505 100644 --- a/e2e/src/main/java/org/apache/dolphinscheduler/util/RedisUtil.java +++ b/e2e/src/main/java/org/apache/dolphinscheduler/util/RedisUtil.java @@ -115,9 +115,9 @@ public class RedisUtil { try { System.out.println("redis init"); if (redisPwd.isEmpty()) - jedisPool = new JedisPool(jedisPoolConfig, redisIp, redisPort, TestConstant.THREE_THOUSANG); + jedisPool = new JedisPool(jedisPoolConfig, redisIp, redisPort, TestConstant.THREE_THOUSAND); else { - jedisPool = new JedisPool(jedisPoolConfig, redisIp, redisPort, TestConstant.TEN_THOUSANG, redisPwd); + jedisPool = new JedisPool(jedisPoolConfig, redisIp, redisPort, TestConstant.TEN_THOUSAND, redisPwd); } } catch (Exception e) { e.printStackTrace(); diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/base/BaseDriver.java b/e2e/src/test/java/org/apache/dolphinscheduler/base/BaseDriver.java index 044e28f082..23c98b4e46 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/base/BaseDriver.java +++ b/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.util.PropertiesReader; -import org.openqa.selenium.Cookie; -import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.PageLoadStrategy; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; +import org.openqa.selenium.remote.CapabilityType; + import java.io.IOException; import java.util.concurrent.TimeUnit; -import org.openqa.selenium.PageLoadStrategy; /** @@ -83,6 +83,7 @@ public class BaseDriver { * start chrome browser */ public void startBrowser() throws Exception { + System.out.println("===================test start==================="); // set chrome driver System.setProperty("webdriver.chrome.driver", chromeDriverPath); ChromeOptions chromeOptions = new ChromeOptions(); @@ -104,9 +105,6 @@ public class BaseDriver { // page load timeout driver.manage().timeouts().pageLoadTimeout(pageLoadTimeout, TimeUnit.SECONDS); - // page load timeout - driver.manage().timeouts().pageLoadTimeout(pageLoadTimeout, TimeUnit.SECONDS); - // script timeout driver.manage().timeouts().setScriptTimeout(setScriptTimeout, TimeUnit.SECONDS); @@ -141,12 +139,10 @@ public class BaseDriver { * close browser */ 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')"); - Thread.sleep(TestConstant.THREE_THOUSANG); + Thread.sleep(TestConstant.THREE_THOUSAND); if (driver != null) { driver.quit(); + System.out.println("===================test end==================="); } } } diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/common/BrowserCommon.java b/e2e/src/test/java/org/apache/dolphinscheduler/common/BrowserCommon.java index 072ccb652e..5ad085a137 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/common/BrowserCommon.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/common/BrowserCommon.java @@ -126,6 +126,18 @@ public class BrowserCommon { 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 * @@ -138,6 +150,7 @@ public class BrowserCommon { return clickElement; } + /** * input element * @@ -236,12 +249,16 @@ public class BrowserCommon { return driver; } - /** - * Multi-window switch handle, according to the handle number passed in - * - * @param num Number starts from 1 - * @return driver - */ + + + + + /** + * Multi-window switch handle, according to the handle number passed in + * + * @param num Number starts from 1 + * @return driver + */ public WebDriver switchHandle(int num) { // current handle String currentHandle = driver.getWindowHandle(); @@ -314,9 +331,8 @@ public class BrowserCommon { executeScript("window.scrollTo(0, document.body.scrollHeight)"); } - public void scrollToElementBottom() { - - WebElement webElement = driver.findElement(By.xpath("/html/body/div[4]/div/div[2]/div/div[2]/div/div[7]/div[3]")); + public void scrollToElementBottom(By locator) { + WebElement webElement = locateElement(locator); ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", webElement); } diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreatWorkflowData.java b/e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreatWorkflowData.java deleted file mode 100644 index 70f4238610..0000000000 --- a/e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreatWorkflowData.java +++ /dev/null @@ -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"; -} diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateProjectData.java b/e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateProjectData.java index 57d79e87d7..004004c54f 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateProjectData.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateProjectData.java @@ -18,7 +18,7 @@ package org.apache.dolphinscheduler.data.project; public class CreateProjectData { // create project name - public static final String PROJECT_NAME = "selenium_project_3"; + public static final String PROJECT_NAME = "selenium_project_1"; // create project description public static final String DESCRIPTION = "test create project description"; // project page title diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateWorkflowData.java b/e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateWorkflowData.java index 31b5bdd1e0..0ec5f05834 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateWorkflowData.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateWorkflowData.java @@ -21,7 +21,7 @@ public class CreateWorkflowData { * create workflow data */ //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 public static final String SHELL_TASK_DESCRIPTION = "shell task description test"; @@ -44,8 +44,12 @@ public class CreateWorkflowData { //input add custom parameters value 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 - public static final String WORKFLOW_TITLE = "创建流程定义 - DolphinScheduler"; + public static final String CREATE_WORKFLOW_TITLE = "创建流程定义 - DolphinScheduler"; + /** * save workflow data diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/data/security/TenantManageData.java b/e2e/src/test/java/org/apache/dolphinscheduler/data/security/TenantManageData.java index 100351b600..71e50e7150 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/data/security/TenantManageData.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/data/security/TenantManageData.java @@ -25,12 +25,12 @@ public class TenantManageData { /** * Tenant Code */ - public static final String TENANAT_CODE = "dolphinscheduler_tenant_code15"; + public static final String TENANT_CODE = "selenium_tenant_code_1"; /** * Tenant Name */ - public static final String TENANAT_NAME = "dolphinscheduler_tenant_Name"; + public static final String TENANT_NAME = "selenium_tenant_Name"; /** * Queue @@ -40,9 +40,9 @@ public class TenantManageData { /** * 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"; diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/data/security/UserManageData.java b/e2e/src/test/java/org/apache/dolphinscheduler/data/security/UserManageData.java index 6fcd923c53..080172d297 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/data/security/UserManageData.java +++ b/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 static final String USERNAME = "selenium_5"; + public static final String USERNAME = "selenium_user_1"; public static final String PASSWORD = "123456qwe"; diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/CreateProjectLocator.java b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/CreateProjectLocator.java index d2c0d8412c..3d96f24288 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/CreateProjectLocator.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/CreateProjectLocator.java @@ -20,10 +20,15 @@ import org.openqa.selenium.By; public class CreateProjectLocator { //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 - 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 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 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"); } diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/CreateWorkflowLocator.java b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/CreateWorkflowLocator.java index 25defcf53f..496bbc4863 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/CreateWorkflowLocator.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/CreateWorkflowLocator.java @@ -169,4 +169,15 @@ public class CreateWorkflowLocator { //click add button 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"); } diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/TenantManageLocator.java b/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/TenantManageLocator.java index d95265cf0b..7db883615c 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/locator/security/TenantManageLocator.java +++ b/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; 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 CREATE_TENANT_BUTTON = By.xpath("//button/span"); diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/page/LoginPage.java b/e2e/src/test/java/org/apache/dolphinscheduler/page/LoginPage.java index 14970bead5..39bd152d0a 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/page/LoginPage.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/page/LoginPage.java @@ -17,10 +17,8 @@ package org.apache.dolphinscheduler.page; import org.apache.dolphinscheduler.common.PageCommon; -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; @@ -49,7 +47,6 @@ public class LoginPage extends PageCommon { public void jumpPageChinese() { super.jumpPage(LoginData.URL); Cookie cookie = new Cookie("language", "zh_CN", "/", null); - driver.manage().addCookie(cookie); } /** diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/CreateProjectPage.java b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/CreateProjectPage.java index d8e1ef655d..52bfcc661d 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/CreateProjectPage.java +++ b/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 { - Thread.sleep(TestConstant.ONE_THOUSANG); - clickElement(CreateProjectLocator.PROJECT_MANAGE); - Thread.sleep(TestConstant.ONE_THOUSANG); + public boolean jumpProjectManagePage() throws InterruptedException { + Thread.sleep(TestConstant.THREE_THOUSAND); + clickTopElement(CreateProjectLocator.PROJECT_MANAGE); + 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 { - //click create project clickElement(CreateProjectLocator.CREATE_PROJECT_BUTTON); - Thread.sleep(TestConstant.ONE_THOUSANG); // input create project data sendInput(CreateProjectLocator.PROJECT_NAME, CreateProjectData.PROJECT_NAME); @@ -56,4 +55,20 @@ public class CreateProjectPage extends PageCommon { // Whether to enter the specified page after submit 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); + } } diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/CreateWorkflowPage.java b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/CreateWorkflowPage.java index d115124d8f..a529e76f44 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/CreateWorkflowPage.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/CreateWorkflowPage.java @@ -30,22 +30,23 @@ public class CreateWorkflowPage extends PageCommon { /** * 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 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 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"); // click create workflow button clickElement(CreateWorkflowLocator.CLICK_CREATE_WORKFLOW_BUTTON); - Thread.sleep(TestConstant.ONE_THOUSANG); System.out.println("drag shell task"); //drag shell_task @@ -98,8 +99,7 @@ public class CreateWorkflowPage extends PageCommon { //click codeMirror and input script inputCodeMirror(CreateWorkflowLocator.CLICK_CODE_MIRROR, CreateWorkflowLocator.INPUT_SCRIPT, CreateWorkflowData.SHELL_SCRIPT); - scrollToElementBottom(); - Thread.sleep(TestConstant.ONE_THOUSANG); + scrollToElementBottom(CreateWorkflowLocator.SCROLL_BOTTOM); //click custom parameters clickElement(CreateWorkflowLocator.CLICK_CUSTOM_PARAMETERS); @@ -113,8 +113,7 @@ public class CreateWorkflowPage extends PageCommon { //click add custom parameters clickElement(CreateWorkflowLocator.CLICK_ADD_CUSTOM_PARAMETERS); - scrollToElementBottom(); - Thread.sleep(TestConstant.ONE_THOUSANG); + scrollToElementBottom(CreateWorkflowLocator.SCROLL_BOTTOM); //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 clickElement(CreateWorkflowLocator.CLICK_DELETE_CUSTOM_PARAMETERS); - Thread.sleep(TestConstant.ONE_THOUSANG); //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("move to Dag Element "); 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 clickElement(CreateWorkflowLocator.CLICK_DELETE_WORKFLOW_GLOBAL_PARAMETERS); - Thread.sleep(TestConstant.ONE_THOUSANG); + Thread.sleep(TestConstant.ONE_THOUSAND); //click add button - clickElement(CreateWorkflowLocator.CLICK_ADD_BUTTON); + clickButton(CreateWorkflowLocator.CLICK_ADD_BUTTON); 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); } } diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/page/security/TenantManagePage.java b/e2e/src/test/java/org/apache/dolphinscheduler/page/security/TenantManagePage.java index 618e1bc213..085bfa93a3 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/page/security/TenantManagePage.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/page/security/TenantManagePage.java @@ -17,12 +17,8 @@ package org.apache.dolphinscheduler.page.security; 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.locator.LoginLocator; import org.apache.dolphinscheduler.locator.security.TenantManageLocator; -import org.apache.dolphinscheduler.util.RedisUtil; import org.openqa.selenium.WebDriver; public class TenantManagePage extends PageCommon { @@ -34,21 +30,30 @@ public class TenantManagePage extends PageCommon { 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 * - * @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 { - Thread.sleep(TestConstant.ONE_THOUSANG); clickButton(TenantManageLocator.TENANT_MANAGE); //create tenant clickButton(TenantManageLocator.CREATE_TENANT_BUTTON); // tenant data - sendInput(TenantManageLocator.TENANT_INPUT_CODE, TenantManageData.TENANAT_CODE); - sendInput(TenantManageLocator.TENANT_INPUT_NAME, TenantManageData.TENANAT_NAME); + sendInput(TenantManageLocator.TENANT_INPUT_CODE, TenantManageData.TENANT_CODE); + sendInput(TenantManageLocator.TENANT_INPUT_NAME, TenantManageData.TENANT_NAME); sendInput(TenantManageLocator.QUEUE, TenantManageData.QUEUE); sendInput(TenantManageLocator.DESCRIPTION, TenantManageData.DESCRIPTION); @@ -56,22 +61,19 @@ public class TenantManagePage extends PageCommon { clickButton(TenantManageLocator.SUBMIT_BUTTON); // Whether to enter the specified page after submit - return ifTitleContains(TenantManageData.TENANAT_MANAGE); + return ifTitleContains(TenantManageData.TENANT_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); + return ifTitleContains(TenantManageData.TENANT_MANAGE); } } diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/page/security/UserManagePage.java b/e2e/src/test/java/org/apache/dolphinscheduler/page/security/UserManagePage.java index 70311f129e..21dd4ca294 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/page/security/UserManagePage.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/page/security/UserManagePage.java @@ -17,7 +17,6 @@ package org.apache.dolphinscheduler.page.security; import org.apache.dolphinscheduler.common.PageCommon; -import org.apache.dolphinscheduler.constant.TestConstant; import org.apache.dolphinscheduler.data.security.UserManageData; import org.apache.dolphinscheduler.locator.security.UserManageLocator; import org.openqa.selenium.WebDriver; @@ -33,10 +32,8 @@ public class UserManagePage extends PageCommon { * @return Whether to enter the specified page after creat tenant */ public boolean createUser() throws InterruptedException { - Thread.sleep(TestConstant.ONE_THOUSANG); // click user manage clickElement(UserManageLocator.CLICK_USER_MANAGE); - Thread.sleep(TestConstant.ONE_THOUSANG); // click create user button clickButton(UserManageLocator.CLICK_CREATE_USER_BUTTON); @@ -59,10 +56,9 @@ public class UserManagePage extends PageCommon { } 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 ); diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/LoginTest.java b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/LoginTest.java index 024ffcdc8a..d1af921077 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/LoginTest.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/LoginTest.java @@ -17,7 +17,6 @@ package org.apache.dolphinscheduler.testcase; import org.apache.dolphinscheduler.page.LoginPage; -import org.testng.Assert; import org.testng.annotations.Test; import static org.apache.dolphinscheduler.base.BaseTest.driver; diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteProjectTest.java b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteProjectTest.java new file mode 100644 index 0000000000..dc45b6e573 --- /dev/null +++ b/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("==================================="); + } +} diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteTenantTest.java b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteTenantTest.java index ddbc9d603b..067bc4a973 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteTenantTest.java +++ b/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 { 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 { tenantManagePage = new TenantManagePage(driver); //assert tenant manage page + System.out.println("jump to security to delete tenant"); + tenantManagePage.jumpSecurity(); + System.out.println("start delete tenant"); assert tenantManagePage.deleteTenant(); System.out.println("end delete tenant"); System.out.println("==================================="); } - - } diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteUserTest.java b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteUserTest.java index 770fae077d..4507192217 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteUserTest.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteUserTest.java @@ -17,14 +17,20 @@ package org.apache.dolphinscheduler.testcase.deleteData; import org.apache.dolphinscheduler.base.BaseTest; +import org.apache.dolphinscheduler.page.security.TenantManagePage; import org.apache.dolphinscheduler.page.security.UserManagePage; import org.testng.annotations.Test; public class DeleteUserTest extends BaseTest { 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 { + tenantManagePage = new TenantManagePage(driver); + System.out.println("jump to security to delete user"); + tenantManagePage.jumpSecurity(); + userManagePage = new UserManagePage(driver); //assert user manage page System.out.println("start delete user"); diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteWorkflowTest.java b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/deleteData/DeleteWorkflowTest.java new file mode 100644 index 0000000000..48eb0912fe --- /dev/null +++ b/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("==================================="); + } +} diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/project/CreateProjectTest.java b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/project/CreateProjectTest.java index 546792f0d8..8f7594b05c 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/project/CreateProjectTest.java +++ b/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 { 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 { createProjectPage = new CreateProjectPage(driver); // enter user manage page + System.out.println("jump to the projectManage page to create project "); createProjectPage.jumpProjectManagePage(); //assert user manage page System.out.println("start create project"); diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/project/CreateWorkflowTest.java b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/project/CreateWorkflowTest.java index ea87f48529..61aadf7a17 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/project/CreateWorkflowTest.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/project/CreateWorkflowTest.java @@ -26,12 +26,16 @@ public class CreateWorkflowTest extends BaseTest { 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 { createProjectPage = new CreateProjectPage(driver); + System.out.println("jump to the projectManage page to create workflow"); createProjectPage.jumpProjectManagePage(); 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"); assert createWorkflowPage.createWorkflow(); assert createWorkflowPage.saveWorkflow(); diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/security/TenantManageTest.java b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/security/TenantManageTest.java index 8b21d3bb61..721af36d06 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/security/TenantManageTest.java +++ b/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 { 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 { tenantManagePage = new TenantManagePage(driver); //assert tenant manage page @@ -32,8 +32,5 @@ public class TenantManageTest extends BaseTest { assert tenantManagePage.createTenant(); System.out.println("end create tenant"); System.out.println("==================================="); - } - - } diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/security/UserManageTest.java b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/security/UserManageTest.java index 9381b68c75..fdcec1a5c6 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/security/UserManageTest.java +++ b/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 { 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 { userManagePage = new UserManagePage(driver); //assert user manage page diff --git a/e2e/testng.xml b/e2e/testng.xml index 539d383a5a..eb4f21e9d8 100644 --- a/e2e/testng.xml +++ b/e2e/testng.xml @@ -20,7 +20,7 @@ - + @@ -28,10 +28,12 @@ - - - + + + + +