Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update selectors: credentials dialog, declarative migration assistant #1497

Merged
merged 1 commit into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.jenkinsci.test.acceptance.po.PageArea;
import org.jenkinsci.test.acceptance.po.PageAreaImpl;
import org.jenkinsci.test.acceptance.po.PageObject;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;

Expand All @@ -27,11 +28,18 @@ protected Credential(PageArea area, String relativePath) {
* Adds this credential and close the dialog.
*/
public void add() {
WebElement dialog = find(by.id("credentialsDialog"));
WebElement we = find(by.id("credentials-add-submit-button"));
WebElement dialog = find(by.id("credentials-dialog-form"));
WebElement we = find(submitButton());
we.click();
// wait for the form to be removed from the UI
waitFor(driver).until(ExpectedConditions.invisibilityOf(dialog));
}

/**
* @return dialog submit button selector
*/
public static By submitButton() {
return by.css(".jenkins-button[data-id='ok']");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,11 @@ protected void resolve(String caption) {
* Adds this credential and close the modal dialog.
*/
public void add() {
final By addSubmitButton = by.id("credentials-add-submit-button");

this.findAndPerformClick(addSubmitButton);
this.findAndPerformClick(Credential.submitButton());

waitFor().withTimeout(Duration.ofSeconds(5)).until(() -> {
try {
return !find(addSubmitButton).isDisplayed();
return !find(Credential.submitButton()).isDisplayed();
} catch (final NoSuchElementException | StaleElementReferenceException ex) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void basicDeclarativeTests() throws Exception {
assertThat(driver, hasElement( By.className( "rectangle-conversion-success")));
assertThat(driver, hasElement(By.className("review-converted")));
assertThat(driver, hasElement(By.id("jenkinsfile-content")));
String jenkinsFile = driver.findElement(By.id("jenkinsfile-content")).getAttribute("value");
String jenkinsFile = driver.findElement(By.id("jenkinsfile-content")).getText();
assertThat(jenkinsFile, containsString( "echo 1" ));
}
}