-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathtest.ts
More file actions
36 lines (29 loc) · 1.06 KB
/
test.ts
File metadata and controls
36 lines (29 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { expect } from '@playwright/test';
import { sentryTest } from '../../../utils/fixtures';
import { getExpectedReplayEvent } from '../../../utils/replayEventTemplates';
import { getReplayEvent, shouldSkipReplayTest, waitForReplayRequest } from '../../../utils/replayHelpers';
sentryTest('should capture replays (@sentry/browser export)', async ({ getLocalTestUrl, page }) => {
if (shouldSkipReplayTest()) {
sentryTest.skip();
}
const reqPromise0 = waitForReplayRequest(page, 0);
const reqPromise1 = waitForReplayRequest(page, 1);
const url = await getLocalTestUrl({ testDir: __dirname });
await page.goto(url);
const replayEvent0 = getReplayEvent(await reqPromise0);
await page.locator('button').click();
const replayEvent1 = getReplayEvent(await reqPromise1);
expect(replayEvent0).toBeDefined();
expect(replayEvent0).toEqual(
getExpectedReplayEvent({
segment_id: 0,
}),
);
expect(replayEvent1).toBeDefined();
expect(replayEvent1).toEqual(
getExpectedReplayEvent({
segment_id: 1,
urls: [],
}),
);
});