diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2018-04-04 12:18:22 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2018-04-04 20:28:01 +0200 |
commit | 0602abbaae52104ab39087ae29efd6ea2ab45cb7 (patch) | |
tree | 7c9cf36fee28b52b9431341b46afeddac37ffda7 | |
parent | 6ab3e013a2cc0f3c90c6cff8f89ab015977a561f (diff) | |
download | sonarqube-0602abbaae52104ab39087ae29efd6ea2ab45cb7.tar.gz sonarqube-0602abbaae52104ab39087ae29efd6ea2ab45cb7.zip |
Fix Quality Gate create form
3 files changed, 35 insertions, 12 deletions
diff --git a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/QualityGatePage.java b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/QualityGatePage.java index 480b4bdb357..94e73a0451c 100644 --- a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/QualityGatePage.java +++ b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/QualityGatePage.java @@ -19,36 +19,47 @@ */ package org.sonarqube.qa.util.pageobjects; -import com.codeborne.selenide.Condition; -import com.codeborne.selenide.Selenide; +import static com.codeborne.selenide.Condition.exist; +import static com.codeborne.selenide.Condition.text; +import static com.codeborne.selenide.Condition.visible; +import static com.codeborne.selenide.Selenide.$; +import static com.codeborne.selenide.Selenide.$$; public class QualityGatePage { public QualityGatePage() { - Selenide.$("#quality-gates-page").shouldBe(Condition.visible); + $("#quality-gates-page").shouldBe(visible); } public QualityGatePage countQualityGates(Integer count) { - Selenide.$$("#quality-gates-page .list-group-item").shouldHaveSize(count); + $$("#quality-gates-page .list-group-item").shouldHaveSize(count); return this; } public QualityGatePage canCreateQG() { - Selenide.$("#quality-gate-add").should(Condition.exist).shouldBe(Condition.visible); + $("#quality-gate-add").should(exist).shouldBe(visible); + return this; + } + + public QualityGatePage createQG(String name) { + $("#quality-gate-add").click(); + $(".modal-head").should(exist).shouldHave(text("Create Quality Gate")); + $("#quality-gate-form-name").sendKeys(name); + $(".js-confirm").click(); return this; } public QualityGatePage canNotCreateQG() { - Selenide.$("#quality-gate-add").shouldNot(Condition.exist); + $("#quality-gate-add").shouldNot(exist); return this; } public QualityGatePage displayIntro() { - Selenide.$(".search-navigator-intro").should(Condition.exist).shouldBe(Condition.visible); + $(".search-navigator-intro").should(exist).shouldBe(visible); return this; } public QualityGatePage displayQualityGateDetail(String qualityGateName) { - Selenide.$(".layout-page-main-header").shouldHave(Condition.text(qualityGateName)); + $(".layout-page-main-header").shouldHave(text(qualityGateName)); return this; } } diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/CreateQualityGateForm.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/CreateQualityGateForm.tsx index f34aad8bfb9..6a0ca705301 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/CreateQualityGateForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/CreateQualityGateForm.tsx @@ -21,7 +21,7 @@ import * as React from 'react'; import * as PropTypes from 'prop-types'; import { createQualityGate, QualityGate } from '../../../api/quality-gates'; import Modal from '../../../components/controls/Modal'; -import { Button, ResetButtonLink } from '../../../components/ui/buttons'; +import { SubmitButton, ResetButtonLink } from '../../../components/ui/buttons'; import { translate } from '../../../helpers/l10n'; import { getQualityGateUrl } from '../../../helpers/urls'; @@ -80,7 +80,7 @@ export default class CreateQualityGateForm extends React.PureComponent<Props, St render() { const { loading, name } = this.state; - const header = translate('quality_gates.rename'); + const header = translate('quality_gates.create'); const submitDisabled = loading || !name; return ( @@ -109,9 +109,9 @@ export default class CreateQualityGateForm extends React.PureComponent<Props, St </div> <div className="modal-foot"> {loading && <i className="spinner spacer-right" />} - <Button className="js-confirm" disabled={submitDisabled}> + <SubmitButton className="js-confirm" disabled={submitDisabled}> {translate('save')} - </Button> + </SubmitButton> <ResetButtonLink className="js-modal-close" onClick={this.props.onClose}> {translate('cancel')} </ResetButtonLink> diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateUiTest.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateUiTest.java index 14305de30a3..95e2a177566 100644 --- a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateUiTest.java +++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateUiTest.java @@ -121,6 +121,18 @@ public class QualityGateUiTest { .displayIntro(); } + @Test + public void create_quality_gate() { + String admin = tester.users().generateAdministrator().getLogin(); + tester.openBrowser() + .logIn().submitCredentials(admin) + .openQualityGates() + .countQualityGates(1) + .canCreateQG() + .createQG("QG Create Test") + .countQualityGates(2); + } + private void scanSampleWithDate(Project project, String date) { scanSample(project, date, null); } |