diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/data/project/ProcessInstanceData.java b/e2e/src/test/java/org/apache/dolphinscheduler/data/project/ProcessInstanceData.java new file mode 100644 index 0000000000..7114851d25 --- /dev/null +++ b/e2e/src/test/java/org/apache/dolphinscheduler/data/project/ProcessInstanceData.java @@ -0,0 +1,25 @@ +/* + * 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 ProcessInstanceData { + //Process Instance page title + public static final String PROCESS_INSTANCE_TITLE = "工作流实例 - DolphinScheduler"; + public static final String RERUN_TYPE= "重跑"; + + +} diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateProjectData.java b/e2e/src/test/java/org/apache/dolphinscheduler/data/project/ProjectData.java similarity index 97% rename from e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateProjectData.java rename to e2e/src/test/java/org/apache/dolphinscheduler/data/project/ProjectData.java index 004004c54f..fce247aa4d 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateProjectData.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/data/project/ProjectData.java @@ -16,7 +16,7 @@ */ package org.apache.dolphinscheduler.data.project; -public class CreateProjectData { +public class ProjectData { // create project name public static final String PROJECT_NAME = "selenium_project_1"; // create project description diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateWorkflowData.java b/e2e/src/test/java/org/apache/dolphinscheduler/data/project/WorkflowDefineData.java similarity index 98% rename from e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateWorkflowData.java rename to e2e/src/test/java/org/apache/dolphinscheduler/data/project/WorkflowDefineData.java index 0ec5f05834..0b3645f329 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/data/project/CreateWorkflowData.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/data/project/WorkflowDefineData.java @@ -16,7 +16,7 @@ */ package org.apache.dolphinscheduler.data.project; -public class CreateWorkflowData { +public class WorkflowDefineData { /** * create workflow data */ diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/ProcessInstanceLocator.java b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/ProcessInstanceLocator.java new file mode 100644 index 0000000000..1af9d56274 --- /dev/null +++ b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/ProcessInstanceLocator.java @@ -0,0 +1,31 @@ +/* + * 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.locator.project; + +import org.openqa.selenium.By; + +public class ProcessInstanceLocator { + // jump Process Instance page + //click Process Instance name + public static final By CLICK_PROCESS_INSTANCE_NAME = By.xpath("//div[3]/div/ul/li[2]"); + + // click rerun button + public static final By CLICK_RERUN_BUTTON = By.xpath("//tr[2]/td[14]/div[1]/button[2]"); + + //assert rerun type + public static final By RUNNING_TYPE = By.xpath("//tr[2]/td[5]/span"); +} diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/CreateProjectLocator.java b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/ProjectLocator.java similarity index 78% rename from e2e/src/test/java/org/apache/dolphinscheduler/locator/project/CreateProjectLocator.java rename to e2e/src/test/java/org/apache/dolphinscheduler/locator/project/ProjectLocator.java index 3d96f24288..8b26e673a6 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/CreateProjectLocator.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/ProjectLocator.java @@ -18,17 +18,12 @@ package org.apache.dolphinscheduler.locator.project; import org.openqa.selenium.By; -public class CreateProjectLocator { +public class ProjectLocator { //click project manage -// 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("//div[2]/div/div[1]/button/span"); + public static final By CREATE_PROJECT_BUTTON = By.xpath("//button/span"); //input project name public static final By PROJECT_NAME = By.xpath("//div[2]/div/div/div[2]/div/input"); diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/TimingLocator.java b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/TimingLocator.java index d9559b1236..2605636f16 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/TimingLocator.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/TimingLocator.java @@ -45,9 +45,9 @@ public class TimingLocator { public static final By CLICK_CREATE_BUTTON = By.xpath("//div[12]/button[2]/span"); //edit timing - public static final By CLICK_TIMING_MANAGEMENT_BUTTON = By.xpath("//div[2]/div/div[3]/div[1]/div/table/tr[2]/td[10]/button[6]"); + public static final By CLICK_TIMING_MANAGEMENT_BUTTON = By.xpath("//tr[2]/td[10]/button[6]"); - public static final By CLICK_EDIT_TIMING_BUTTON = By.xpath("//div[2]/div[3]/div/div[2]/div[1]/table/tr[2]/td[10]/button[1]"); + public static final By CLICK_EDIT_TIMING_BUTTON = By.xpath("//tr[2]/td[10]/button[1]/i"); //online timing public static final By CLICK_ONLINE_TIMING_BUTTON = By.xpath("//td[10]/button[2]"); diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/CreateWorkflowLocator.java b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/WorkflowDefineLocator.java similarity index 99% rename from e2e/src/test/java/org/apache/dolphinscheduler/locator/project/CreateWorkflowLocator.java rename to e2e/src/test/java/org/apache/dolphinscheduler/locator/project/WorkflowDefineLocator.java index ad18b6217c..bfb237ccd2 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/CreateWorkflowLocator.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/locator/project/WorkflowDefineLocator.java @@ -19,7 +19,7 @@ package org.apache.dolphinscheduler.locator.project; import org.openqa.selenium.By; -public class CreateWorkflowLocator { +public class WorkflowDefineLocator { /** * jump workflow define page 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 deleted file mode 100644 index ed978a80ed..0000000000 --- a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/CreateWorkflowPage.java +++ /dev/null @@ -1,226 +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.page.project; - -import org.apache.dolphinscheduler.common.PageCommon; -import org.apache.dolphinscheduler.constant.TestConstant; -import org.apache.dolphinscheduler.data.project.CreateWorkflowData; -import org.apache.dolphinscheduler.locator.project.CreateWorkflowLocator; -import org.apache.dolphinscheduler.locator.project.RunWorkflowLocator; -import org.openqa.selenium.WebDriver; - -public class CreateWorkflowPage extends PageCommon { - public CreateWorkflowPage(WebDriver driver) { - super(driver); - } - - /** - * jump create workflow page - */ - - public boolean jumpWorkflowPage() throws InterruptedException { - // click project name - clickElement(CreateWorkflowLocator.CLICK_PROJECT_NAME); - Thread.sleep(TestConstant.ONE_THOUSAND); - - System.out.println("Click on workflow define to jump to workflow define page"); - // click workflow define - clickElement(CreateWorkflowLocator.CLICK_WORKFLOW_DEFINE); - - 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); - - 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 , CreateWorkflowData.SHELL_TASK_NAME); - - //click stop run type - clickElement(CreateWorkflowLocator.CLICK_STOP_RUN_TYPE); - - //click normal run type - clickElement(CreateWorkflowLocator.CLICK_NORMAL_RUN_TYPE); - - //input shell task description - sendInput(CreateWorkflowLocator.INPUT_SHELL_TASK_DESCRIPTION , CreateWorkflowData.SHELL_TASK_DESCRIPTION); - - //select task priority - clickElement(CreateWorkflowLocator.CLICK_TASK_PRIORITY); - clickElement(CreateWorkflowLocator.SELECT_TASK_PRIORITY); - - //select work group - clickElement(CreateWorkflowLocator.CLICK_WORK_GROUP); - clickElement(CreateWorkflowLocator.SELECT_WORK_GROUP); - - //select number of failed retries - clickElement(CreateWorkflowLocator.SELECT_FAIL_RETRIES_NUMBER); - - //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); - - //clear timeout - clearInput(CreateWorkflowLocator.SELECT_TIMEOUT); - clearInput(CreateWorkflowLocator.SELECT_TIMEOUT); - - //input timeout - sendInput(CreateWorkflowLocator.SELECT_TIMEOUT, CreateWorkflowData.INPUT_TIMEOUT); - - //click codeMirror and input script - inputCodeMirror(CreateWorkflowLocator.CLICK_CODE_MIRROR, CreateWorkflowLocator.INPUT_SCRIPT, CreateWorkflowData.SHELL_SCRIPT); - scrollToElementBottom(CreateWorkflowLocator.SCROLL_BOTTOM); - - //click custom parameters - clickElement(CreateWorkflowLocator.CLICK_CUSTOM_PARAMETERS); - - //input custom parameters - sendInput(CreateWorkflowLocator.INPUT_CUSTOM_PARAMETERS, CreateWorkflowData.INPUT_CUSTOM_PARAMETERS); - - //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); - - scrollToElementBottom(CreateWorkflowLocator.SCROLL_BOTTOM); - - //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, CreateWorkflowData.INPUT_ADD_CUSTOM_PARAMETERS_VALUE); - - //click delete custom parameters - clickElement(CreateWorkflowLocator.CLICK_DELETE_CUSTOM_PARAMETERS); - - //click submit button - clickElement(CreateWorkflowLocator.CLICK_SUBMIT_BUTTON); - 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.CREATE_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_THOUSAND); - - //click add button - System.out.println("submit workflow"); - clickButton(CreateWorkflowLocator.CLICK_ADD_BUTTON); - - return ifTitleContains(CreateWorkflowData.CREATE_WORKFLOW_TITLE); - } - - public boolean onlineWorkflow() throws InterruptedException { - clickElement(CreateWorkflowLocator.CLICK_WORKFLOW_DEFINE); - - // click online button - System.out.println("Click online workflow button"); - clickButton(CreateWorkflowLocator.CLICK_ONLINE_WORKFLOW_BUTTON); - - return ifTitleContains(CreateWorkflowData.WORKFLOW_TITLE); - } - - public boolean offlineWorkflow() throws InterruptedException { - clickElement(CreateWorkflowLocator.CLICK_WORKFLOW_DEFINE); - - // click offline button - System.out.println("offline workflow"); - Thread.sleep(500); - clickButton(CreateWorkflowLocator.CLICK_OFFLINE_WORKFLOW_BUTTON); - - return ifTitleContains(CreateWorkflowData.WORKFLOW_TITLE); - } - - - public boolean deleteWorkflow() throws InterruptedException { - //click delete workflow - Thread.sleep(500); - 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/project/ProcessInstancePage.java b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/ProcessInstancePage.java new file mode 100644 index 0000000000..f8503e51b9 --- /dev/null +++ b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/ProcessInstancePage.java @@ -0,0 +1,40 @@ +/* + * 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.page.project; + +import org.apache.dolphinscheduler.common.PageCommon; +import org.apache.dolphinscheduler.locator.project.ProcessInstanceLocator; +import org.openqa.selenium.WebDriver; +import org.apache.dolphinscheduler.data.project.ProcessInstanceData; + + +public class ProcessInstancePage extends PageCommon { + public ProcessInstancePage(WebDriver driver) { + super(driver); + } + + + /** + * rerun workflow page + */ + public boolean rerunWorkflowPage() throws InterruptedException { + clickTopElement(ProcessInstanceLocator.CLICK_PROCESS_INSTANCE_NAME); + clickTopElement(ProcessInstanceLocator.CLICK_RERUN_BUTTON); + return ifTitleContains(ProcessInstanceData.PROCESS_INSTANCE_TITLE); + } + +} diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/CreateProjectPage.java b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/ProjectPage.java similarity index 66% rename from e2e/src/test/java/org/apache/dolphinscheduler/page/project/CreateProjectPage.java rename to e2e/src/test/java/org/apache/dolphinscheduler/page/project/ProjectPage.java index cba62a4b34..5c591d0b5d 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/CreateProjectPage.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/ProjectPage.java @@ -18,12 +18,12 @@ package org.apache.dolphinscheduler.page.project; import org.apache.dolphinscheduler.common.PageCommon; import org.apache.dolphinscheduler.constant.TestConstant; -import org.apache.dolphinscheduler.data.project.CreateProjectData; -import org.apache.dolphinscheduler.locator.project.CreateProjectLocator; +import org.apache.dolphinscheduler.data.project.ProjectData; +import org.apache.dolphinscheduler.locator.project.ProjectLocator; import org.openqa.selenium.WebDriver; -public class CreateProjectPage extends PageCommon { - public CreateProjectPage(WebDriver driver) { +public class ProjectPage extends PageCommon { + public ProjectPage(WebDriver driver) { super(driver); } @@ -31,9 +31,9 @@ public class CreateProjectPage extends PageCommon { * jump to ProjectManagePage */ public boolean jumpProjectManagePage() throws InterruptedException { - clickTopElement(CreateProjectLocator.PROJECT_MANAGE); + clickTopElement(ProjectLocator.PROJECT_MANAGE); Thread.sleep(TestConstant.ONE_THOUSAND); - return ifTitleContains(CreateProjectData.PROJECT_TITLE); + return ifTitleContains(ProjectData.PROJECT_TITLE); } /** @@ -42,17 +42,18 @@ public class CreateProjectPage extends PageCommon { * @return Whether to enter the specified page after create project */ public boolean createProject() throws InterruptedException { - clickElement(CreateProjectLocator.CREATE_PROJECT_BUTTON); + Thread.sleep(500); + clickElement(ProjectLocator.CREATE_PROJECT_BUTTON); // input create project data - sendInput(CreateProjectLocator.PROJECT_NAME, CreateProjectData.PROJECT_NAME); - sendInput(CreateProjectLocator.PROJECT_DESCRIPTION, CreateProjectData.DESCRIPTION); + sendInput(ProjectLocator.PROJECT_NAME, ProjectData.PROJECT_NAME); + sendInput(ProjectLocator.PROJECT_DESCRIPTION, ProjectData.DESCRIPTION); // click submit button - clickButton(CreateProjectLocator.SUBMIT_BUTTON); + clickButton(ProjectLocator.SUBMIT_BUTTON); // Whether to enter the specified page after submit - return ifTitleContains(CreateProjectData.PROJECT_TITLE); + return ifTitleContains(ProjectData.PROJECT_TITLE); } /** @@ -62,12 +63,12 @@ public class CreateProjectPage extends PageCommon { */ public boolean deleteProject() throws InterruptedException { //click delete project - clickElement(CreateProjectLocator.DELETE_PROJECT_BUTTON); + clickElement(ProjectLocator.DELETE_PROJECT_BUTTON); //click confirm delete project - clickElement(CreateProjectLocator.CONFIRM_DELETE_PROJECT_BUTTON); + clickElement(ProjectLocator.CONFIRM_DELETE_PROJECT_BUTTON); // Whether to enter the specified page after submit - return ifTitleContains(CreateProjectData.PROJECT_TITLE); + return ifTitleContains(ProjectData.PROJECT_TITLE); } } diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/TimingPage.java b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/TimingPage.java index f74f4608ae..e8989ff8e8 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/TimingPage.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/TimingPage.java @@ -64,11 +64,11 @@ public class TimingPage extends PageCommon { public boolean editTiming() throws InterruptedException { // click timing button System.out.println("Click timing management button"); + Thread.sleep(1000); clickButton(TimingLocator.CLICK_TIMING_MANAGEMENT_BUTTON); - Thread.sleep(500); + Thread.sleep(1000); System.out.println("Click edit timing button"); clickButton(TimingLocator.CLICK_EDIT_TIMING_BUTTON); - Thread.sleep(500); System.out.println("Click execution timing button"); clickButton(TimingLocator.CLICK_EXECUTION_TIMING_BUTTON); Thread.sleep(1000); diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/page/project/WorkflowDefinePage.java b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/WorkflowDefinePage.java new file mode 100644 index 0000000000..9e462805da --- /dev/null +++ b/e2e/src/test/java/org/apache/dolphinscheduler/page/project/WorkflowDefinePage.java @@ -0,0 +1,226 @@ +/* + * 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.page.project; + +import org.apache.dolphinscheduler.common.PageCommon; +import org.apache.dolphinscheduler.constant.TestConstant; +import org.apache.dolphinscheduler.data.project.WorkflowDefineData; +import org.apache.dolphinscheduler.locator.project.WorkflowDefineLocator; +import org.openqa.selenium.WebDriver; + +public class WorkflowDefinePage extends PageCommon { + public WorkflowDefinePage(WebDriver driver) { + super(driver); + } + + /** + * jump create workflow page + */ + + public boolean jumpWorkflowPage() throws InterruptedException { + // click project name + clickElement(WorkflowDefineLocator.CLICK_PROJECT_NAME); + Thread.sleep(TestConstant.ONE_THOUSAND); + + System.out.println("Click on workflow define to jump to workflow define page"); + // click workflow define + clickElement(WorkflowDefineLocator.CLICK_WORKFLOW_DEFINE); + + return ifTitleContains(WorkflowDefineData.WORKFLOW_TITLE); + } + + public boolean createWorkflow() throws InterruptedException { + System.out.println("Click create workflow button"); + // click create workflow button + clickElement(WorkflowDefineLocator.CLICK_CREATE_WORKFLOW_BUTTON); + + System.out.println("drag shell task"); + //drag shell_task + dragAndDrop(WorkflowDefineLocator.MOUSE_DOWN_AT_SHELL, WorkflowDefineLocator.MOUSE_MOVE_SHELL_AT_DAG); + + //input shell task _name + sendInput(WorkflowDefineLocator.INPUT_SHELL_TASK_NAME , WorkflowDefineData.SHELL_TASK_NAME); + + //click stop run type + clickElement(WorkflowDefineLocator.CLICK_STOP_RUN_TYPE); + + //click normal run type + clickElement(WorkflowDefineLocator.CLICK_NORMAL_RUN_TYPE); + + //input shell task description + sendInput(WorkflowDefineLocator.INPUT_SHELL_TASK_DESCRIPTION , WorkflowDefineData.SHELL_TASK_DESCRIPTION); + + //select task priority + clickElement(WorkflowDefineLocator.CLICK_TASK_PRIORITY); + clickElement(WorkflowDefineLocator.SELECT_TASK_PRIORITY); + + //select work group + clickElement(WorkflowDefineLocator.CLICK_WORK_GROUP); + clickElement(WorkflowDefineLocator.SELECT_WORK_GROUP); + + //select number of failed retries + clickElement(WorkflowDefineLocator.SELECT_FAIL_RETRIES_NUMBER); + + //select failed retry interval + clickElement(WorkflowDefineLocator.SELECT_FAIL_RETRIES_INTERVAL); + + //click timeout alarm + clickElement(WorkflowDefineLocator.CLICK_TIMEOUT_ALARM); + + //select timeout fail + clickElement(WorkflowDefineLocator.SELECT_TIMEOUT_FAIL); + + //cancel timeout alarm + clickElement(WorkflowDefineLocator.CANCEL_TIMEOUT_ALARM); + + //select timeout alarm + clickElement(WorkflowDefineLocator.SELECT_TIMEOUT_ALARM); + + //clear timeout + clearInput(WorkflowDefineLocator.SELECT_TIMEOUT); + clearInput(WorkflowDefineLocator.SELECT_TIMEOUT); + + //input timeout + sendInput(WorkflowDefineLocator.SELECT_TIMEOUT, WorkflowDefineData.INPUT_TIMEOUT); + + //click codeMirror and input script + inputCodeMirror(WorkflowDefineLocator.CLICK_CODE_MIRROR, WorkflowDefineLocator.INPUT_SCRIPT, WorkflowDefineData.SHELL_SCRIPT); + scrollToElementBottom(WorkflowDefineLocator.SCROLL_BOTTOM); + + //click custom parameters + clickElement(WorkflowDefineLocator.CLICK_CUSTOM_PARAMETERS); + + //input custom parameters + sendInput(WorkflowDefineLocator.INPUT_CUSTOM_PARAMETERS, WorkflowDefineData.INPUT_CUSTOM_PARAMETERS); + + //input custom parameters value + sendInput(WorkflowDefineLocator.INPUT_CUSTOM_PARAMETERS_VALUE, WorkflowDefineData.INPUT_CUSTOM_PARAMETERS_VALUE); + + //click add custom parameters + clickElement(WorkflowDefineLocator.CLICK_ADD_CUSTOM_PARAMETERS); + + scrollToElementBottom(WorkflowDefineLocator.SCROLL_BOTTOM); + + //input add custom parameters + sendInput(WorkflowDefineLocator.INPUT_ADD_CUSTOM_PARAMETERS, WorkflowDefineData.INPUT_ADD_CUSTOM_PARAMETERS); + + //input add custom parameters value + sendInput(WorkflowDefineLocator.INPUT_ADD_CUSTOM_PARAMETERS_VALUE, WorkflowDefineData.INPUT_ADD_CUSTOM_PARAMETERS_VALUE); + + //click delete custom parameters + clickElement(WorkflowDefineLocator.CLICK_DELETE_CUSTOM_PARAMETERS); + + //click submit button + clickElement(WorkflowDefineLocator.CLICK_SUBMIT_BUTTON); + Thread.sleep(TestConstant.ONE_THOUSAND); + System.out.println("Task node set up successfully"); + System.out.println("move to Dag Element "); + moveToDragElement(WorkflowDefineLocator.MOUSE_MOVE_SHELL_AT_DAG,-300,-100); + + return ifTitleContains(WorkflowDefineData.CREATE_WORKFLOW_TITLE); + } + + /** + * save workflow + */ + public boolean saveWorkflow() throws InterruptedException { + System.out.println("start to save workflow "); + + //click save workflow button + clickElement(WorkflowDefineLocator.CLICK_SAVE_WORKFLOW_BUTTON); + + //input workflow name + sendInput(WorkflowDefineLocator.INPUT_WORKFLOW_NAME, WorkflowDefineData.INPUT_WORKFLOW_NAME); + + //input workflow description + sendInput(WorkflowDefineLocator.INPUT_WORKFLOW_DESCRIPTION, WorkflowDefineData.INPUT_WORKFLOW_DESCRIPTION); + + //select tenant + clickElement(WorkflowDefineLocator.CLICK_TENANT); + clickElement(WorkflowDefineLocator.SELECT_TENANT); + + //click workflow timeout alarm + clickElement(WorkflowDefineLocator.CLICK_WORKFLOW_TIMEOUT_ALARM); + clearInput(WorkflowDefineLocator.INPUT_WORKFLOW_TIMEOUT); + + //input workflow timeout + sendInput(WorkflowDefineLocator.INPUT_WORKFLOW_TIMEOUT, WorkflowDefineData.INPUT_WORKFLOW_TIMEOUT); + + //click workflow global parameters + clickElement(WorkflowDefineLocator.CLICK_WORKFLOW_GLOBAL_PARAMETERS); + + //input workflow global parameters + sendInput(WorkflowDefineLocator.INPUT_WORKFLOW_GLOBAL_PARAMETERS, WorkflowDefineData.INPUT_WORKFLOW_GLOBAL_PARAMETERS); + + //input workflow global parameters value + sendInput(WorkflowDefineLocator.INPUT_WORKFLOW_GLOBAL_PARAMETERS_VALUES, WorkflowDefineData.INPUT_WORKFLOW_GLOBAL_PARAMETERS_VALUES); + + //click to add workflow global parameters + clickElement(WorkflowDefineLocator.CLICK_ADD_WORKFLOW_GLOBAL_PARAMETERS); + + //input to add workflow global parameters + sendInput(WorkflowDefineLocator.INPUT_ADD_WORKFLOW_GLOBAL_PARAMETERS, WorkflowDefineData.INPUT_ADD_WORKFLOW_GLOBAL_PARAMETERS); + + //input to add workflow global parameters value + sendInput(WorkflowDefineLocator.INPUT_ADD_WORKFLOW_GLOBAL_PARAMETERS_VALUES, WorkflowDefineData.INPUT_ADD_WORKFLOW_GLOBAL_PARAMETERS_VALUES); + + //delete workflow global parameters value + clickElement(WorkflowDefineLocator.CLICK_DELETE_WORKFLOW_GLOBAL_PARAMETERS); + Thread.sleep(TestConstant.ONE_THOUSAND); + + //click add button + System.out.println("submit workflow"); + clickButton(WorkflowDefineLocator.CLICK_ADD_BUTTON); + + return ifTitleContains(WorkflowDefineData.CREATE_WORKFLOW_TITLE); + } + + public boolean onlineWorkflow() throws InterruptedException { + clickElement(WorkflowDefineLocator.CLICK_WORKFLOW_DEFINE); + + // click online button + System.out.println("Click online workflow button"); + clickButton(WorkflowDefineLocator.CLICK_ONLINE_WORKFLOW_BUTTON); + + return ifTitleContains(WorkflowDefineData.WORKFLOW_TITLE); + } + + public boolean offlineWorkflow() throws InterruptedException { + clickElement(WorkflowDefineLocator.CLICK_WORKFLOW_DEFINE); + + // click offline button + System.out.println("offline workflow"); + Thread.sleep(500); + clickButton(WorkflowDefineLocator.CLICK_OFFLINE_WORKFLOW_BUTTON); + + return ifTitleContains(WorkflowDefineData.WORKFLOW_TITLE); + } + + + public boolean deleteWorkflow() throws InterruptedException { + //click delete workflow + Thread.sleep(500); + clickElement(WorkflowDefineLocator.CLICK_WORKFLOW_DEFINE); + clickButton(WorkflowDefineLocator.DELETE_WORKFLOW_BOTTOM); + + //click confirm delete project + clickButton(WorkflowDefineLocator.CONFIRM_DELETE_WORKFLOW_BOTTOM); + + // Whether to enter the specified page after submit + return ifTitleContains(WorkflowDefineData.WORKFLOW_TITLE); + } +} diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteProject.java b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteProject.java index bcd4291e0e..9a1374ca34 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteProject.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteProject.java @@ -17,15 +17,15 @@ package org.apache.dolphinscheduler.testcase.testDeleteData; import org.apache.dolphinscheduler.base.BaseTest; -import org.apache.dolphinscheduler.page.project.CreateProjectPage; +import org.apache.dolphinscheduler.page.project.ProjectPage; import org.testng.annotations.Test; public class TestDeleteProject extends BaseTest { - private CreateProjectPage createProjectPage; + private ProjectPage createProjectPage; @Test(groups={"functionTests"},dependsOnGroups = { "login","project"},description = "TestDeleteProject") public void testDeleteProject() throws InterruptedException { - createProjectPage = new CreateProjectPage(driver); + createProjectPage = new ProjectPage(driver); //jump to project manage page System.out.println("jump to the project manage page to delete project"); createProjectPage.jumpProjectManagePage(); diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteWorkflow.java b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteWorkflow.java index 2d7714e4e9..3544b19f3c 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteWorkflow.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteWorkflow.java @@ -17,27 +17,29 @@ package org.apache.dolphinscheduler.testcase.testDeleteData; import org.apache.dolphinscheduler.base.BaseTest; -import org.apache.dolphinscheduler.page.project.CreateProjectPage; -import org.apache.dolphinscheduler.page.project.CreateWorkflowPage; +import org.apache.dolphinscheduler.page.project.ProjectPage; +import org.apache.dolphinscheduler.page.project.WorkflowDefinePage; import org.testng.annotations.Test; public class TestDeleteWorkflow extends BaseTest { - private CreateWorkflowPage createWorkflowPage; - private CreateProjectPage createProjectPage; + private WorkflowDefinePage createWorkflowPage; + private ProjectPage createProjectPage; + /** + * offline workflow + * @throws InterruptedException + */ @Test(groups={"functionTests"},dependsOnGroups = { "login","workflow"},description = "TestDeleteWorkflow") - 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(); + public void testOfflineWorkflow() throws InterruptedException { + createWorkflowPage = new WorkflowDefinePage(driver); System.out.println("start offline workflow"); assert createWorkflowPage.offlineWorkflow(); System.out.println("end offline workflow"); + System.out.println("==================================="); + } + @Test(groups={"functionTests"},dependsOnGroups = { "login","workflow"},description = "TestDeleteWorkflow") + public void testDeleteWorkflow() throws InterruptedException { System.out.println("start delete workflow"); assert createWorkflowPage.deleteWorkflow(); System.out.println("end delete workflow"); diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestProcessInstance.java b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestProcessInstance.java new file mode 100644 index 0000000000..dc77e5f27b --- /dev/null +++ b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestProcessInstance.java @@ -0,0 +1,35 @@ +/* + * 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.testProject; + +import org.apache.dolphinscheduler.base.BaseTest; +import org.apache.dolphinscheduler.page.project.ProcessInstancePage; +import org.testng.annotations.Test; + +public class TestProcessInstance extends BaseTest { + private ProcessInstancePage processInstancePage; + + @Test(groups={"functionTests","processInstance"},dependsOnGroups = { "login","workflow" },description = "testRerun") + public void testRerun() throws InterruptedException { + processInstancePage = new ProcessInstancePage(driver); + //rerun workflow + System.out.println("start rerun workflow"); + processInstancePage.rerunWorkflowPage(); + System.out.println("end rerun workflow"); + System.out.println("==================================="); + } +} diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestCreateProject.java b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestProject.java similarity index 81% rename from e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestCreateProject.java rename to e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestProject.java index 925cf02a8b..75c41be22b 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestCreateProject.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestProject.java @@ -17,21 +17,21 @@ package org.apache.dolphinscheduler.testcase.testProject; import org.apache.dolphinscheduler.base.BaseTest; -import org.apache.dolphinscheduler.page.project.CreateProjectPage; +import org.apache.dolphinscheduler.page.project.ProjectPage; import org.testng.annotations.Test; -public class TestCreateProject extends BaseTest { - private CreateProjectPage createProjectPage; +public class TestProject extends BaseTest { + private ProjectPage projectPage; @Test(groups={"functionTests","project"},dependsOnGroups = { "login" },description = "CreateProjectTest") public void testCreateProject() throws InterruptedException { - createProjectPage = new CreateProjectPage(driver); + projectPage = new ProjectPage(driver); // enter user manage page System.out.println("jump to the projectManage page to create project "); - createProjectPage.jumpProjectManagePage(); + projectPage.jumpProjectManagePage(); //assert user manage page System.out.println("start create project"); - assert createProjectPage.createProject(); + assert projectPage.createProject(); System.out.println("end create project"); System.out.println("==================================="); } diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestRunWorkflow.java b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestRunWorkflow.java index 9d641bd2fb..70bb7774a7 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestRunWorkflow.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestRunWorkflow.java @@ -17,14 +17,14 @@ package org.apache.dolphinscheduler.testcase.testProject; import org.apache.dolphinscheduler.base.BaseTest; -import org.apache.dolphinscheduler.page.project.CreateProjectPage; -import org.apache.dolphinscheduler.page.project.CreateWorkflowPage; +import org.apache.dolphinscheduler.page.project.ProjectPage; +import org.apache.dolphinscheduler.page.project.WorkflowDefinePage; import org.apache.dolphinscheduler.page.project.RunWorkflowPage; import org.testng.annotations.Test; public class TestRunWorkflow extends BaseTest { - private CreateWorkflowPage createWorkflowPage; - private CreateProjectPage createProjectPage; + private WorkflowDefinePage createWorkflowPage; + private ProjectPage projectPage; private RunWorkflowPage runWorkflowPage; @@ -32,7 +32,7 @@ public class TestRunWorkflow extends BaseTest { public void testRunWorkflow() throws InterruptedException { runWorkflowPage = new RunWorkflowPage(driver); - createProjectPage = new CreateProjectPage(driver); + projectPage = new ProjectPage(driver); System.out.println("start run workflow"); assert runWorkflowPage.runWorkflow(); System.out.println("end run workflow"); diff --git a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestCreateWorkflow.java b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestWorkflowDefine.java similarity index 59% rename from e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestCreateWorkflow.java rename to e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestWorkflowDefine.java index bac5b1a43c..31df36d2a1 100644 --- a/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestCreateWorkflow.java +++ b/e2e/src/test/java/org/apache/dolphinscheduler/testcase/testProject/TestWorkflowDefine.java @@ -17,32 +17,40 @@ package org.apache.dolphinscheduler.testcase.testProject; import org.apache.dolphinscheduler.base.BaseTest; -import org.apache.dolphinscheduler.page.project.CreateProjectPage; -import org.apache.dolphinscheduler.page.project.CreateWorkflowPage; +import org.apache.dolphinscheduler.page.project.ProjectPage; +import org.apache.dolphinscheduler.page.project.WorkflowDefinePage; import org.testng.annotations.Test; -public class TestCreateWorkflow extends BaseTest { - private CreateWorkflowPage createWorkflowPage; - private CreateProjectPage createProjectPage; +public class TestWorkflowDefine extends BaseTest { + private WorkflowDefinePage workflowDefinePage; + private ProjectPage projectPage; - - @Test(groups={"functionTests","workflow"},dependsOnGroups = { "login" },description = "TestCreateWorkflow") + /** + * test Create WorkflowDefine + * @throws InterruptedException + */ + @Test(groups={"functionTests","workflow"},dependsOnGroups = { "login" },description = "TestWorkflowDefine") public void testCreateWorkflow() throws InterruptedException { - createProjectPage = new CreateProjectPage(driver); + projectPage = new ProjectPage(driver); System.out.println("jump to the projectManage page to create workflow"); - createProjectPage.jumpProjectManagePage(); + projectPage.jumpProjectManagePage(); - createWorkflowPage = new CreateWorkflowPage(driver); + workflowDefinePage = new WorkflowDefinePage(driver); System.out.println("Click on the project name to jump to the project homepage"); - createWorkflowPage.jumpWorkflowPage(); + workflowDefinePage.jumpWorkflowPage(); System.out.println("start create workflow"); - assert createWorkflowPage.createWorkflow(); - assert createWorkflowPage.saveWorkflow(); + assert workflowDefinePage.createWorkflow(); + assert workflowDefinePage.saveWorkflow(); System.out.println("end create workflow"); + System.out.println("==================================="); + } + @Test(groups={"functionTests","workflow"},dependsOnGroups = { "login" },description = "TestOnlineWorkflow") + public void testOnlineWorkflow() throws InterruptedException { + workflowDefinePage = new WorkflowDefinePage(driver); System.out.println("start online workflow"); - assert createWorkflowPage.onlineWorkflow(); + assert workflowDefinePage.onlineWorkflow(); System.out.println("end online workflow"); System.out.println("==================================="); } diff --git a/e2e/testng.xml b/e2e/testng.xml index ee09e197d9..32bd0c6009 100644 --- a/e2e/testng.xml +++ b/e2e/testng.xml @@ -26,6 +26,7 @@ + @@ -37,8 +38,19 @@ - - + + + + + + + + + + + + + @@ -50,8 +62,19 @@ + + + + + + + + + + + + -