aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel Schwarz <daniel.schwarz@sonarsource.com>2017-08-10 14:04:12 +0200
committerDaniel Schwarz <bartfastiel@users.noreply.github.com>2017-08-16 10:12:36 +0200
commit798cc52b2cd83e1389cbd79fa0b52eb5d6ebae91 (patch)
tree0fccb19e601b77c052c87561a5a411aa867b680c /tests
parentee55e4492b069f30e5c25fa51e92170412f006d5 (diff)
downloadsonarqube-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.java30
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