You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/01/19 09:29:27 UTC
[GitHub] [dolphinscheduler] janeHe13 opened a new pull request #8121: [E2E]add the alarm group page and the alarm instance page of the e2e case
janeHe13 opened a new pull request #8121:
URL: https://github.com/apache/dolphinscheduler/pull/8121
<!--Thanks very much for contributing to Apache DolphinScheduler. Please review https://dolphinscheduler.apache.org/en-us/community/development/pull-request.html before opening a pull request.-->
## Purpose of the pull request
<!--(For example: This pull request adds checkstyle plugin).-->
## Brief change log
<!--*(for example:)*
- *Add maven-checkstyle-plugin to root pom.xml*
-->
## Verify this pull request
<!--*(Please pick either of the following options)*-->
This pull request is code cleanup without any test coverage.
*(or)*
This pull request is already covered by existing tests, such as *(please describe tests)*.
(or)
This change added tests and can be verified as follows:
<!--*(example:)*
- *Added dolphinscheduler-dao tests for end-to-end.*
- *Added CronUtilsTest to verify the change.*
- *Manually verified the change by testing locally.* -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] sonarcloud[bot] commented on pull request #8121: [E2E]add the alarm group page and the alarm instance page of the e2e case
Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on pull request #8121:
URL: https://github.com/apache/dolphinscheduler/pull/8121#issuecomment-1016442707
Kudos, SonarCloud Quality Gate passed! ![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')
[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=8121&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=8121&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=8121&resolved=false&types=BUG)
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=8121&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=8121&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=8121&resolved=false&types=VULNERABILITY)
[![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=8121&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=8121&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache-dolphinscheduler&pullRequest=8121&resolved=false&types=SECURITY_HOTSPOT)
[![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=8121&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=8121&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache-dolphinscheduler&pullRequest=8121&resolved=false&types=CODE_SMELL)
[![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=8121&metric=coverage&view=list) No Coverage information
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=8121&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=8121&metric=new_duplicated_lines_density&view=list)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] kezhenxu94 commented on a change in pull request #8121: [E2E]add the alarm group page and the alarm instance page of the e2e case
Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #8121:
URL: https://github.com/apache/dolphinscheduler/pull/8121#discussion_r787633108
##########
File path: dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/WarningInstancePage.java
##########
@@ -0,0 +1,156 @@
+/*
+ * 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 lombok.Getter;
+import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage;
+import org.apache.dolphinscheduler.e2e.pages.project.workflow.WorkflowDefinitionTab;
+import org.openqa.selenium.support.ui.WebDriverWait;
+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.FindBys;
+import org.openqa.selenium.support.PageFactory;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+
+import java.util.List;
+
+@Getter
+public final class WarningInstancePage extends NavBarPage implements SecurityPage.Tab {
+ @FindBy(id = "btnCreateAlarmInstance")
+ private WebElement buttonCreateWarningInstance;
+
+ @FindBy(className = "items")
+ private List<WebElement> warningInstanceList;
+
+ @FindBys({
+ @FindBy(className = "el-popconfirm"),
+ @FindBy(className = "el-button--primary"),
+ })
+ private List<WebElement> buttonConfirm;
+
+ private final WarningInstanceForm createWarningInstanceForm = new WarningInstanceForm();
+ private final WarningInstanceForm editWarningInstanceForm = new WarningInstanceForm();
+ private final WarningInstanceForm alertPluginForm = new WarningInstanceForm();
+
+
+ public WarningInstancePage(RemoteWebDriver driver) {
+ super(driver);
+ }
+
+ public WarningInstancePage create(String alarmInstanceName, String alarmPluginName, String inputPluginContent, String keyword) {
+ buttonCreateWarningInstance().click();
+
+ createWarningInstanceForm().inputAlarmInstanceName().sendKeys(alarmInstanceName);
+ createWarningInstanceForm().selectAlarmPlugin().click();
+ SelectAlarmPlugin(alarmPluginName);
+ createWarningInstanceForm().inputWebhook().sendKeys(inputPluginContent);
+ createWarningInstanceForm().inputKeyword().sendKeys(keyword);
+ createWarningInstanceForm().radioNoEnableProxy().click();
+ createWarningInstanceForm().buttonSubmit().click();
+ return this;
+ }
+
+
+ public WarningInstancePage update(String warningInstanceName, String editWarningInstanceName) {
+ warningInstanceList()
+ .stream()
+ .filter(it -> it.findElement(By.className("name")).getAttribute("innerHTML").contains(warningInstanceName))
+ .flatMap(it -> it.findElements(By.className("edit")).stream())
+ .filter(WebElement::isDisplayed)
+ .findFirst()
+ .orElseThrow(() -> new RuntimeException("No edit button in alarmInstance list"))
+ .click();
+
+ editWarningInstanceForm().inputAlarmInstanceName().clear();
+ editWarningInstanceForm().inputAlarmInstanceName().sendKeys(editWarningInstanceName);
+ editWarningInstanceForm().buttonSubmit().click();
+
+ return this;
+ }
+
+ public WarningInstancePage delete(String WarningInstance) {
+ warningInstanceList()
+ .stream()
+ .filter(it -> it.findElement(By.className("name")).getAttribute("innerHTML").contains(WarningInstance))
+ .flatMap(it -> it.findElements(By.className("delete")).stream())
+ .filter(WebElement::isDisplayed)
+ .findFirst()
+ .orElseThrow(() -> new RuntimeException("No delete button in alarmInstance list"))
+ .click();
+
+ buttonConfirm()
+ .stream()
+ .filter(WebElement::isDisplayed)
+ .findFirst()
+ .orElseThrow(() -> new RuntimeException("No confirm button when deleting"))
+ .click();
+
+ return this;
+ }
+
+ public WarningInstancePage SelectAlarmPlugin(String alarmPluginName) {
Review comment:
method names are usually camel-case with first letter lowercase
```suggestion
public WarningInstancePage selectAlarmPlugin(String alarmPluginName) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] codecov-commenter commented on pull request #8121: [E2E]add the alarm group page and the alarm instance page of the e2e case
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #8121:
URL: https://github.com/apache/dolphinscheduler/pull/8121#issuecomment-1016436922
# [Codecov](https://codecov.io/gh/apache/dolphinscheduler/pull/8121?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#8121](https://codecov.io/gh/apache/dolphinscheduler/pull/8121?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5abf157) into [dev](https://codecov.io/gh/apache/dolphinscheduler/commit/45f6c4197b03566895008577de964f0e5f1c80c8?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (45f6c41) will **increase** coverage by `0.02%`.
> The diff coverage is `n/a`.
[![Impacted file tree graph](https://codecov.io/gh/apache/dolphinscheduler/pull/8121/graphs/tree.svg?width=650&height=150&src=pr&token=bv9iXXRLi9&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/dolphinscheduler/pull/8121?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## dev #8121 +/- ##
============================================
+ Coverage 41.38% 41.41% +0.02%
- Complexity 3730 3732 +2
============================================
Files 637 637
Lines 27141 27141
Branches 3089 3089
============================================
+ Hits 11233 11240 +7
+ Misses 14824 14814 -10
- Partials 1084 1087 +3
```
| [Impacted Files](https://codecov.io/gh/apache/dolphinscheduler/pull/8121?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...er/master/dispatch/host/assign/RandomSelector.java](https://codecov.io/gh/apache/dolphinscheduler/pull/8121/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci1tYXN0ZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvc2VydmVyL21hc3Rlci9kaXNwYXRjaC9ob3N0L2Fzc2lnbi9SYW5kb21TZWxlY3Rvci5qYXZh) | `77.77% <0.00%> (-5.56%)` | :arrow_down: |
| [...inscheduler/common/task/sqoop/SqoopParameters.java](https://codecov.io/gh/apache/dolphinscheduler/pull/8121/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvY29tbW9uL3Rhc2svc3Fvb3AvU3Fvb3BQYXJhbWV0ZXJzLmphdmE=) | `74.00% <0.00%> (ø)` | |
| [...he/dolphinscheduler/common/enums/SqoopJobType.java](https://codecov.io/gh/apache/dolphinscheduler/pull/8121/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZG9scGhpbnNjaGVkdWxlci1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2RvbHBoaW5zY2hlZHVsZXIvY29tbW9uL2VudW1zL1Nxb29wSm9iVHlwZS5qYXZh) | `88.88% <0.00%> (+88.88%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/dolphinscheduler/pull/8121?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/dolphinscheduler/pull/8121?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [45f6c41...5abf157](https://codecov.io/gh/apache/dolphinscheduler/pull/8121?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] kezhenxu94 commented on a change in pull request #8121: [E2E]add the alarm group page and the alarm instance page of the e2e case
Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on a change in pull request #8121:
URL: https://github.com/apache/dolphinscheduler/pull/8121#discussion_r787633568
##########
File path: dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/WarningInstancePage.java
##########
@@ -0,0 +1,156 @@
+/*
+ * 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 lombok.Getter;
+import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage;
+import org.apache.dolphinscheduler.e2e.pages.project.workflow.WorkflowDefinitionTab;
+import org.openqa.selenium.support.ui.WebDriverWait;
+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.FindBys;
+import org.openqa.selenium.support.PageFactory;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+
+import java.util.List;
+
+@Getter
+public final class WarningInstancePage extends NavBarPage implements SecurityPage.Tab {
+ @FindBy(id = "btnCreateAlarmInstance")
+ private WebElement buttonCreateWarningInstance;
+
+ @FindBy(className = "items")
+ private List<WebElement> warningInstanceList;
+
+ @FindBys({
+ @FindBy(className = "el-popconfirm"),
+ @FindBy(className = "el-button--primary"),
+ })
+ private List<WebElement> buttonConfirm;
+
+ private final WarningInstanceForm createWarningInstanceForm = new WarningInstanceForm();
+ private final WarningInstanceForm editWarningInstanceForm = new WarningInstanceForm();
+ private final WarningInstanceForm alertPluginForm = new WarningInstanceForm();
+
+
+ public WarningInstancePage(RemoteWebDriver driver) {
+ super(driver);
+ }
+
+ public WarningInstancePage create(String alarmInstanceName, String alarmPluginName, String inputPluginContent, String keyword) {
+ buttonCreateWarningInstance().click();
+
+ createWarningInstanceForm().inputAlarmInstanceName().sendKeys(alarmInstanceName);
+ createWarningInstanceForm().selectAlarmPlugin().click();
+ SelectAlarmPlugin(alarmPluginName);
+ createWarningInstanceForm().inputWebhook().sendKeys(inputPluginContent);
+ createWarningInstanceForm().inputKeyword().sendKeys(keyword);
+ createWarningInstanceForm().radioNoEnableProxy().click();
+ createWarningInstanceForm().buttonSubmit().click();
+ return this;
+ }
+
+
+ public WarningInstancePage update(String warningInstanceName, String editWarningInstanceName) {
+ warningInstanceList()
+ .stream()
+ .filter(it -> it.findElement(By.className("name")).getAttribute("innerHTML").contains(warningInstanceName))
+ .flatMap(it -> it.findElements(By.className("edit")).stream())
+ .filter(WebElement::isDisplayed)
+ .findFirst()
+ .orElseThrow(() -> new RuntimeException("No edit button in alarmInstance list"))
+ .click();
+
+ editWarningInstanceForm().inputAlarmInstanceName().clear();
+ editWarningInstanceForm().inputAlarmInstanceName().sendKeys(editWarningInstanceName);
+ editWarningInstanceForm().buttonSubmit().click();
+
+ return this;
+ }
+
+ public WarningInstancePage delete(String WarningInstance) {
+ warningInstanceList()
+ .stream()
+ .filter(it -> it.findElement(By.className("name")).getAttribute("innerHTML").contains(WarningInstance))
+ .flatMap(it -> it.findElements(By.className("delete")).stream())
+ .filter(WebElement::isDisplayed)
+ .findFirst()
+ .orElseThrow(() -> new RuntimeException("No delete button in alarmInstance list"))
+ .click();
+
+ buttonConfirm()
+ .stream()
+ .filter(WebElement::isDisplayed)
+ .findFirst()
+ .orElseThrow(() -> new RuntimeException("No confirm button when deleting"))
+ .click();
+
+ return this;
+ }
+
+ public WarningInstancePage SelectAlarmPlugin(String alarmPluginName) {
+
+ final By optionsLocator = By.className("option-alarmPluginName");
+
+ new WebDriverWait(driver, 10)
+ .until(ExpectedConditions.visibilityOfElementLocated(optionsLocator));
+
+ driver().findElements(optionsLocator)
+ .stream()
+ .filter(it -> it.getText().contains(alarmPluginName))
+ .findFirst()
+ .orElseThrow(() -> new RuntimeException("No such tenant: " + alarmPluginName))
+ .click();
+ return this;
+ }
+
+ @Getter
+ public class WarningInstanceForm {
+ WarningInstanceForm() {
+ PageFactory.initElements(driver, this);
+ }
+
+ @FindBy(id = "inputAlarmInstanceName")
+ private WebElement inputAlarmInstanceName;
+
+ @FindBy(id = "selectAlarmPlugin")
+ private WebElement selectAlarmPlugin;
+
+ @FindBy(id = "alarmPluginName")
+ private WebElement alarmPluginName;
+
+ @FindBy(xpath = "//form/div/div/div/div/div/input")
+ private WebElement inputWebhook;
+
+ @FindBy(xpath = "//form/div/div[2]/div/div/div/input")
+ private WebElement inputKeyword;
+
+ @FindBy(xpath = "//label[2]/span/span")
Review comment:
never use this kind of selectors, it will make the tests unmaintainable and unstable
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [dolphinscheduler] janeHe13 commented on a change in pull request #8121: [E2E]add the alarm group page and the alarm instance page of the e2e case
Posted by GitBox <gi...@apache.org>.
janeHe13 commented on a change in pull request #8121:
URL: https://github.com/apache/dolphinscheduler/pull/8121#discussion_r787635365
##########
File path: dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/WarningInstancePage.java
##########
@@ -0,0 +1,156 @@
+/*
+ * 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 lombok.Getter;
+import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage;
+import org.apache.dolphinscheduler.e2e.pages.project.workflow.WorkflowDefinitionTab;
+import org.openqa.selenium.support.ui.WebDriverWait;
+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.FindBys;
+import org.openqa.selenium.support.PageFactory;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+
+import java.util.List;
+
+@Getter
+public final class WarningInstancePage extends NavBarPage implements SecurityPage.Tab {
+ @FindBy(id = "btnCreateAlarmInstance")
+ private WebElement buttonCreateWarningInstance;
+
+ @FindBy(className = "items")
+ private List<WebElement> warningInstanceList;
+
+ @FindBys({
+ @FindBy(className = "el-popconfirm"),
+ @FindBy(className = "el-button--primary"),
+ })
+ private List<WebElement> buttonConfirm;
+
+ private final WarningInstanceForm createWarningInstanceForm = new WarningInstanceForm();
+ private final WarningInstanceForm editWarningInstanceForm = new WarningInstanceForm();
+ private final WarningInstanceForm alertPluginForm = new WarningInstanceForm();
+
+
+ public WarningInstancePage(RemoteWebDriver driver) {
+ super(driver);
+ }
+
+ public WarningInstancePage create(String alarmInstanceName, String alarmPluginName, String inputPluginContent, String keyword) {
+ buttonCreateWarningInstance().click();
+
+ createWarningInstanceForm().inputAlarmInstanceName().sendKeys(alarmInstanceName);
+ createWarningInstanceForm().selectAlarmPlugin().click();
+ SelectAlarmPlugin(alarmPluginName);
+ createWarningInstanceForm().inputWebhook().sendKeys(inputPluginContent);
+ createWarningInstanceForm().inputKeyword().sendKeys(keyword);
+ createWarningInstanceForm().radioNoEnableProxy().click();
+ createWarningInstanceForm().buttonSubmit().click();
+ return this;
+ }
+
+
+ public WarningInstancePage update(String warningInstanceName, String editWarningInstanceName) {
+ warningInstanceList()
+ .stream()
+ .filter(it -> it.findElement(By.className("name")).getAttribute("innerHTML").contains(warningInstanceName))
+ .flatMap(it -> it.findElements(By.className("edit")).stream())
+ .filter(WebElement::isDisplayed)
+ .findFirst()
+ .orElseThrow(() -> new RuntimeException("No edit button in alarmInstance list"))
+ .click();
+
+ editWarningInstanceForm().inputAlarmInstanceName().clear();
+ editWarningInstanceForm().inputAlarmInstanceName().sendKeys(editWarningInstanceName);
+ editWarningInstanceForm().buttonSubmit().click();
+
+ return this;
+ }
+
+ public WarningInstancePage delete(String WarningInstance) {
+ warningInstanceList()
+ .stream()
+ .filter(it -> it.findElement(By.className("name")).getAttribute("innerHTML").contains(WarningInstance))
+ .flatMap(it -> it.findElements(By.className("delete")).stream())
+ .filter(WebElement::isDisplayed)
+ .findFirst()
+ .orElseThrow(() -> new RuntimeException("No delete button in alarmInstance list"))
+ .click();
+
+ buttonConfirm()
+ .stream()
+ .filter(WebElement::isDisplayed)
+ .findFirst()
+ .orElseThrow(() -> new RuntimeException("No confirm button when deleting"))
+ .click();
+
+ return this;
+ }
+
+ public WarningInstancePage SelectAlarmPlugin(String alarmPluginName) {
+
+ final By optionsLocator = By.className("option-alarmPluginName");
+
+ new WebDriverWait(driver, 10)
+ .until(ExpectedConditions.visibilityOfElementLocated(optionsLocator));
+
+ driver().findElements(optionsLocator)
+ .stream()
+ .filter(it -> it.getText().contains(alarmPluginName))
+ .findFirst()
+ .orElseThrow(() -> new RuntimeException("No such tenant: " + alarmPluginName))
+ .click();
+ return this;
+ }
+
+ @Getter
+ public class WarningInstanceForm {
+ WarningInstanceForm() {
+ PageFactory.initElements(driver, this);
+ }
+
+ @FindBy(id = "inputAlarmInstanceName")
+ private WebElement inputAlarmInstanceName;
+
+ @FindBy(id = "selectAlarmPlugin")
+ private WebElement selectAlarmPlugin;
+
+ @FindBy(id = "alarmPluginName")
+ private WebElement alarmPluginName;
+
+ @FindBy(xpath = "//form/div/div/div/div/div/input")
+ private WebElement inputWebhook;
+
+ @FindBy(xpath = "//form/div/div[2]/div/div/div/input")
+ private WebElement inputKeyword;
+
+ @FindBy(xpath = "//label[2]/span/span")
Review comment:
At present, adding ID and class to the UI is cumbersome, which has a great impact on the new UI. After discussion, we will temporarily replace it with XPath, and there will be good ways to replace it later
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org