Browse Source

e2e add queue testcase (#2949)

* add LoginTest license

* Delete useless packages

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

* e2e add project and workflow case

* Update worker_group_id to worker_group in init.sql

* Update worker_group_id to worker_group in init.sql

* Update worker_group_id to worker_group

* Increase dataX environment variable, sslTrust default value

* modify dataX environment variable

* update e2e chrome version

* add alert manage testcase and Optimize test case execution order

* add e2e to create and to  edit  queue

* update e2e chrome version

* add e2e token testcase

* add e2e token testcase

Co-authored-by: chenxingchun <438044805@qq.com>
pull/2/head
xingchun-chen 5 years ago committed by GitHub
parent
commit
87d0379895
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 34
      e2e/src/test/java/org/apache/dolphinscheduler/common/BrowserCommon.java
  2. 42
      e2e/src/test/java/org/apache/dolphinscheduler/data/security/QueueManageData.java
  3. 24
      e2e/src/test/java/org/apache/dolphinscheduler/data/security/TokenManageData.java
  4. 31
      e2e/src/test/java/org/apache/dolphinscheduler/locator/security/QueueManageLocator.java
  5. 41
      e2e/src/test/java/org/apache/dolphinscheduler/locator/security/TokenManageLocator.java
  6. 4
      e2e/src/test/java/org/apache/dolphinscheduler/page/security/AlertManagePage.java
  7. 85
      e2e/src/test/java/org/apache/dolphinscheduler/page/security/QueueManagePage.java
  8. 94
      e2e/src/test/java/org/apache/dolphinscheduler/page/security/TokenManagePage.java
  9. 42
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteToken.java
  10. 42
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestQueueManage.java
  11. 43
      e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestTokenManage.java
  12. 3
      e2e/testng.xml

34
e2e/src/test/java/org/apache/dolphinscheduler/common/BrowserCommon.java

@ -23,7 +23,7 @@ import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import redis.clients.jedis.Jedis;
import org.openqa.selenium.JavascriptExecutor;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@ -115,6 +115,7 @@ public class BrowserCommon {
/**
* Click button element
*
* @param locator By
* @return clickButton
*/
@ -128,12 +129,13 @@ public class BrowserCommon {
/**
* Click Navigation Bar element
*
* @param locator By
* @return clickButton
*/
public void clickTopElement(By locator) {
WebElement element = driver.findElement(locator);
JavascriptExecutor executor = (JavascriptExecutor)driver;
JavascriptExecutor executor = (JavascriptExecutor) driver;
executor.executeScript("arguments[0].click();", element);
}
@ -164,6 +166,7 @@ public class BrowserCommon {
inputElement.sendKeys(content);
return inputElement;
}
/**
* clear element
*
@ -182,9 +185,8 @@ public class BrowserCommon {
*
* @param codeMirrorLocator By codeMirror
* @param codeMirrorLineLocator By codeMirrorLine
*/
public void inputCodeMirror(By codeMirrorLocator,By codeMirrorLineLocator,String content) {
public void inputCodeMirror(By codeMirrorLocator, By codeMirrorLineLocator, String content) {
WebElement codeMirrorElement = locateElement(codeMirrorLocator);
WebElement codeMirrorLineElement = locateElement(codeMirrorLineLocator);
codeMirrorElement.click();
@ -193,10 +195,11 @@ public class BrowserCommon {
/**
* move to element
*
* @param locator BY
* @return actions
*/
public Actions moveToElement(By locator){
public Actions moveToElement(By locator) {
return actions.moveToElement(locateElement(locator));
}
@ -206,14 +209,14 @@ public class BrowserCommon {
* @param source_locator BY
* @param target_locator BY
*/
public void dragAndDrop(By source_locator, By target_locator){
public void dragAndDrop(By source_locator, By target_locator) {
WebElement sourceElement = locateElement(source_locator);
WebElement targetElement = locateElement(target_locator);
actions.dragAndDrop(sourceElement, targetElement).perform();
actions.release();
}
public void moveToDragElement(By target_locator, int X, int Y){
public void moveToDragElement(By target_locator, int X, int Y) {
WebElement targetElement = locateElement(target_locator);
actions.dragAndDropBy(targetElement, X, Y).perform();
actions.release();
@ -249,9 +252,22 @@ public class BrowserCommon {
return driver;
}
/**
* select time
*
* @return WebElement
*/
public WebElement selectDate(String js, By locator_time, String date) {
JavascriptExecutor removeAttribute = (JavascriptExecutor) driver;
removeAttribute.executeScript("var setDate=" + js + ";setDate.removeAttribute('readonly');");
WebElement dateElement = locateElement(locator_time);
//input date
dateElement.clear();
dateElement.sendKeys(Keys.HOME,Keys.chord(Keys.SHIFT,Keys.END));
dateElement.sendKeys(date);
return dateElement;
}
/**
* Multi-window switch handle, according to the handle number passed in

42
e2e/src/test/java/org/apache/dolphinscheduler/data/security/QueueManageData.java

@ -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.data.security;
public class QueueManageData {
/**
* Create Queue Name
*/
public static final String QUEUE_NAME = "selenium_queue_name";
/**
* Create Queue Value
*/
public static final String QUEUE_VALUE = "selenium_queue_value";
/**
* Edit Queue Name
*/
public static final String EDIT_QUEUE_NAME = "_edit";
/**
* Edit Queue Value
*/
public static final String EDIT_QUEUE_VALUE = "_edit";
public static final String QUEUE_MANAGE = "队列管理 - DolphinScheduler";
}

24
e2e/src/test/java/org/apache/dolphinscheduler/data/security/TokenManageData.java

@ -0,0 +1,24 @@
/*
* 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 TokenManageData {
public static final String TOKEN_MANAGE = "令牌管理 - DolphinScheduler";
public static final String DATE = "2038-06-10 00:00:00";
}

31
e2e/src/test/java/org/apache/dolphinscheduler/locator/security/QueueManageLocator.java

@ -0,0 +1,31 @@
/*
* 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 QueueManageLocator {
//create queue locator
public static final By CLICK_QUEUE_MANAGE = By.xpath("//div[6]/div/a/div/a/span");
public static final By CLICK_CREATE_QUEUE = By.xpath("//button/span");
public static final By INPUT_QUEUE_NAME = By.xpath("//div[2]/div/div/div[2]/div/input");
public static final By INPUT_QUEUE_VALUE = By.xpath("//div[2]/div[2]/div/input");
public static final By SUBMIT_QUEUE = By.xpath("//button[2]/span");
//edit queue locator
public static final By CLICK_EDIT_QUEUE = By.xpath("//td[6]/button/i");
}

41
e2e/src/test/java/org/apache/dolphinscheduler/locator/security/TokenManageLocator.java

@ -0,0 +1,41 @@
/*
* 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 TokenManageLocator {
//create token
public static final By CLICK_TOKEN_MANAGE = By.xpath("//div[7]/div/a/div/a/span");
public static final By CLICK_CREATE_TOKEN = By.xpath("//div[2]/div/div[2]/div[2]/div/div[1]/button/span");
public static final By SELECT_USER = By.xpath("//div[2]/div[2]/div/div/div/span/i");
public static final By CLICK_GENERATE_TOKEN_BUTTON = By.xpath("//div[3]/div[2]/button/span");
public static final By CLICK_SUBMIT_BUTTON = By.xpath("//div[3]/button[2]/span");
//edit token
public static final By CLICK_EDIT_BUTTON = By.xpath("//div[3]/div[1]/div/table/tr[2]/td[7]/button/i");
//delete token
public static final By CLICK_DELETE_BUTTON = By.xpath("//div[3]/div[1]/div/table/tr[2]/td[7]/span/button");
public static final By CLICK_CONFIRM_DELETE_BUTTON = By.xpath("//div[2]/div/button[2]/span");
}

4
e2e/src/test/java/org/apache/dolphinscheduler/page/security/AlertManagePage.java

@ -38,11 +38,11 @@ public class AlertManagePage extends PageCommon {
public boolean createAlert() throws InterruptedException {
// click alert manage
clickElement(AlertManageLocator.CLICK_ALERT_MANAGE);
Thread.sleep(2000);
Thread.sleep(1000);
// click create alert button
clickElement(AlertManageLocator.CLICK_CREATE_ALERT);
Thread.sleep(2000);
Thread.sleep(1000);
// input alert data
sendInput(AlertManageLocator.INPUT_ALERT_NAME, AlertManageData.ALERT_NAME);

85
e2e/src/test/java/org/apache/dolphinscheduler/page/security/QueueManagePage.java

@ -0,0 +1,85 @@
/*
* 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.QueueManageData;
import org.apache.dolphinscheduler.locator.security.QueueManageLocator;
import org.openqa.selenium.WebDriver;
public class QueueManagePage extends PageCommon {
/**
* Unique constructor
* @param driver driver
*/
public QueueManagePage(WebDriver driver) {
super(driver);
}
/**
* create queue
*
* @return Whether to enter the specified page after create queue
*/
public boolean createQueue() throws InterruptedException {
// click queue manage
clickElement(QueueManageLocator.CLICK_QUEUE_MANAGE);
Thread.sleep(1000);
// click create queue button
clickElement(QueueManageLocator.CLICK_CREATE_QUEUE);
Thread.sleep(1000);
// input queue data
sendInput(QueueManageLocator.INPUT_QUEUE_NAME, QueueManageData.QUEUE_NAME);
sendInput(QueueManageLocator.INPUT_QUEUE_VALUE, QueueManageData.QUEUE_VALUE);
// click button
clickButton(QueueManageLocator.SUBMIT_QUEUE);
// Whether to enter the specified page after submit
return ifTitleContains(QueueManageData.QUEUE_MANAGE);
}
/**
* edit queue
*
* @return Whether to enter the specified page after create queue
*/
public boolean editQueue() throws InterruptedException {
// click queue manage
Thread.sleep(1000);
clickElement(QueueManageLocator.CLICK_QUEUE_MANAGE);
Thread.sleep(1000);
// click edit queue button
clickElement(QueueManageLocator.CLICK_EDIT_QUEUE);
Thread.sleep(1000);
// input queue data
sendInput(QueueManageLocator.INPUT_QUEUE_NAME, QueueManageData.EDIT_QUEUE_NAME);
sendInput(QueueManageLocator.INPUT_QUEUE_VALUE, QueueManageData.EDIT_QUEUE_VALUE);
// click button
clickButton(QueueManageLocator.SUBMIT_QUEUE);
// Whether to enter the specified page after submit
return ifTitleContains(QueueManageData.QUEUE_MANAGE);
}
}

94
e2e/src/test/java/org/apache/dolphinscheduler/page/security/TokenManagePage.java

@ -0,0 +1,94 @@
/*
* 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.TokenManageData;
import org.apache.dolphinscheduler.locator.security.TokenManageLocator;
import org.openqa.selenium.WebDriver;
public class TokenManagePage extends PageCommon {
public TokenManagePage(WebDriver driver) {
super(driver);
}
/**
* createTenant
*
* @return Whether to enter the specified page after creat tenant
*/
public boolean createToken() throws InterruptedException {
//create token
Thread.sleep(1000);
clickElement(TokenManageLocator.CLICK_TOKEN_MANAGE);
Thread.sleep(1000);
// click create token button
clickButton(TokenManageLocator.CLICK_CREATE_TOKEN);
Thread.sleep(1000);
//selectDate(TokenManageLocator.js, TokenManageLocator.CLICK_TIME, TokenManageData.DATE);
clickButton(TokenManageLocator.SELECT_USER);
clickButton(TokenManageLocator.CLICK_GENERATE_TOKEN_BUTTON);
Thread.sleep(2500);
// click button
clickButton(TokenManageLocator.CLICK_SUBMIT_BUTTON);
// Whether to enter the specified page after submit
return ifTitleContains(TokenManageData.TOKEN_MANAGE);
}
//edit token
public boolean editToken() throws InterruptedException {
// click token manage
clickElement(TokenManageLocator.CLICK_TOKEN_MANAGE);
Thread.sleep(1000);
// click create token button
clickButton(TokenManageLocator.CLICK_EDIT_BUTTON);
Thread.sleep(1000);
clickButton(TokenManageLocator.SELECT_USER);
clickButton(TokenManageLocator.CLICK_GENERATE_TOKEN_BUTTON);
Thread.sleep(2500);
// click button
clickButton(TokenManageLocator.CLICK_SUBMIT_BUTTON);
// Whether to enter the specified page after submit
return ifTitleContains(TokenManageData.TOKEN_MANAGE);
}
//delete token
public boolean deleteToken() throws InterruptedException {
// click token manage
clickElement(TokenManageLocator.CLICK_TOKEN_MANAGE);
Thread.sleep(1000);
clickButton(TokenManageLocator.CLICK_DELETE_BUTTON);
clickButton(TokenManageLocator.CLICK_CONFIRM_DELETE_BUTTON);
return ifTitleContains(TokenManageData.TOKEN_MANAGE);
}
}

42
e2e/src/test/java/org/apache/dolphinscheduler/testcase/testDeleteData/TestDeleteToken.java

@ -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.TenantManagePage;
import org.apache.dolphinscheduler.page.security.TokenManagePage;
import org.testng.annotations.Test;
public class TestDeleteToken extends BaseTest {
private TokenManagePage tokenManagePage;
private TenantManagePage tenantManagePage;
@Test(groups = {"functionTests"}, dependsOnGroups = {"login", "token"}, description = "TestDeleteToken")
public void testUserManage() throws InterruptedException {
tenantManagePage = new TenantManagePage(driver);
System.out.println("jump to security to delete token");
tenantManagePage.jumpSecurity();
tokenManagePage = new TokenManagePage(driver);
//delete token
System.out.println("start delete token");
assert tokenManagePage.deleteToken();
System.out.println("end delete token");
System.out.println("===================================");
}
}

42
e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestQueueManage.java

@ -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.testSecurity;
import org.apache.dolphinscheduler.base.BaseTest;
import org.apache.dolphinscheduler.page.security.QueueManagePage;
import org.testng.annotations.Test;
public class TestQueueManage extends BaseTest {
private QueueManagePage queueManagePage;
@Test(groups={"functionTests","queue"},dependsOnGroups = { "login" },description = "TestQueueManage")
public void testTenantManage() throws InterruptedException {
queueManagePage = new QueueManagePage(driver);
//create queue
System.out.println("start create queue");
assert queueManagePage.createQueue();
System.out.println("end create queue");
System.out.println("===================================");
//edit queue
System.out.println("start edit queue");
assert queueManagePage.editQueue();
System.out.println("end edit queue");
System.out.println("===================================");
}
}

43
e2e/src/test/java/org/apache/dolphinscheduler/testcase/testSecurity/TestTokenManage.java

@ -0,0 +1,43 @@
/*
* 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.TokenManagePage;
import org.testng.annotations.Test;
public class TestTokenManage extends BaseTest {
private TokenManagePage tokenManagePage;
@Test(groups={"functionTests","token"},dependsOnGroups = { "login" },description = "TestTokenManage")
public void testUserManage() throws InterruptedException {
tokenManagePage = new TokenManagePage(driver);
//generate token
System.out.println("start create token");
assert tokenManagePage.createToken();
System.out.println("end create token");
System.out.println("===================================");
//edit token
System.out.println("start edit token");
assert tokenManagePage.editToken();
System.out.println("end edit token");
System.out.println("===================================");
}
}

3
e2e/testng.xml

@ -28,6 +28,8 @@
<class name="org.apache.dolphinscheduler.testcase.testSecurity.TestTenantManage"></class>
<class name="org.apache.dolphinscheduler.testcase.testSecurity.TestUserManage"></class>
<class name="org.apache.dolphinscheduler.testcase.testSecurity.TestAlertManage"></class>
<class name="org.apache.dolphinscheduler.testcase.testSecurity.TestQueueManage"></class>
<class name="org.apache.dolphinscheduler.testcase.testSecurity.TestTokenManage"></class>
<class name="org.apache.dolphinscheduler.testcase.testProject.TestCreateProject"></class>
<class name="org.apache.dolphinscheduler.testcase.testProject.TestCreateWorkflow"></class>
@ -35,6 +37,7 @@
<class name="org.apache.dolphinscheduler.testcase.testDeleteData.TestDeleteWorkflow"></class>
<class name="org.apache.dolphinscheduler.testcase.testDeleteData.TestDeleteProject"></class>
<class name="org.apache.dolphinscheduler.testcase.testDeleteData.TestDeleteAlert"></class>
<class name="org.apache.dolphinscheduler.testcase.testDeleteData.TestDeleteToken"></class>
<class name="org.apache.dolphinscheduler.testcase.testDeleteData.TestDeleteUser"></class>
<class name="org.apache.dolphinscheduler.testcase.testDeleteData.TestDeleteTenant"></class>
</classes>

Loading…
Cancel
Save