Skip to content

Attempt to fix flak WP table spec#22570

Merged
klaustopher merged 1 commit intodevfrom
fix-flaky-wp-table
Mar 31, 2026
Merged

Attempt to fix flak WP table spec#22570
klaustopher merged 1 commit intodevfrom
fix-flaky-wp-table

Conversation

@klaustopher
Copy link
Copy Markdown
Contributor

@klaustopher klaustopher commented Mar 30, 2026

Fix flaky work package table widget spec on my page

Problem

work_package_table_spec.rb:79 was intermittently failing after a page reload with:

expected not to find visible css ".subject" with text "WorkPackage No. 24", found 3 matches

The table rendered in its default (unfiltered, all-columns) state instead of the saved filter + column configuration.

Root cause

WidgetWpTableComponent auto-saves the query via an RxJS subscription on querySpace.query.values$() with a skip(2) guard. When the column configuration modal is closed (Apply clicked), the save is triggered through a reactive chain:

column state update → query space emits → ensureFormAndSaveQuery() → HTTP PATCH

This chain involves enough async hops that wait_for_network_idle called immediately after the click could fire during a brief window before the PATCH request was initiated — the network was already idle at that point, so Ferrum returned prematurely and the browser navigated away before the save completed.

On reload the server returned the original, unsaved query, causing both the filter and column changes to appear missing.

Fix

Two ordering changes to the spec:

Before the reload — move wait_for_network_idle to after the DOM assertions that confirm the column removal. have_no_css(".subject", ...) forces Capybara to retry until Angular has updated the DOM, which guarantees the RxJS chain has fired and the PATCH is in-flight. Only then does wait_for_network_idle confirm the request completed.

After the reload — move the widget title assertion (have_field("editable-toolbar-title", with: "My WP Filter", wait: 10)) to before the negative assertions. The title comes from the grid API; waiting for it to appear confirms the widget is initialized from persisted state. A second wait_for_network_idle then catches the subsequent query and results fetches before any negative assertions run.

@klaustopher klaustopher added flaky-spec Addresses a Flaky Spec needs review labels Mar 30, 2026
Copy link
Copy Markdown
Contributor

@HDinger HDinger left a comment

Choose a reason for hiding this comment

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

👏

@klaustopher klaustopher merged commit c912058 into dev Mar 31, 2026
21 of 22 checks passed
@klaustopher klaustopher deleted the fix-flaky-wp-table branch March 31, 2026 07:52
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 31, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

flaky-spec Addresses a Flaky Spec needs review

Development

Successfully merging this pull request may close these issues.

2 participants