Add pr-review e2e test and speed up e2e tests (#37345)
- add pr-review e2e test - speed up most tests by logging in via POST to avoid the login form, login form is still exercised in a dedicated test - speed up most tests be removing post-test cleanup, unnecessary because each repo is created with a unique name - misc parallelization and api call reduction - total suite runtime is about the same as before --------- Co-authored-by: Claude (Opus 4.7) <noreply@anthropic.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
+12
-17
@@ -1,5 +1,5 @@
|
||||
import {test, expect} from '@playwright/test';
|
||||
import {loginUser, baseUrl, apiUserHeaders, apiCreateUser, apiDeleteUser, apiCreateRepo, apiCreateIssue, apiStartStopwatch, timeoutFactor, randomString} from './utils.ts';
|
||||
import {loginUser, baseUrl, apiUserHeaders, apiCreateUser, apiCreateRepo, apiCreateIssue, apiStartStopwatch, timeoutFactor, randomString} from './utils.ts';
|
||||
|
||||
// These tests rely on a short EVENT_SOURCE_UPDATE_TIME in the e2e server config.
|
||||
test.describe('events', () => {
|
||||
@@ -15,6 +15,7 @@ test.describe('events', () => {
|
||||
apiCreateRepo(request, {name: repoName, headers: apiUserHeaders(owner)}),
|
||||
loginUser(page, owner),
|
||||
]);
|
||||
await page.goto('/');
|
||||
const badge = page.locator('a.not-mobile .notification_count');
|
||||
await expect(badge).toBeHidden();
|
||||
|
||||
@@ -23,9 +24,6 @@ test.describe('events', () => {
|
||||
|
||||
// Wait for the notification badge to appear via server event
|
||||
await expect(badge).toBeVisible({timeout: 15000 * timeoutFactor});
|
||||
|
||||
// Cleanup
|
||||
await Promise.all([apiDeleteUser(request, commenter), apiDeleteUser(request, owner)]);
|
||||
});
|
||||
|
||||
test('stopwatch', async ({page, request}) => {
|
||||
@@ -34,20 +32,20 @@ test.describe('events', () => {
|
||||
|
||||
await apiCreateUser(request, name);
|
||||
|
||||
// Create repo, issue, and start stopwatch before login
|
||||
await apiCreateRepo(request, {name, headers});
|
||||
await apiCreateIssue(request, name, name, {title: 'events stopwatch test', headers});
|
||||
await apiStartStopwatch(request, name, name, 1, {headers});
|
||||
|
||||
// Login — page renders with the active stopwatch element
|
||||
await loginUser(page, name);
|
||||
// Login in parallel with repo+issue+stopwatch setup (all independent after user exists)
|
||||
await Promise.all([
|
||||
loginUser(page, name),
|
||||
(async () => {
|
||||
await apiCreateRepo(request, {name, headers});
|
||||
await apiCreateIssue(request, name, name, {title: 'events stopwatch test', headers});
|
||||
await apiStartStopwatch(request, name, name, 1, {headers});
|
||||
})(),
|
||||
]);
|
||||
await page.goto('/');
|
||||
|
||||
// Verify stopwatch is visible and links to the correct issue
|
||||
const stopwatch = page.locator('.active-stopwatch.not-mobile');
|
||||
await expect(stopwatch).toBeVisible();
|
||||
|
||||
// Cleanup
|
||||
await apiDeleteUser(request, name);
|
||||
});
|
||||
|
||||
test('logout propagation', async ({browser, request}) => {
|
||||
@@ -75,8 +73,5 @@ test.describe('events', () => {
|
||||
await expect(page2.getByRole('link', {name: 'Sign In'})).toBeVisible();
|
||||
|
||||
await context.close();
|
||||
|
||||
// Cleanup
|
||||
await apiDeleteUser(request, name);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user