aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-qa-util
diff options
context:
space:
mode:
authorPascal Mugnier <pascal.mugnier@sonarsource.com>2018-03-29 16:40:55 +0200
committerSonarTech <sonartech@sonarsource.com>2018-04-05 20:20:47 +0200
commitd11fb8ece1a77f028a7ba95004df46ce725a0c00 (patch)
treeb987f741d2bd1a42eea69694f631059971465fb3 /server/sonar-qa-util
parente2e069237203558e6db52f946d6b4564f30652fe (diff)
downloadsonarqube-d11fb8ece1a77f028a7ba95004df46ce725a0c00.tar.gz
sonarqube-d11fb8ece1a77f028a7ba95004df46ce725a0c00.zip
SONAR-10039 Ease changing of password settings
Diffstat (limited to 'server/sonar-qa-util')
-rw-r--r--server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/settings/SettingsPage.java65
1 files changed, 65 insertions, 0 deletions
diff --git a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/settings/SettingsPage.java b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/settings/SettingsPage.java
index bd03b0ea77d..9bb53d9b50f 100644
--- a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/settings/SettingsPage.java
+++ b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/settings/SettingsPage.java
@@ -23,6 +23,9 @@ import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;
import org.openqa.selenium.By;
+import org.openqa.selenium.Keys;
+
+import static com.codeborne.selenide.Selectors.byText;
public class SettingsPage {
@@ -55,6 +58,12 @@ public class SettingsPage {
return this;
}
+ public SettingsPage assertSettingValueIsNotedAsDefault(String settingKey) {
+ Selenide.$("[data-key=\"" + settingKey + "\"]").find(".spacer-top.note")
+ .shouldBe(Condition.text("(default)"));
+ return this;
+ }
+
public SettingsPage assertBooleanSettingValue(String settingKey, boolean value) {
SelenideElement toggle = Selenide.$("button[name=\"settings[" + settingKey + "]\"]");
if (value) {
@@ -65,6 +74,62 @@ public class SettingsPage {
return this;
}
+ public SettingsPage assertSettingValueCanBeSaved(String settingKey) {
+ Selenide.$("[data-key=\"" + settingKey + "\"]").find(byText("Save"))
+ .should(Condition.exist)
+ .shouldNotBe(Condition.attribute("disabled"));
+ return this;
+ }
+
+ public SettingsPage assertSettingValueCannotBeSaved(String settingKey) {
+ Selenide.$("[data-key=\"" + settingKey + "\"]").find(byText("Save"))
+ .should(Condition.exist)
+ .shouldBe(Condition.attribute("disabled"));
+ return this;
+ }
+
+ public SettingsPage assertSettingValueCanBeReset(String settingKey) {
+ Selenide.$("[data-key=\"" + settingKey + "\"]").find(byText("Reset"))
+ .should(Condition.exist);
+ return this;
+ }
+
+ public SettingsPage assertSettingValueCanBeCanceled(String settingKey) {
+ Selenide.$("[data-key=\"" + settingKey + "\"]").find(byText("Cancel"))
+ .should(Condition.exist);
+ return this;
+ }
+
+ public SettingsPage assertInputCount(String settingKey, int count) {
+ Selenide.$("[data-key=\"" + settingKey + "\"]").findAll("input").shouldHaveSize(count);
+ return this;
+ }
+
+ public SettingsPage changeSettingValue(String settingKey, String value) {
+ Selenide.$("[data-key=\"" + settingKey + "\"]").find("input").val(value);
+ return this;
+ }
+
+ public SettingsPage changeSettingValue(String settingKey, int index, String value) {
+ Selenide.$("[data-key=\"" + settingKey + "\"]").findAll("input").get(index).val(value);
+ return this;
+ }
+
+ public SettingsPage clickOnCancel(String settingKey) {
+ Selenide.$("[data-key=\"" + settingKey + "\"]").find(byText("Cancel")).click();
+ return this;
+ }
+
+ public SettingsPage removeFirstValue(String settingKey) {
+ Selenide.$("[data-key=\"" + settingKey + "\"]").find(".button.js-remove-value.button-icon").click();
+ return this;
+ }
+
+ public SettingsPage sendDeleteKeyToSettingField(String settingKey) {
+ Selenide.$("[data-key=\"" + settingKey + "\"]").find("input").sendKeys(Keys.BACK_SPACE);
+ return this;
+ }
+
public SettingsPage setStringValue(String settingKey, String value) {
SelenideElement setting = Selenide.$(".settings-definition[data-key=\"" + settingKey + "\"]");
setting.find("input").val(value);