Skip to content

test: guard against clicking disabled slideshow button (DHIS2-21933) - #3337

Merged
karolinelien merged 2 commits into
masterfrom
test/deflake-slideshow-cypress
Aug 31, 2026
Merged

test: guard against clicking disabled slideshow button (DHIS2-21933)#3337
karolinelien merged 2 commits into
masterfrom
test/deflake-slideshow-cypress

Conversation

@karolinelien

@karolinelien karolinelien commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

https://dhis2.atlassian.net/browse/DHIS2-21933

Description

Small hardening fix for cypress/integration/slideshow.cy.js:

Swaps the text-based cy.get('button').contains('Slideshow') selector for the button's
existing data-test="enter-slideshow-button" hook, and adds a .should('not.be.disabled')
guard before clicking it. The button can be legitimately disabled offline/embedded/before
items load, and .should('not.be.disabled') makes Cypress retry until it's enabled instead
of risking realClick() silently no-op'ing on a disabled button.

The two cy.wait(11000) calls in the autoplay test are kept as-is: they assert the slide has
not yet changed before the real 10s autoplay timer fires, which a retrying assertion
wouldn't correctly verify, so a fixed wait is the right tool there.

No production code (src/) changed. Not a fix for the broader Cypress suite flakiness —
just a small, targeted improvement to this one selector.


Quality checklist

  • Tested with and without global shell — N/A, no shell-affecting change
  • Cypress and/or Jest tests added/updated
  • Docs added — N/A
  • d2-ci dependency replaced (requires https://github.com/dhis2/analytics/pull/XXX) — N/A
  • Small screen tested — N/A
  • Offline tested — N/A
  • Tester approved (name)

ToDos

  • todo

Known issues

  • issue

Screenshots

supporting text

AI Assisted

@dhis2-bot

Copy link
Copy Markdown
Contributor

🚀 Deployed on https://pr-3337.dashboard.netlify.dhis2.org

@dhis2-bot
dhis2-bot temporarily deployed to netlify August 3, 2026 15:24 Inactive
@karolinelien karolinelien changed the title test: de-flake slideshow Cypress spec test: de-flake slideshow Cypress spec (DHIS2-21933) Aug 3, 2026
@karolinelien
karolinelien marked this pull request as ready for review August 3, 2026 15:29
karolinelien added a commit that referenced this pull request Aug 4, 2026
Dumps a failed test's request log, console errors/warnings, and
cookie/localStorage state via cy.task so it's visible in CI logs,
to investigate the description.cy.js/slideshow.cy.js cross-spec flake
(see PR #3337). Not for merging.

AI Assisted
@dhis2-bot
dhis2-bot temporarily deployed to netlify August 31, 2026 12:53 Inactive
Swap the text-based "Slideshow" button selector for the existing
data-test="enter-slideshow-button" hook, and add a .should('not.be.disabled')
guard before clicking it, since the button can be legitimately disabled
offline/embedded/before items load and realClick() can silently no-op on a
disabled button.

The cy.wait(11000) calls in the autoplay test are kept as-is: they assert the
slide has NOT yet changed before the real 10s autoplay timer fires, which a
retrying assertion would not correctly verify.

AI Assisted
@karolinelien
karolinelien force-pushed the test/deflake-slideshow-cypress branch from a2d47b7 to 20f001f Compare August 31, 2026 12:58
@sonarqubecloud

Copy link
Copy Markdown

@HendrikThePendric HendrikThePendric left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As discussed with @karolinelien, while I do not expect this to help "de-flaking" very much, this is still a valid improvement. It's better to wait for the button to be enabled before clicking.

Perhaps it would be good to go with a slightly less ambitious PR title ;-)

@karolinelien karolinelien changed the title test: de-flake slideshow Cypress spec (DHIS2-21933) test: guard against clicking disabled slideshow button (DHIS2-21933) Aug 31, 2026
@karolinelien
karolinelien merged commit 9652cb9 into master Aug 31, 2026
71 of 74 checks passed
@karolinelien
karolinelien deleted the test/deflake-slideshow-cypress branch August 31, 2026 13:38
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.

3 participants