Add e2e tests for server push events#36879
Open
silverwind wants to merge 10 commits intogo-gitea:mainfrom
Open
Add e2e tests for server push events#36879silverwind wants to merge 10 commits intogo-gitea:mainfrom
silverwind wants to merge 10 commits intogo-gitea:mainfrom
Conversation
Add tests for the three SSE features: notification count updates, stopwatch events, and logout propagation across tabs. Also extract user management helpers (apiCreateUser, apiDeleteUser, loginUser) into the shared e2e utils and use them in register tests. Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
Remove SSE-specific code (raw EventSource connections) from e2e tests so they work with any transport (EventSource, WebSocket, etc.). - Stopwatch test: verify DOM element instead of raw EventSource data - Logout test: remove EventSource open probe and waitForTimeout - Remove unnecessary 5s sleep from logoutFromWorker (session is already destroyed server-side before the event reaches the client) - Reduce EVENT_SOURCE_UPDATE_TIME from 2s to 1s for faster tests - Raise timeouts for CI (60s assertions, 120s describe) Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Playwright e2e coverage around the UI’s server-push/event-stream driven behaviors (notifications, stopwatch, logout propagation) and introduces supporting e2e utilities/config tweaks to make these tests run quickly and deterministically.
Changes:
- Add new
events.test.tscovering notification badge, active stopwatch rendering, and cross-tab logout behavior. - Speed up event polling for e2e runs by setting
ui.notification.EVENT_SOURCE_UPDATE_TIME=1s. - Extend e2e test utilities with admin user create/delete helpers and per-user auth headers.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| web_src/js/modules/worker.ts | Simplifies worker-triggered logout redirect (removes delay + async). |
| tools/test-e2e.sh | Sets a faster EventSource update interval for the isolated e2e server. |
| tests/e2e/utils.ts | Adds API helpers for creating/deleting users and logging in as them. |
| tests/e2e/register.test.ts | Refactors cleanup to reuse apiDeleteUser() helper. |
| tests/e2e/events.test.ts | New e2e tests for notification count, stopwatch presence, and logout propagation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
- Reorder notification test to login first, then create issue, so the badge appearance is actually driven by server push, not SSR - Pass baseURL to browser.newContext() so relative URLs work in the logout propagation test - Add apiCreateIssue and apiStartStopwatch helpers with retry logic - Add optional headers param to apiCreateRepo for per-user auth - Use helpers instead of raw request.post() calls in event tests - Rename apiBaseUrl to baseUrl as it is the general server URL - Use env.GITEA_TEST_E2E_DOMAIN instead of hardcoded email domain Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
lunny
approved these changes
Mar 10, 2026
Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
Co-Authored-By: Claude (Opus 4.6) <noreply@anthropic.com>
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.
Add e2e tests for the three server push features:
Tests are transport-agnostic in preparation for a future WebSocket migration.