Loading e2e/src/test/java/org/apache/dolphinscheduler/data/security/AlertManageData.java 0 → 100644 +36 −0 Original line number Diff line number Diff line /* * 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"; } e2e/src/test/java/org/apache/dolphinscheduler/locator/security/AlertManageLocator.java 0 → 100644 +35 −0 Original line number Diff line number Diff line /* * 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"); } e2e/src/test/java/org/apache/dolphinscheduler/page/security/AlertManagePage.java 0 → 100644 +77 −0 Original line number Diff line number Diff line /* * 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); } } e2e/src/test/java/org/apache/dolphinscheduler/testcase/LoginTest.java→e2e/src/test/java/org/apache/dolphinscheduler/testcase/TestLogin.java +2 −2 Original line number Diff line number Diff line Loading @@ -22,10 +22,10 @@ import org.testng.annotations.Test; import static org.apache.dolphinscheduler.base.BaseTest.driver; @Test(groups={"functionTests","login"}) public class LoginTest { public class TestLogin { private LoginPage loginPage; @Test(description = "LoginTest", priority = 1) @Test(description = "TestLogin") public void testLogin() throws InterruptedException { loginPage = new LoginPage(driver); System.out.println("==================================="); Loading e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteAlert.java 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * 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("==================================="); } } Loading
e2e/src/test/java/org/apache/dolphinscheduler/data/security/AlertManageData.java 0 → 100644 +36 −0 Original line number Diff line number Diff line /* * 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"; }
e2e/src/test/java/org/apache/dolphinscheduler/locator/security/AlertManageLocator.java 0 → 100644 +35 −0 Original line number Diff line number Diff line /* * 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"); }
e2e/src/test/java/org/apache/dolphinscheduler/page/security/AlertManagePage.java 0 → 100644 +77 −0 Original line number Diff line number Diff line /* * 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); } }
e2e/src/test/java/org/apache/dolphinscheduler/testcase/LoginTest.java→e2e/src/test/java/org/apache/dolphinscheduler/testcase/TestLogin.java +2 −2 Original line number Diff line number Diff line Loading @@ -22,10 +22,10 @@ import org.testng.annotations.Test; import static org.apache.dolphinscheduler.base.BaseTest.driver; @Test(groups={"functionTests","login"}) public class LoginTest { public class TestLogin { private LoginPage loginPage; @Test(description = "LoginTest", priority = 1) @Test(description = "TestLogin") public void testLogin() throws InterruptedException { loginPage = new LoginPage(driver); System.out.println("==================================="); Loading
e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteAlert.java 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * 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("==================================="); } }