Skip to content

chore: gate the sharing dialog search box before typing - #4731

Closed
karolinelien wants to merge 1 commit into
masterfrom
chore/de-flake-sharing-dialog-search
Closed

chore: gate the sharing dialog search box before typing#4731
karolinelien wants to merge 1 commit into
masterfrom
chore/de-flake-sharing-dialog-search

Conversation

@karolinelien

Copy link
Copy Markdown
Contributor

Why

you change the sharing settings clicks Share view and types into the dialog's search box with nothing in between:

cy.contains('Share view').click();
cy.get('[placeholder="Search"]').type('Boateng');

That box is disabled while the dialog loads the object's sharing state, and cy.type() does not wait for the disabled state to clear. The CI error shows it — note the missing Timed out retrying prefix, so it threw immediately rather than after the command timeout:

CypressError: `cy.type()` failed because it targeted a disabled element.

cy.get retried only until the input existed, which it does while still disabled.

Not version specific: the same scenario fails the same way on cypress (2.42, 5) and, on another branch, on cypress (2.43, 5). It is a race.

What

Gate the input with a retrying should('be.enabled'), and scope the lookup to [data-test="sharing-dialog"] the way the newer WorkingListsSharing step already does — the bare [placeholder="Search"] would match any search box on the page.

Verification

Ran TrackerWorkingListsUser.feature against play.im.dhis2.org/stable-2-43-1 with the gate in place: both sharing scenarios pass, including The Program stage custom working can be shared, the one failing in CI. One unrelated scenario fails locally on demo-data counts (Show only teis with active enrollments and unassinged events expects 4 rows, play has 3).

The version matrix only runs when the PR is labelled (e2e-tests / testing), so a label is needed to exercise this in CI.

AI Assisted.

`you change the sharing settings` clicked "Share view" and typed into the
dialog's search box with nothing in between. The box is disabled while the
dialog loads the object's sharing state, and `cy.type()` does not wait for
that to clear - the CI error carries no "Timed out retrying" prefix, so it
threw immediately rather than after the command timeout. `cy.get` retried
only until the input existed, which it does while still disabled.

Gate it with a retrying `should('be.enabled')` and scope the lookup to the
dialog, the way the newer WorkingListsSharing step already does - the bare
`[placeholder="Search"]` would match any search box on the page.

This is the failure seen on `cypress (2.42, 5)` and, on another branch, on
`cypress (2.43, 5)` - same scenario, same error, different version, so a race
rather than anything version specific.

Verified against play stable-2-43-1: both sharing scenarios pass with the
gate in place.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Sep 7, 2026

Copy link
Copy Markdown

@karolinelien
karolinelien deleted the chore/de-flake-sharing-dialog-search branch September 7, 2026 17:22
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