mirror of
https://github.com/go-gitea/gitea.git
synced 2026-07-22 09:01:25 +00:00
The test raced the server-side SSE channel registration: a logout emitted before registration is silently dropped ([example flake](https://github.com/go-gitea/gitea/actions/runs/29699349255/job/88225654080)). The 500ms wait from https://github.com/go-gitea/gitea/pull/37403 only made this unlikely. The server now registers the channel before sending the initial response bytes, so an open connection implies registration. The shared worker forwards the built-in `open` event (replaying it to late-attaching ports via `EventSource.readyState`), the page exposes it as a `data-user-events-connected` attribute, and the test waits for that attribute instead of a fixed timeout.
import {env} from 'node:process';
import {test, expect} from '@playwright/test';
import {apiCreateRepo, randomString} from './utils.ts';
test('repo readme', async ({page}) => {
const repoName = `e2e-readme-${randomString(8)}`;
await apiCreateRepo(page.request, {name: repoName});
await page.goto(`/${env.GITEA_TEST_E2E_USER}/${repoName}`);
await expect(page.locator('#readme')).toContainText(repoName);
});