From 05c0613b77abf76ade24c0c73e5759c0b6088819 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Wed, 15 Mar 2023 18:49:23 -0400 Subject: [PATCH 1/2] test(browser-integration): Skip "browsertracing/backgroundtab-pageload" test for firefox This has been flakey... trace.status is sometimes undefined, lets skip for firefox --- .../tracing/browsertracing/backgroundtab-pageload/test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/browser-integration-tests/suites/tracing/browsertracing/backgroundtab-pageload/test.ts b/packages/browser-integration-tests/suites/tracing/browsertracing/backgroundtab-pageload/test.ts index f4ccf67b6c14..d512b00269d3 100644 --- a/packages/browser-integration-tests/suites/tracing/browsertracing/backgroundtab-pageload/test.ts +++ b/packages/browser-integration-tests/suites/tracing/browsertracing/backgroundtab-pageload/test.ts @@ -4,7 +4,11 @@ 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 }) => { +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 + if (['firefox'].includes(browserName)) { + sentryTest.skip(); + } const url = await getLocalTestPath({ testDir: __dirname }); await page.goto(url); From 593f3e1e7ab5df6a636ee7531faf76a86797e95c Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Wed, 15 Mar 2023 19:00:05 -0400 Subject: [PATCH 2/2] lint --- .../backgroundtab-pageload/test.ts | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/packages/browser-integration-tests/suites/tracing/browsertracing/backgroundtab-pageload/test.ts b/packages/browser-integration-tests/suites/tracing/browsertracing/backgroundtab-pageload/test.ts index d512b00269d3..af7de77b93f7 100644 --- a/packages/browser-integration-tests/suites/tracing/browsertracing/backgroundtab-pageload/test.ts +++ b/packages/browser-integration-tests/suites/tracing/browsertracing/backgroundtab-pageload/test.ts @@ -4,21 +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 ({ browserName, getLocalTestPath, page }) => { - // TODO: This is flakey on firefox... trace.status is sometimes undefined - if (['firefox'].includes(browserName)) { - sentryTest.skip(); - } - 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 + 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(page); + const pageloadTransaction = await getFirstSentryEnvelopeRequest(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', + }); + }, +);