AlertManagePage.java 3.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
/*
 * 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.security;

import org.apache.dolphinscheduler.common.PageCommon;
import org.apache.dolphinscheduler.data.security.AlertManageData;
import org.apache.dolphinscheduler.locator.security.AlertManageLocator;
import org.openqa.selenium.WebDriver;

public class AlertManagePage extends PageCommon {
    /**
     * Unique constructor
     * @param driver driver
     */
    public AlertManagePage(WebDriver driver) {
        super(driver);
    }

    /**
34
     * create alert
35 36 37 38 39
     *
     * @return Whether to enter the specified page after create tenant
     */
    public boolean createAlert() throws InterruptedException {
        // click  alert manage
40
        System.out.println("start click alert manage button");
41
        clickElement(AlertManageLocator.CLICK_ALERT_MANAGE);
42 43 44

        //determine whether the create alert button exists
        ifTextExists(AlertManageLocator.CLICK_CREATE_ALERT,AlertManageData.CREATE_ALERT);
45 46

        // click  create alert button
47
        System.out.println("start click create alert  button");
48 49
        clickElement(AlertManageLocator.CLICK_CREATE_ALERT);
        // input alert data
50
        System.out.println("start input  alert ");
51 52 53 54 55 56 57 58 59 60 61 62
        sendInput(AlertManageLocator.INPUT_ALERT_NAME, AlertManageData.ALERT_NAME);

        clickElement(AlertManageLocator.CLICK_ALERT_TYPE);

        clickElement(AlertManageLocator.SELECT_ALERT_EMAIL);

        sendInput(AlertManageLocator.INPUT_ALERT_DESCRIPTION, AlertManageData.DESCRIPTION);

        // click  button
        clickButton(AlertManageLocator.SUBMIT_ALERT);

        // Whether to enter the specified page after submit
63
        return ifTextExists(AlertManageLocator.ALERT_NAME, AlertManageData.ALERT_NAME);
64 65 66 67
    }

    public boolean deleteAlert() throws InterruptedException {

68
        // click  alert manage
69 70
        clickElement(AlertManageLocator.CLICK_ALERT_MANAGE);

71 72 73
        ifTextExists(AlertManageLocator.ALERT_NAME, AlertManageData.ALERT_NAME);

        // click  delete alert button
74 75 76 77 78 79 80 81 82
        clickButton(AlertManageLocator.DELETE_ALERT_BUTTON);

        // click confirm delete button
        clickButton(AlertManageLocator.CONFIRM_DELETE_ALERT_BUTTON);

        // Whether to enter the specified page after submit
        return ifTitleContains(AlertManageData.ALERT_MANAGE);
    }
}