ProjectPage.java 2.7 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.constant.TestConstant;
21 22
import org.apache.dolphinscheduler.data.project.ProjectData;
import org.apache.dolphinscheduler.locator.project.ProjectLocator;
23 24
import org.openqa.selenium.WebDriver;

25 26
public class ProjectPage extends PageCommon {
    public ProjectPage(WebDriver driver) {
27 28
        super(driver);
    }
29

30
    /**
31
     * jump to ProjectManagePage
32
     */
33
    public boolean jumpProjectManagePage() throws InterruptedException {
34 35
        clickTopElement(ProjectLocator.PROJECT_MANAGE);
        return ifTitleContains(ProjectData.PROJECT_TITLE);
36 37 38
    }

    /**
39
     * create project
40
     *
41
     * @return Whether to enter the specified page after create project
42 43
     */
    public boolean createProject() throws InterruptedException {
44
        ifTextExists(ProjectLocator.CREATE_PROJECT_BUTTON,ProjectData.CREATE_PROJECT_BUTTON);
45
        clickElement(ProjectLocator.CREATE_PROJECT_BUTTON);
46 47

        // input create project data
48 49
        sendInput(ProjectLocator.PROJECT_NAME, ProjectData.PROJECT_NAME);
        sendInput(ProjectLocator.PROJECT_DESCRIPTION, ProjectData.DESCRIPTION);
50 51

        // click submit  button
52
        clickButton(ProjectLocator.SUBMIT_BUTTON);
53 54

        // Whether to enter the specified page after submit
55
        return ifTextExists(ProjectLocator.LIST_PROJECT_NAME,ProjectData.PROJECT_NAME);
56
    }
57 58 59 60 61 62 63 64

    /**
     * delete project
     *
     * @return Whether to enter the specified page after delete project
     */
    public boolean deleteProject() throws InterruptedException {
        //click  delete project
65
        clickElement(ProjectLocator.DELETE_PROJECT_BUTTON);
66 67

        //click confirm delete project
68
        clickElement(ProjectLocator.CONFIRM_DELETE_PROJECT_BUTTON);
69 70

        // Whether to enter the specified page after submit
71
        return ifTitleContains(ProjectData.PROJECT_TITLE);
72
    }
73
}