Skip to content

Commit 6af894b

Browse files
committed
skip tests on firefox
1 parent 91fe0dd commit 6af894b

File tree

1 file changed

+72
-62
lines changed
  • packages/integration-tests/suites/replay/requests

1 file changed

+72
-62
lines changed

packages/integration-tests/suites/replay/requests/test.ts

Lines changed: 72 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -5,87 +5,97 @@ import { expectedFetchPerformanceSpan, expectedXHRPerformanceSpan } from '../../
55
import { getReplayRecordingContent, shouldSkipReplayTest, waitForReplayRequest } from '../../../utils/replayHelpers';
66

77
for (let i = 0; i < 25; i++) {
8-
sentryTest(`replay recording should contain fetch request span (${i})}`, async ({ getLocalTestPath, page }) => {
9-
if (shouldSkipReplayTest()) {
10-
sentryTest.skip();
11-
}
12-
13-
const reqPromise0 = waitForReplayRequest(page, 0);
14-
const reqPromise1 = waitForReplayRequest(page, 1);
15-
16-
await page.route('https://dsn.ingest.sentry.io/**/*', route => {
17-
return route.fulfill({
18-
status: 200,
19-
contentType: 'application/json',
20-
body: JSON.stringify({ id: 'test-id' }),
8+
sentryTest(
9+
`replay recording should contain fetch request span (${i})}`,
10+
async ({ getLocalTestPath, page, browserName }) => {
11+
// For some reason, observing and waiting for requests in firefox is extremely flaky.
12+
// We therefore skip this test for firefox and only test on chromium/webkit.
13+
if (shouldSkipReplayTest() || browserName === 'firefox') {
14+
sentryTest.skip();
15+
}
16+
17+
const reqPromise0 = waitForReplayRequest(page, 0);
18+
const reqPromise1 = waitForReplayRequest(page, 1);
19+
20+
await page.route('https://dsn.ingest.sentry.io/**/*', route => {
21+
return route.fulfill({
22+
status: 200,
23+
contentType: 'application/json',
24+
body: JSON.stringify({ id: 'test-id' }),
25+
});
2126
});
22-
});
2327

24-
await page.route('https://example.com', route => {
25-
return route.fulfill({
26-
status: 200,
27-
contentType: 'application/json',
28-
body: 'hello world',
28+
await page.route('https://example.com', route => {
29+
return route.fulfill({
30+
status: 200,
31+
contentType: 'application/json',
32+
body: 'hello world',
33+
});
2934
});
30-
});
3135

32-
const url = await getLocalTestPath({ testDir: __dirname });
36+
const url = await getLocalTestPath({ testDir: __dirname });
3337

34-
await page.goto(url);
35-
await page.click('#go-background');
36-
const { performanceSpans: spans0 } = getReplayRecordingContent(await reqPromise0);
38+
await page.goto(url);
39+
await page.click('#go-background');
40+
const { performanceSpans: spans0 } = getReplayRecordingContent(await reqPromise0);
3741

38-
const receivedResponse = page.waitForResponse('https://example.com');
42+
const receivedResponse = page.waitForResponse('https://example.com');
3943

40-
await page.click('#fetch');
41-
await receivedResponse;
44+
await page.click('#fetch');
45+
await receivedResponse;
4246

43-
// await page.click('#go-background');
44-
const { performanceSpans: spans1 } = getReplayRecordingContent(await reqPromise1);
47+
// await page.click('#go-background');
48+
const { performanceSpans: spans1 } = getReplayRecordingContent(await reqPromise1);
4549

46-
const performanceSpans = [...spans0, ...spans1];
47-
expect(performanceSpans).toContainEqual(expectedFetchPerformanceSpan);
48-
});
50+
const performanceSpans = [...spans0, ...spans1];
51+
expect(performanceSpans).toContainEqual(expectedFetchPerformanceSpan);
52+
},
53+
);
4954

50-
sentryTest(`replay recording should contain XHR request span (${i})`, async ({ getLocalTestPath, page }) => {
51-
if (shouldSkipReplayTest()) {
52-
sentryTest.skip();
53-
}
55+
sentryTest(
56+
`replay recording should contain XHR request span (${i})`,
57+
async ({ getLocalTestPath, page, browserName }) => {
58+
// For some reason, observing and waiting for requests in firefox is extremely flaky.
59+
// We therefore skip this test for firefox and only test on chromium/webkit.
60+
if (shouldSkipReplayTest() || browserName === 'firefox') {
61+
sentryTest.skip();
62+
}
5463

55-
const reqPromise0 = waitForReplayRequest(page, 0);
56-
const reqPromise1 = waitForReplayRequest(page, 1);
64+
const reqPromise0 = waitForReplayRequest(page, 0);
65+
const reqPromise1 = waitForReplayRequest(page, 1);
5766

58-
await page.route('https://dsn.ingest.sentry.io/**/*', route => {
59-
return route.fulfill({
60-
status: 200,
61-
contentType: 'application/json',
62-
body: JSON.stringify({ id: 'test-id' }),
67+
await page.route('https://dsn.ingest.sentry.io/**/*', route => {
68+
return route.fulfill({
69+
status: 200,
70+
contentType: 'application/json',
71+
body: JSON.stringify({ id: 'test-id' }),
72+
});
6373
});
64-
});
6574

66-
await page.route('https://example.com', route => {
67-
return route.fulfill({
68-
status: 200,
69-
contentType: 'application/json',
70-
body: 'hello world',
75+
await page.route('https://example.com', route => {
76+
return route.fulfill({
77+
status: 200,
78+
contentType: 'application/json',
79+
body: 'hello world',
80+
});
7181
});
72-
});
7382

74-
const url = await getLocalTestPath({ testDir: __dirname });
83+
const url = await getLocalTestPath({ testDir: __dirname });
7584

76-
await page.goto(url);
77-
await page.click('#go-background');
78-
const { performanceSpans: spans0 } = getReplayRecordingContent(await reqPromise0);
85+
await page.goto(url);
86+
await page.click('#go-background');
87+
const { performanceSpans: spans0 } = getReplayRecordingContent(await reqPromise0);
7988

80-
const receivedResponse = page.waitForResponse('https://example.com');
81-
await page.click('#xhr');
82-
await receivedResponse;
89+
const receivedResponse = page.waitForResponse('https://example.com');
90+
await page.click('#xhr');
91+
await receivedResponse;
8392

84-
// await page.click('#go-background');
85-
const { performanceSpans: spans1 } = getReplayRecordingContent(await reqPromise1);
93+
// await page.click('#go-background');
94+
const { performanceSpans: spans1 } = getReplayRecordingContent(await reqPromise1);
8695

87-
const performanceSpans = [...spans0, ...spans1];
96+
const performanceSpans = [...spans0, ...spans1];
8897

89-
expect(performanceSpans).toContainEqual(expectedXHRPerformanceSpan);
90-
});
98+
expect(performanceSpans).toContainEqual(expectedXHRPerformanceSpan);
99+
},
100+
);
91101
}

0 commit comments

Comments
 (0)