Skip to content

Commit c1b45ab

Browse files
authored
chore: stabilize flaky playwright tests (#1398)
There are two flaky tests that have been consistently flaky for a week. Making these tests more robust.
1 parent a9f10c5 commit c1b45ab

File tree

3 files changed

+76
-265
lines changed

3 files changed

+76
-265
lines changed

packages/app/playwright.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default defineConfig({
1414
/* Retry on CI only */
1515
retries: process.env.CI ? 2 : 1,
1616
/* Use multiple workers on CI for faster execution */
17-
workers: undefined,
17+
workers: process.env.CI ? 2 : undefined,
1818
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
1919
reporter: [
2020
['html'],
@@ -33,8 +33,8 @@ export default defineConfig({
3333
video: 'retain-on-failure',
3434
},
3535

36-
/* Global test timeout - increased from default 30s to 60s to reduce flaky test failures */
37-
timeout: 60 * 1000,
36+
/* Global test timeout - CI needs more time than local */
37+
timeout: 45 * 1000,
3838

3939
/* Configure projects for different test environments */
4040
projects: [

packages/app/tests/e2e/features/search/relative-time.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,10 @@ test.describe('Relative Time Picker', { tag: '@relative-time' }, () => {
288288
const timePickerInput = page.locator(
289289
'[data-testid="time-picker-input"]',
290290
);
291+
// Wait for the UI to update with the URL state
292+
await expect(timePickerInput).toHaveValue('Last 30 minutes', {
293+
timeout: 5000,
294+
});
291295
const inputValue = await timePickerInput.inputValue();
292296
expect(inputValue).toBe('Last 30 minutes');
293297
});
@@ -314,6 +318,14 @@ test.describe('Relative Time Picker', { tag: '@relative-time' }, () => {
314318
});
315319

316320
await test.step('Open time picker and verify relative toggle is on', async () => {
321+
// Wait for the time picker to be ready with the URL state
322+
const timePickerInput = page.locator(
323+
'[data-testid="time-picker-input"]',
324+
);
325+
await expect(timePickerInput).toHaveValue('Last 30 minutes', {
326+
timeout: 5000,
327+
});
328+
317329
await page.click('[data-testid="time-picker-input"]');
318330
await page.waitForSelector('[data-testid="time-picker-popover"]', {
319331
state: 'visible',

0 commit comments

Comments
 (0)