Skip to content

Commit 9b0b041

Browse files
committed
Fix E2E test flakiness in auth and team suites
- Run microsoft-auth.spec.ts serially so the Admin Settings and Login Page suites can't race on shared global system settings under fullyParallel - Wait for seeded values before editing the team settings form and retry the edit until both inputs stick, avoiding a late re-render silently dropping typed input
1 parent 168666f commit 9b0b041

2 files changed

Lines changed: 23 additions & 6 deletions

File tree

test/e2e/tests/admin/microsoft-auth.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ import { test as base, expect } from '../../lib/fixtures';
22
import { getAdminToken } from '../../lib/fixtures';
33
import * as api from '../../lib/api';
44

5+
// The "Admin Settings" and "Login Page" suites below both mutate the same
6+
// global system settings (auth_microsoft_enabled and oauth_microsoft_config).
7+
// Each describe block is already serial internally, but with fullyParallel
8+
// the two blocks run concurrently on separate workers and stomp on each
9+
// other's global state — e.g. an Admin Settings test clears the OAuth config
10+
// while a Login Page test expects Microsoft enabled. Run the whole file
11+
// serially so the two suites can't race.
12+
base.describe.configure({ mode: 'serial' });
13+
514
// Admin-authenticated context for admin settings pages
615
const adminTest = base.extend({
716
storageState: async ({}, use) => {

test/e2e/tests/teams/team-crud.spec.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,22 @@ test.describe('Team CRUD', () => {
4545
// Navigate to settings tab
4646
await page.getByRole('button', { name: 'Settings', exact: true }).click();
4747

48-
// Update name and description
48+
// The settings form is a controlled component whose inputs are seeded
49+
// from the team API response. Wait for the original values to land
50+
// before editing — otherwise a late re-render during initial page load
51+
// can overwrite what we typed, silently dropping the new name.
4952
const nameInput = page.getByRole('textbox', { name: 'Name' });
50-
await nameInput.clear();
51-
await nameInput.fill('New Name');
52-
5353
const descTextarea = page.locator('textarea');
54-
await descTextarea.clear();
55-
await descTextarea.fill('New description');
54+
await expect(nameInput).toHaveValue('Old Name');
55+
await expect(descTextarea).toHaveValue('Old description');
56+
57+
// Update name and description, retrying until both values stick.
58+
await expect(async () => {
59+
await nameInput.fill('New Name');
60+
await descTextarea.fill('New description');
61+
await expect(nameInput).toHaveValue('New Name', { timeout: 1000 });
62+
await expect(descTextarea).toHaveValue('New description', { timeout: 1000 });
63+
}).toPass({ timeout: 15000 });
5664

5765
await page.getByRole('button', { name: 'Save', exact: true }).click();
5866

0 commit comments

Comments
 (0)