RunWorkflowPage.java 2.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/*
 * 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.data.project.RunWorkflowData;
21
import org.apache.dolphinscheduler.data.project.WorkflowDefineData;
22
import org.apache.dolphinscheduler.locator.project.RunWorkflowLocator;
23
import org.apache.dolphinscheduler.locator.project.WorkflowDefineLocator;
24 25 26 27 28 29 30 31
import org.openqa.selenium.WebDriver;

public class RunWorkflowPage extends PageCommon {
    public RunWorkflowPage(WebDriver driver) {
        super(driver);
    }

    public boolean runWorkflow() throws InterruptedException {
32 33 34
        // Determine whether the workflow status is online
        ifTextExists(WorkflowDefineLocator.WORKFLOW_STATE, WorkflowDefineData.WORKFLOW_ONLINE_STATE);

35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
        // click run workflow button
        System.out.println("Click run workflow button");
        clickButton(RunWorkflowLocator.CLICK_RUN_WORKFLOW_BUTTON);

        clickElement(RunWorkflowLocator.SELECT_FAILURE_STRATEGY_END);
        clickElement(RunWorkflowLocator.SELECT_FAILURE_STRATEGY_CONTINUE);
        clickElement(RunWorkflowLocator.CLICK_NOTICE_STRATEGY);
        clickElement(RunWorkflowLocator.SELECT_NOTICE_STRATEGY);
        clickElement(RunWorkflowLocator.CLICK_PROCESS_PRIORITY);
        clickElement(RunWorkflowLocator.SELECT_PROCESS_PRIORITY_HIGHEST);
        clickElement(RunWorkflowLocator.CLICK_WORKER_GROUP);
        clickElement(RunWorkflowLocator.SELECT_WORKER_GROUP);
        clickElement(RunWorkflowLocator.CLICK_NOTICE_GROUP);
        clickElement(RunWorkflowLocator.SELECT_NOTICE_GROUP);
        sendInput(RunWorkflowLocator.INPUT_RECIPIENT, RunWorkflowData.RECIPIENT);
        sendInput(RunWorkflowLocator.INPUT_Cc,RunWorkflowData.Cc);
        clickButton(RunWorkflowLocator.CLICK_RUNNING_BUTTON);

        return ifTitleContains(RunWorkflowData.RUN_WORKFLOW_TITLE);
    }
}