Add e2e tests for server push events (#36879)

Add e2e tests for the three server push features:
- **Notification count**: verifies badge appears when another user
creates an issue
- **Stopwatch**: verifies stopwatch element is rendered when a stopwatch
is active
- **Logout propagation**: verifies logout in one tab triggers redirect
in another

Tests are transport-agnostic in preparation for a future WebSocket
migration.

---------

Co-authored-by: Claude (Opus 4.6) <noreply@anthropic.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
silverwind
2026-03-27 11:49:11 +01:00
committed by GitHub
co-authored by Claude wxiaoguang
parent b3c6917463
commit de478c4b6f
8 changed files with 222 additions and 116 deletions
+2 -5
View File
@@ -1,6 +1,6 @@
import {env} from 'node:process';
import {test, expect} from '@playwright/test';
import {login, logout} from './utils.ts';
import {login, logout, apiDeleteUser} from './utils.ts';
test.beforeEach(async ({page}) => {
await page.goto('/user/sign_up');
@@ -50,10 +50,7 @@ test('register then login', async ({page}) => {
await login(page, username, password);
// delete via API because of issues related to form-fetch-action
const response = await page.request.delete(`/api/v1/admin/users/${username}?purge=true`, {
headers: {Authorization: `Basic ${btoa(`${env.GITEA_TEST_E2E_USER}:${env.GITEA_TEST_E2E_PASSWORD}`)}`},
});
expect(response.ok()).toBeTruthy();
await apiDeleteUser(page.request, username);
});
test('register with existing username shows error', async ({page}) => {