-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
test.ts
21 lines (15 loc) · 799 Bytes
/
test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { expect } from '@playwright/test';
import { Event } from '@sentry/types';
import { sentryTest } from '../../../../utils/fixtures';
import { getFirstSentryEnvelopeRequest } from '../../../../utils/helpers';
sentryTest('should finish pageload transaction when the page goes background', async ({ getLocalTestPath, page }) => {
const url = await getLocalTestPath({ testDir: __dirname });
await page.goto(url);
void page.click('#go-background');
const pageloadTransaction = await getFirstSentryEnvelopeRequest<Event>(page);
expect(pageloadTransaction.contexts?.trace.op).toBe('pageload');
expect(pageloadTransaction.contexts?.trace.status).toBe('cancelled');
expect(pageloadTransaction.contexts?.trace.tags).toMatchObject({
visibilitychange: 'document.hidden',
});
});