diff options
author | Daniel Schwarz <daniel.schwarz@sonarsource.com> | 2017-08-10 14:04:12 +0200 |
---|---|---|
committer | Daniel Schwarz <bartfastiel@users.noreply.github.com> | 2017-08-16 10:12:36 +0200 |
commit | 798cc52b2cd83e1389cbd79fa0b52eb5d6ebae91 (patch) | |
tree | 0fccb19e601b77c052c87561a5a411aa867b680c /tests | |
parent | ee55e4492b069f30e5c25fa51e92170412f006d5 (diff) | |
download | sonarqube-798cc52b2cd83e1389cbd79fa0b52eb5d6ebae91.tar.gz sonarqube-798cc52b2cd83e1389cbd79fa0b52eb5d6ebae91.zip |
make quality gate ITs more reliable, by unsetting default qg
This tries to fix false positives on QualityGateTest::does_not_fail_when_condition_is_on_removed_metric
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectQualityGatePageTest.java | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectQualityGatePageTest.java b/tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectQualityGatePageTest.java index 9fd03897d08..438d239d6c9 100644 --- a/tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectQualityGatePageTest.java +++ b/tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectQualityGatePageTest.java @@ -66,10 +66,15 @@ public class ProjectQualityGatePageTest { QualityGate customQualityGate = createCustomQualityGate("should_display_default"); qualityGateClient().setDefault(customQualityGate.id()); - ProjectQualityGatePage page = openPage(); - SelenideElement selectedQualityGate = page.getSelectedQualityGate(); - selectedQualityGate.should(Condition.hasText("Default")); - selectedQualityGate.should(Condition.hasText(customQualityGate.name())); + try { + ProjectQualityGatePage page = openPage(); + SelenideElement selectedQualityGate = page.getSelectedQualityGate(); + selectedQualityGate.should(Condition.hasText("Default")); + selectedQualityGate.should(Condition.hasText(customQualityGate.name())); + } finally { + qualityGateClient().unsetDefault(); + qualityGateClient().destroy(customQualityGate.id()); + } } @Test @@ -107,12 +112,17 @@ public class ProjectQualityGatePageTest { QualityGate customQualityGate = createCustomQualityGate("should_set_default"); qualityGateClient().setDefault(customQualityGate.id()); - ProjectQualityGatePage page = openPage(); - page.setQualityGate(customQualityGate.name()); - - SelenideElement selectedQualityGate = page.getSelectedQualityGate(); - selectedQualityGate.should(Condition.hasText("Default")); - selectedQualityGate.should(Condition.hasText(customQualityGate.name())); + try { + ProjectQualityGatePage page = openPage(); + page.setQualityGate(customQualityGate.name()); + + SelenideElement selectedQualityGate = page.getSelectedQualityGate(); + selectedQualityGate.should(Condition.hasText("Default")); + selectedQualityGate.should(Condition.hasText(customQualityGate.name())); + } finally { + qualityGateClient().unsetDefault(); + qualityGateClient().destroy(customQualityGate.id()); + } } @Test |