Skip to content

Improve stability of cancel tests#881

Merged
timja merged 2 commits intojenkinsci:mainfrom
lewisbirks:cancel-test-stability
Jul 7, 2025
Merged

Improve stability of cancel tests#881
timja merged 2 commits intojenkinsci:mainfrom
lewisbirks:cancel-test-stability

Conversation

@lewisbirks
Copy link
Contributor

An attempt to fix jenkinsci/bom#5276. I wasn't able to recreate the issue locally but looking at the output of the ci test results it appears that the code to wait until the cancel button is hidden is executing before the dialog is closed and as such finds two instances of a cancel button on the page (the button in the dialog and the button to show the dialog).

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

Signed-off-by: Lewis Birks <22620804+lewisbirks@users.noreply.github.com>
@lewisbirks lewisbirks requested a review from a team as a code owner July 7, 2025 16:33
@timja timja added the developer label Jul 7, 2025
assertTrue(p.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Cancel"))
.isVisible());
Locator cancelLocator = p.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Cancel"));
assertThat(cancelLocator).isVisible();
Copy link
Member

Choose a reason for hiding this comment

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

There doesn't seem to be any waiting here, (except the one wait for hidden that is removed), could you explain this a bit? the isVisible and isHidden checks you've added won't wait for them to be true as far as I can tell?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From what I remember in the docs, the assertions retry/wait automatically. I'll double check tomorrow though

Copy link
Member

Choose a reason for hiding this comment

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

Ah, Time to retry the assertion for in milliseconds. Defaults to 5000.

@timja timja enabled auto-merge (squash) July 7, 2025 21:30
@timja timja merged commit 595395f into jenkinsci:main Jul 7, 2025
16 of 17 checks passed
@lewisbirks lewisbirks deleted the cancel-test-stability branch July 7, 2025 21:58
@basil
Copy link
Member

basil commented Jul 7, 2025

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

io.jenkins.plugins.pipelinegraphview.PipelineGraphViewCancelTest#cancelButtonCancelsBuild is flaky

3 participants