Fix quert for radio button selection.
@@ -30,7 +30,6 @@ public class IssuesRecorder extends AbstractStep implements PostBuildStep {
private final Control qualityGatesRepeatable = findRepeatableAddButtonFor("qualityGates");
private final Control qualityGateThreshold = control("/qualityGates/threshold");
private final Control qualityGateType = control("/qualityGates/type");
- private final Control qualityGateResult = control("/qualityGates/unstable[true]");
private final Control advancedButton = control("advanced-button");
private final Control enabledForFailureCheckBox = control("enabledForFailure");
private final Control ignoreQualityGate = control("ignoreQualityGate");
@@ -268,12 +267,8 @@ public class IssuesRecorder extends AbstractStep implements PostBuildStep {
* @return the quality gate result
**/
public QualityGateBuildResult getQualityGateResult() {
- if (isChecked(qualityGateResult)) {
- return QualityGateBuildResult.UNSTABLE;
- }
- else {
- return QualityGateBuildResult.FAILED;
- }
+ return findUnstableRadioButton(self(), true).isSelected()
+ ? QualityGateBuildResult.UNSTABLE : QualityGateBuildResult.FAILED;
}
/**
@@ -581,6 +576,11 @@ public class IssuesRecorder extends AbstractStep implements PostBuildStep {
return this;
}
+ static WebElement findUnstableRadioButton(final WebElement pageArea, final boolean isUnstable) {
+ return pageArea.findElement(
+ by.xpath(".//input[@type='radio' and contains(@path,'unstable[" + isUnstable + "]')]"));
+ }
+
/**
* Available quality gate types.
*/
@@ -768,8 +768,7 @@ public class IssuesRecorder extends AbstractStep implements PostBuildStep {
}
public void setUnstable(final boolean isUnstable) {
- WebElement radioButton = self().findElement(
- by.xpath(".//input[@type='radio' and contains(@path,'unstable[" + isUnstable + "]')]"));
+ WebElement radioButton = IssuesRecorder.findUnstableRadioButton(self(), isUnstable);
((EventFiringWebDriver) driver).executeScript("arguments[0].click();", radioButton);
}
}
