eights
5 years ago
15 changed files with 266 additions and 37 deletions
@ -0,0 +1,36 @@
|
||||
/* |
||||
* 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.security; |
||||
|
||||
public class AlertManageData { |
||||
/** |
||||
* Alert Name |
||||
*/ |
||||
public static final String ALERT_NAME = "selenium_alert_Name"; |
||||
/** |
||||
* Alert Type |
||||
*/ |
||||
public static final String ALERT_TYPE = "邮件"; |
||||
|
||||
/** |
||||
* Alert Description |
||||
*/ |
||||
public static final String DESCRIPTION = "create alert test"; |
||||
|
||||
public static final String ALERT_MANAGE = "告警组管理 - DolphinScheduler"; |
||||
|
||||
} |
@ -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.locator.security; |
||||
|
||||
import org.openqa.selenium.By; |
||||
|
||||
public class AlertManageLocator { |
||||
//create alert locator
|
||||
public static final By CLICK_ALERT_MANAGE = By.xpath("//div[4]/div/a/div/a/span"); |
||||
public static final By CLICK_CREATE_ALERT = By.xpath("//div[1]/div[2]/div/div[2]/div[2]/div/div[1]/button/span"); |
||||
public static final By INPUT_ALERT_NAME = By.xpath("//div[2]/div/div[1]/div[2]/div/input"); |
||||
public static final By CLICK_ALERT_TYPE = By.xpath("//div[2]/div/div[2]/div/div[2]/div[2]/div/div[1]/div/input"); |
||||
public static final By SELECT_ALERT_EMAIL = By.xpath("//div[2]/div/div[2]/div/div[2]/div[2]/div/div[2]/div/div/div/ul/li[1]/span"); |
||||
public static final By INPUT_ALERT_DESCRIPTION = By.xpath("//textarea"); |
||||
public static final By SUBMIT_ALERT = By.xpath("//div[3]/button[2]/span"); |
||||
|
||||
//delete alert locator
|
||||
public static final By DELETE_ALERT_BUTTON = By.xpath("//span/button"); |
||||
public static final By CONFIRM_DELETE_ALERT_BUTTON = By.xpath("//div[2]/div/button[2]/span"); |
||||
} |
||||
|
@ -0,0 +1,77 @@
|
||||
/* |
||||
* 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); |
||||
} |
||||
|
||||
/** |
||||
* createTenant |
||||
* |
||||
* @return Whether to enter the specified page after create tenant |
||||
*/ |
||||
public boolean createAlert() throws InterruptedException { |
||||
// click alert manage
|
||||
clickElement(AlertManageLocator.CLICK_ALERT_MANAGE); |
||||
Thread.sleep(2000); |
||||
|
||||
// click create alert button
|
||||
clickElement(AlertManageLocator.CLICK_CREATE_ALERT); |
||||
Thread.sleep(2000); |
||||
|
||||
// input alert data
|
||||
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
|
||||
return ifTitleContains(AlertManageData.ALERT_MANAGE); |
||||
} |
||||
|
||||
public boolean deleteAlert() throws InterruptedException { |
||||
|
||||
// click user manage
|
||||
clickElement(AlertManageLocator.CLICK_ALERT_MANAGE); |
||||
|
||||
// click delete user button
|
||||
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); |
||||
} |
||||
} |
@ -0,0 +1,42 @@
|
||||
/* |
||||
* 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.testDeleteData; |
||||
|
||||
import org.apache.dolphinscheduler.base.BaseTest; |
||||
import org.apache.dolphinscheduler.page.security.AlertManagePage; |
||||
import org.apache.dolphinscheduler.page.security.TenantManagePage; |
||||
import org.testng.annotations.Test; |
||||
|
||||
public class TestDeleteAlert extends BaseTest { |
||||
private AlertManagePage alertManagePage; |
||||
private TenantManagePage tenantManagePage; |
||||
|
||||
@Test(groups={"functionTests"},dependsOnGroups = { "login","alert" },description = "TestDeleteAlert",priority=8) |
||||
public void testDeleteAlert() throws InterruptedException { |
||||
tenantManagePage = new TenantManagePage(driver); |
||||
System.out.println("jump to testSecurity to delete alert"); |
||||
tenantManagePage.jumpSecurity(); |
||||
|
||||
alertManagePage = new AlertManagePage(driver); |
||||
|
||||
//assert alert manage page
|
||||
System.out.println("start delete alert"); |
||||
assert alertManagePage.deleteAlert(); |
||||
System.out.println("end delete alert"); |
||||
System.out.println("==================================="); |
||||
} |
||||
} |
@ -0,0 +1,36 @@
|
||||
/* |
||||
* 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.testSecurity; |
||||
|
||||
import org.apache.dolphinscheduler.base.BaseTest; |
||||
import org.apache.dolphinscheduler.page.security.AlertManagePage; |
||||
import org.testng.annotations.Test; |
||||
|
||||
public class TestAlertManage extends BaseTest { |
||||
private AlertManagePage alertManagePage; |
||||
|
||||
@Test(groups={"functionTests","alert"},dependsOnGroups = { "login" },description = "AlertManagePage") |
||||
public void testAlertManage() throws InterruptedException { |
||||
alertManagePage = new AlertManagePage(driver); |
||||
//assert alert manage page
|
||||
System.out.println("start create alert"); |
||||
assert alertManagePage.createAlert(); |
||||
System.out.println("end create alert"); |
||||
System.out.println("==================================="); |
||||
|
||||
} |
||||
} |
Loading…
Reference in new issue