Skip to content

some diagnostics for observed timeouts#2626

Draft
jtnord wants to merge 10 commits intojenkinsci:masterfrom
jtnord:workflow-editor-timeout
Draft

some diagnostics for observed timeouts#2626
jtnord wants to merge 10 commits intojenkinsci:masterfrom
jtnord:workflow-editor-timeout

Conversation

@jtnord
Copy link
Copy Markdown
Member

@jtnord jtnord commented Feb 25, 2026

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)

Testing done

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

```
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);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// 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)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would have been failing for the previous few years!

.sendKeys("a")
.keyUp(controlKey)
.sendKeys(Keys.DELETE)
.sendKeys(text)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant