Skip to content

Commit 2f748dc

Browse files
authored
Merge pull request #618 from jtnord/flaky-script-console
Fix a flakiness observed when using master.runScript()
2 parents 58a8462 + baddcdf commit 2f748dc

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/main/java/org/jenkinsci/test/acceptance/po/CodeMirror.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
package org.jenkinsci.test.acceptance.po;
2525

2626
import org.openqa.selenium.JavascriptExecutor;
27+
import org.openqa.selenium.NoSuchElementException;
2728

2829
/**
2930
* Encapsulate CodeMirror wizardry.
@@ -47,7 +48,8 @@ public void set(String content) {
4748
}
4849

4950
// can't use find() because it wants a visible element
50-
driver.findElement(by.xpath("//*[@path='%s']", getPath())); // wait until the element in question appears in DOM
51+
// wait until the element in question appears in DOM as it is added by JavaScript
52+
waitFor().ignoring(NoSuchElementException.class).until(() -> driver.findElement(by.xpath("//*[@path='%s']", getPath())));
5153

5254
executeScript(scriptSet, String.format("//*[@path='%s']/following-sibling::div", getPath()), content);
5355
}

0 commit comments

Comments
 (0)