Browse Source

[E2E] Add queue e2e test (#7941)

3.0.0/version-upgrade
wind 3 years ago committed by GitHub
parent
commit
3edc58cbdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/workflows/e2e.yml
  2. 100
      dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/QueueE2ETest.java
  3. 94
      dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/QueuePage.java
  4. 6
      dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/SecurityPage.java
  5. 4
      dolphinscheduler-ui/src/js/conf/home/pages/security/pages/queue/_source/createQueue.vue
  6. 6
      dolphinscheduler-ui/src/js/conf/home/pages/security/pages/queue/_source/list.vue
  7. 2
      dolphinscheduler-ui/src/js/conf/home/pages/security/pages/queue/index.vue
  8. 3
      dolphinscheduler-ui/src/js/module/components/secondaryMenu/_source/menu.js

2
.github/workflows/e2e.yml

@ -42,6 +42,8 @@ jobs:
class: org.apache.dolphinscheduler.e2e.cases.WorkerGroupE2ETest class: org.apache.dolphinscheduler.e2e.cases.WorkerGroupE2ETest
- name: Project - name: Project
class: org.apache.dolphinscheduler.e2e.cases.ProjectE2ETest class: org.apache.dolphinscheduler.e2e.cases.ProjectE2ETest
- name: Queue
class: org.apache.dolphinscheduler.e2e.cases.QueueE2ETest
- name: Workflow - name: Workflow
class: org.apache.dolphinscheduler.e2e.cases.WorkflowE2ETest class: org.apache.dolphinscheduler.e2e.cases.WorkflowE2ETest
env: env:

100
dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/QueueE2ETest.java

@ -0,0 +1,100 @@
/*
* Licensed to 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. Apache Software Foundation (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.e2e.cases;
import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;
import org.apache.dolphinscheduler.e2e.core.DolphinScheduler;
import org.apache.dolphinscheduler.e2e.pages.LoginPage;
import org.apache.dolphinscheduler.e2e.pages.security.QueuePage;
import org.apache.dolphinscheduler.e2e.pages.security.SecurityPage;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.RemoteWebDriver;
@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
class QueueE2ETest {
private static final String queueName = "test_queue_name";
private static final String queueValue = "test_queue_value";
private static final String editQueueName = "edit_test_queue_name";
private static final String editQueueValue = "edit_test_queue_value";
private static RemoteWebDriver browser;
@BeforeAll
public static void setup() {
new LoginPage(browser)
.login("admin", "dolphinscheduler123")
.goToNav(SecurityPage.class)
.goToTab(QueuePage.class)
;
}
@Test
@Order(10)
void testCreateQueue() {
final QueuePage page = new QueuePage(browser);
page.create(queueName, queueValue);
await().untilAsserted(() -> {
browser.navigate().refresh();
assertThat(page.queueList())
.as("Queue list should contain newly-created queue")
.extracting(WebElement::getText)
.anyMatch(it -> it.contains(queueName));
});
}
@Test
@Order(20)
void testCreateDuplicateQueue() {
final QueuePage page = new QueuePage(browser);
page.create(queueName, queueValue);
await().untilAsserted(() ->
assertThat(browser.findElement(By.tagName("body")).getText())
.contains("already exists")
);
page.createQueueForm().buttonCancel().click();
}
@Test
@Order(30)
void testEditQueue() {
final QueuePage page = new QueuePage(browser);
page.update(queueName, editQueueName, editQueueValue);
await().untilAsserted(() -> {
browser.navigate().refresh();
assertThat(page.queueList())
.as("Queue list should contain newly-modified Queue")
.extracting(WebElement::getText)
.anyMatch(it -> it.contains(editQueueName));
});
}
}

94
dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/QueuePage.java

@ -0,0 +1,94 @@
/*
* Licensed to 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. Apache Software Foundation (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.e2e.pages.security;
import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import lombok.Getter;
@Getter
public final class QueuePage extends NavBarPage implements SecurityPage.Tab {
@FindBy(id = "btnCreateQueue")
private WebElement buttonCreateQueue;
@FindBy(className = "items")
private List<WebElement> queueList;
private final QueueForm createQueueForm;
private final QueueForm editQueueForm;
public QueuePage(RemoteWebDriver driver) {
super(driver);
createQueueForm = new QueueForm();
editQueueForm = new QueueForm();
}
public QueuePage create(String queueName, String queueValue) {
buttonCreateQueue().click();
createQueueForm().inputQueueName().sendKeys(queueName);
createQueueForm().inputQueueValue().sendKeys(queueValue);
createQueueForm().buttonSubmit().click();
return this;
}
public QueuePage update(String queueName, String editQueueName, String editQueueValue) {
queueList()
.stream()
.filter(it -> it.findElement(By.className("queueName")).getAttribute("innerHTML").contains(queueName))
.flatMap(it -> it.findElements(By.className("edit")).stream())
.filter(WebElement::isDisplayed)
.findFirst()
.orElseThrow(() -> new RuntimeException("No edit button in queue list"))
.click();
editQueueForm().inputQueueName().sendKeys(editQueueName);
editQueueForm().inputQueueValue().sendKeys(editQueueValue);
editQueueForm().buttonSubmit().click();
return this;
}
@Getter
public class QueueForm {
QueueForm() {
PageFactory.initElements(driver, this);
}
@FindBy(id = "inputQueueName")
private WebElement inputQueueName;
@FindBy(id = "inputQueueValue")
private WebElement inputQueueValue;
@FindBy(id = "btnSubmit")
private WebElement buttonSubmit;
@FindBy(id = "btnCancel")
private WebElement buttonCancel;
}
}

6
dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/SecurityPage.java

@ -39,6 +39,8 @@ public class SecurityPage extends NavBarPage implements NavBarItem {
@FindBy(className = "tab-worker-group-manage") @FindBy(className = "tab-worker-group-manage")
private WebElement menWorkerGroupManage; private WebElement menWorkerGroupManage;
@FindBy(className = "tab-queue-manage")
private WebElement menuQueueManage;
public SecurityPage(RemoteWebDriver driver) { public SecurityPage(RemoteWebDriver driver) {
super(driver); super(driver);
@ -57,6 +59,10 @@ public class SecurityPage extends NavBarPage implements NavBarItem {
menWorkerGroupManage().click(); menWorkerGroupManage().click();
return tab.cast(new WorkerGroupPage(driver)); return tab.cast(new WorkerGroupPage(driver));
} }
if (tab == QueuePage.class) {
menuQueueManage().click();
return tab.cast(new QueuePage(driver));
}
throw new UnsupportedOperationException("Unknown tab: " + tab.getName()); throw new UnsupportedOperationException("Unknown tab: " + tab.getName());
} }

4
dolphinscheduler-ui/src/js/conf/home/pages/security/pages/queue/_source/createQueue.vue

@ -16,6 +16,8 @@
*/ */
<template> <template>
<m-popover <m-popover
okId="btnSubmit"
cancelId="btnCancel"
ref="popover" ref="popover"
:ok-text="item ? $t('Edit') : $t('Submit')" :ok-text="item ? $t('Edit') : $t('Submit')"
@ok="_ok" @ok="_ok"
@ -26,6 +28,7 @@
<template slot="name"><strong>*</strong>{{$t('Name')}}</template> <template slot="name"><strong>*</strong>{{$t('Name')}}</template>
<template slot="content"> <template slot="content">
<el-input <el-input
id="inputQueueName"
type="input" type="input"
v-model="queueName" v-model="queueName"
maxlength="60" maxlength="60"
@ -38,6 +41,7 @@
<template slot="name"><strong>*</strong>{{$t('Queue value')}}</template> <template slot="name"><strong>*</strong>{{$t('Queue value')}}</template>
<template slot="content"> <template slot="content">
<el-input <el-input
id="inputQueueValue"
type="input" type="input"
v-model="queue" v-model="queue"
maxlength="60" maxlength="60"

6
dolphinscheduler-ui/src/js/conf/home/pages/security/pages/queue/_source/list.vue

@ -17,9 +17,9 @@
<template> <template>
<div class="list-model"> <div class="list-model">
<div class="table-box"> <div class="table-box">
<el-table :data="list" size="mini" style="width: 100%"> <el-table :data="list" size="mini" style="width: 100%" row-class-name="items">
<el-table-column type="index" :label="$t('#')" width="50"></el-table-column> <el-table-column type="index" :label="$t('#')" width="50"></el-table-column>
<el-table-column prop="queueName" :label="$t('Name')"></el-table-column> <el-table-column prop="queueName" :label="$t('Name')" class-name="queueName"></el-table-column>
<el-table-column prop="queue" :label="$t('Queue value')"></el-table-column> <el-table-column prop="queue" :label="$t('Queue value')"></el-table-column>
<el-table-column :label="$t('Create Time')" min-width="120"> <el-table-column :label="$t('Create Time')" min-width="120">
<template slot-scope="scope"> <template slot-scope="scope">
@ -34,7 +34,7 @@
<el-table-column :label="$t('Operation')" width="100"> <el-table-column :label="$t('Operation')" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tooltip :content="$t('Edit')" placement="top"> <el-tooltip :content="$t('Edit')" placement="top">
<el-button type="primary" size="mini" icon="el-icon-edit-outline" @click="_edit(scope.row)" circle></el-button> <el-button type="primary" size="mini" icon="el-icon-edit-outline" @click="_edit(scope.row)" circle class="edit"></el-button>
</el-tooltip> </el-tooltip>
</template> </template>
</el-table-column> </el-table-column>

2
dolphinscheduler-ui/src/js/conf/home/pages/security/pages/queue/index.vue

@ -19,7 +19,7 @@
<template slot="conditions"> <template slot="conditions">
<m-conditions @on-conditions="_onConditions"> <m-conditions @on-conditions="_onConditions">
<template slot="button-group" v-if="isADMIN"> <template slot="button-group" v-if="isADMIN">
<el-button size="mini" @click="_create('')">{{$t('Create queue')}}</el-button> <el-button id="btnCreateQueue" size="mini" @click="_create('')">{{$t('Create queue')}}</el-button>
<el-dialog <el-dialog
:title="item ? $t('Edit queue') : $t('Create queue')" :title="item ? $t('Edit queue') : $t('Create queue')"
v-if="createQueueDialog" v-if="createQueueDialog"

3
dolphinscheduler-ui/src/js/module/components/secondaryMenu/_source/menu.js

@ -144,7 +144,8 @@ const menu = {
isOpen: true, isOpen: true,
enabled: true, enabled: true,
icon: 'el-icon-s-grid', icon: 'el-icon-s-grid',
children: [] children: [],
classNames: 'tab-queue-manage'
}, },
{ {
name: `${i18n.$t('Environment manage')}`, name: `${i18n.$t('Environment manage')}`,

Loading…
Cancel
Save