some diagnostics for observed timeouts#2626
some diagnostics for observed timeouts#2626jtnord wants to merge 10 commits intojenkinsci:masterfrom
Conversation
``` org.openqa.selenium.TimeoutException: Expected condition failed: Timed out waiting on '#workflow-editor-1 .ace_text-input' to be rendered. (tried for 20 seconds with 500 milliseconds interval) Build info: version: '4.40.0', revision: 'b3333f1' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.12.55+', java.version: '21.0.10' Driver info: driver.version: unknown at org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:276) at org.jenkinsci.test.acceptance.junit.Wait.timeoutException(Wait.java:191) at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:231) at org.jenkinsci.test.acceptance.junit.Wait.until(Wait.java:120) at org.jenkinsci.test.acceptance.po.WorkflowJob.waitForRenderOf(WorkflowJob.java:79) at org.jenkinsci.test.acceptance.po.WorkflowJob$1.waitFor(WorkflowJob.java:70) at org.jenkinsci.test.acceptance.po.WorkflowJob$1.set(WorkflowJob.java:54) ```
| // scroll into view whilst we are waiting | ||
| WebElement placeholder = driver.findElement(By.className("workflow-editor-wrapper")); | ||
| Actions actions = new Actions(driver); | ||
| actions.scrollToElement(placeholder); |
There was a problem hiding this comment.
no longer use the class `workflow-editor-1` (or `workflow-editor`) rather we use the path to the script and then find the `ace_editor` sibling
| private String waitFor(@NonNull final String selector) { | ||
| waitForRenderOf(selector + " .ace_text-input", getJenkins()); | ||
| return selector; | ||
| // scroll into view (by performing a click :-o) so we can see the script being set. |
There was a problem hiding this comment.
can not use Actions().scrollTo(element) -> SeleniumHQ/selenium#17141
| // We can not do in a cross platform way because mac doesn't use <ctrl>+a for "select all" shortcut | ||
| WebElement aceEditorHolder = resolve(); | ||
|
|
||
| // scroll into view https://github.com/SeleniumHQ/selenium/issues/17141#issuecomment-3969129937 |
There was a problem hiding this comment.
| // super.resolve calls CapybaraPortingLayerImpl.find, which calls isDisplayed and fails. | ||
| // so find directly and wait for javascript to have created all the parts. | ||
| return waitFor(driver) | ||
| .ignoring(NoSuchElementException.class, StaleElementReferenceException.class) |
There was a problem hiding this comment.
NoSuchElementException will be thrown until the ace javascript has set things up
StaleElementReferenceException could be thrown if the ace editor setup script is running and updating things beween us getting one of the elements and then searching for the next
| } | ||
|
|
||
| private boolean isMac() { | ||
| if (driver instanceof HasCapabilities capabilityOwner) { |
There was a problem hiding this comment.
at least the RemoteWebdriver, ChromeDriver and Firefox driver all support this interface.
| if (driver instanceof HasCapabilities capabilityOwner) { | ||
| Capabilities caps = capabilityOwner.getCapabilities(); | ||
| Platform platform = caps.getPlatformName(); | ||
| if (platform != null) { |
There was a problem hiding this comment.
it's nullable but was present when using the standalone-firefox and standalone-chrome containers and when using a local firefox.
| @Override | ||
| public void set(String text) { | ||
| try { | ||
| super.set(text); |
There was a problem hiding this comment.
this would have been failing for the previous few years!
| .sendKeys("a") | ||
| .keyUp(controlKey) | ||
| .sendKeys(Keys.DELETE) | ||
| .sendKeys(text) |
There was a problem hiding this comment.
Alas this does not work as the ACE Editor adds auto complete for brached xxx{<CR> it automatically adds a closing brace and positions the cursor..
So sending
node {
sh "sleep 1 || true"
}results in the pipeline script of
node {
sh "sleep 1 || true"
}
}which is bogus...
in the case of an opening brace followed by enter ACE editor will helpfully add a closing brace and position the cursor between the braces. This caused corruption of the pipeline text when entered.
Testing done
Submitter checklist