Skip to content

Fixed flaky history test by fixing waitForResponse race condition#26788

Merged
cmraible merged 1 commit intoTryGhost:mainfrom
cmraible:fix/flaky-history-test
Mar 11, 2026
Merged

Fixed flaky history test by fixing waitForResponse race condition#26788
cmraible merged 1 commit intoTryGhost:mainfrom
cmraible:fix/flaky-history-test

Conversation

@cmraible
Copy link
Copy Markdown
Collaborator

The waitForResponse listener was registered after the click that triggers the API call, so the response could complete before Playwright started listening. Moved the listener setup before the click to ensure the response is always captured.

The waitForResponse listener was registered after the click that
triggers the API call, so the response could complete before
Playwright started listening. Moved the listener setup before the
click to ensure the response is always captured.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bd31f495-c8db-4a67-8fd0-8b556a6c6eac

📥 Commits

Reviewing files that changed from the base of the PR and between 7d376cc and 9b1f7d4.

📒 Files selected for processing (1)
  • apps/admin-x-settings/test/acceptance/advanced/history.test.ts

Walkthrough

This change refactors a test file to modify the timing of an asynchronous response handler. A promise is introduced to capture the page.waitForResponse condition for the Deleted filter event before the filter action is triggered. The code then replaces an inline page.waitForResponse call with an await of the stored promise after clicking the filter. The URL filtering logic remains functionally equivalent, with the adjustment affecting only when the wait operation is initiated relative to the user action.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing a flaky test by reordering waitForResponse to avoid a race condition.
Description check ✅ Passed The description provides relevant context about the race condition and explains the fix, directly relating to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cmraible cmraible marked this pull request as ready for review March 11, 2026 18:24
@cmraible cmraible enabled auto-merge (squash) March 11, 2026 18:30
@cmraible cmraible merged commit 257ee2b into TryGhost:main Mar 11, 2026
29 checks passed
@cmraible cmraible deleted the fix/flaky-history-test branch March 11, 2026 18:37
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