Skip to content

Commit

Permalink
Merge pull request #618 from jtnord/flaky-script-console
Browse files Browse the repository at this point in the history
Fix a flakiness observed when using master.runScript()
  • Loading branch information
jtnord authored Nov 6, 2020
2 parents 58a8462 + baddcdf commit 2f748dc
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
package org.jenkinsci.test.acceptance.po;

import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.NoSuchElementException;

/**
* Encapsulate CodeMirror wizardry.
Expand All @@ -47,7 +48,8 @@ public void set(String content) {
}

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

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

0 comments on commit 2f748dc

Please # to comment.