Add e2e test for cross-client query invalidation via Centrifugo#699
Draft
valentin0h wants to merge 1 commit intodevfrom
Draft
Add e2e test for cross-client query invalidation via Centrifugo#699valentin0h wants to merge 1 commit intodevfrom
valentin0h wants to merge 1 commit intodevfrom
Conversation
Two-browser Playwright test that proves the realtime query invalidation pipeline works end-to-end: User B's mutation publishes to Centrifugo, User A's WebSocket subscription triggers queryClient.invalidateQueries, and the listJoinRequests query refetches without a page refresh. Primary assertion is a network intercept (waitForResponse) catching the refetch on User A's page — the direct proof that invalidation fired. Also adds Centrifugo env vars to dev:e2e and playwright config, and starts a Centrifugo Docker container in the CI workflow.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
QueryInvalidationSubscriber→queryClient.invalidateQueries→ query refetch → UI updatedev:e2escript andplaywright.config.tsHow the test works
Two separate browser contexts, two different users, zero page refreshes:
listJoinRequestsquery fires, registers onprofileJoinRequest:targetchannel, WebSocket subscription openscreateJoinRequestmutation publishes to Centrifugo on the same channelQueryInvalidationSubscriberreceives →invalidateQueries→listJoinRequestsrefetchesPrimary assertion: Network intercept (
page.waitForResponse) catches thelistJoinRequestsrefetch on User A's page — direct proof the invalidation pipeline triggered a refetch without navigation.Secondary assertion: UI shows "Join requests" panel and "wants to join your organization" text on User A's page.
Files changed
tests/e2e/tests/query-invalidation.spec.tstests/e2e/playwright.config.tspackage.jsondev:e2e,end-to-endscript alias.github/workflows/e2e-tests.yml