Skip to content

Commit 18f7107

Browse files
authored
fix(test): Fix flaky browser integration tests. (#10484)
This is not a complete fix for all flaky integration tests, but it seems to resolve flakiness of a few tests that fail very frequently.
1 parent d2fce9b commit 18f7107

File tree

4 files changed

+7
-5
lines changed
  • dev-packages/browser-integration-tests/suites

4 files changed

+7
-5
lines changed

dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/click/test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,8 @@ sentryTest(
7878

7979
await page.goto(url);
8080
await page.locator('#annotated-button').click();
81-
await page.evaluate('Sentry.captureException("test exception")');
8281

83-
const eventData = await promise;
82+
const [eventData] = await Promise.all([promise, page.evaluate('Sentry.captureException("test exception")')]);
8483

8584
expect(eventData.breadcrumbs).toEqual([
8685
{

dev-packages/browser-integration-tests/suites/integrations/httpclient/fetch/simple/test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import type { Event } from '@sentry/types';
44
import { sentryTest } from '../../../../../utils/fixtures';
55
import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers';
66

7+
// This test rarely flakes with timeouts. The reason might be:
8+
// https://github.com/microsoft/playwright/issues/10376
79
sentryTest(
810
'should assign request and response context from a failed 500 fetch request',
911
async ({ getLocalTestPath, page }) => {

dev-packages/browser-integration-tests/suites/public-api/startSpan/basic/subject.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ async function run() {
66
});
77
}
88

9-
run();
9+
(async () => {
10+
await run();
11+
})();

dev-packages/browser-integration-tests/suites/replay/errorResponse/test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ sentryTest('should stop recording after receiving an error response', async ({ g
2323
});
2424

2525
const url = await getLocalTestPath({ testDir: __dirname });
26-
await page.goto(url);
26+
await Promise.all([page.goto(url), waitForReplayRequest(page)]);
2727

28-
await waitForReplayRequest(page);
2928
await page.locator('button').click();
3029

3130
expect(called).toBe(1);

0 commit comments

Comments
 (0)