Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,24 @@ import type { 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 });
sentryTest(
'should finish pageload transaction when the page goes background',
async ({ browserName, getLocalTestPath, page }) => {
// TODO: This is flakey on firefox... trace.status is sometimes undefined
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't even need the TODO here. IMO it's unlikely that we'll fix this any time soon.

if (['firefox'].includes(browserName)) {
sentryTest.skip();
}
const url = await getLocalTestPath({ testDir: __dirname });

await page.goto(url);
await page.click('#go-background');
await page.goto(url);
await page.click('#go-background');

const pageloadTransaction = await getFirstSentryEnvelopeRequest<Event>(page);
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',
});
});
expect(pageloadTransaction.contexts?.trace?.op).toBe('pageload');
expect(pageloadTransaction.contexts?.trace?.status).toBe('cancelled');
expect(pageloadTransaction.contexts?.trace?.tags).toMatchObject({
visibilitychange: 'document.hidden',
});
},
);