From 2bb7716fac50770b1493c4075e1dd48747a213b5 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Fri, 5 Jan 2024 14:58:08 +0000 Subject: [PATCH 1/2] test(browser-integration-tests): Skip flakey test on firefox --- .../Breadcrumbs/dom/click/test.ts | 105 +++++++++--------- 1 file changed, 55 insertions(+), 50 deletions(-) diff --git a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/click/test.ts b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/click/test.ts index 93ceb1e70001..219f0e9e6d93 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/click/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/click/test.ts @@ -4,57 +4,62 @@ import type { Event } from '@sentry/types'; import { sentryTest } from '../../../../../utils/fixtures'; import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; -sentryTest('captures Breadcrumb for clicks & debounces them for a second', async ({ getLocalTestUrl, page }) => { - const url = await getLocalTestUrl({ testDir: __dirname }); - - await page.route('**/foo', route => { - return route.fulfill({ - status: 200, - body: JSON.stringify({ - userNames: ['John', 'Jane'], - }), - headers: { - 'Content-Type': 'application/json', - }, +sentryTest( + 'captures Breadcrumb for clicks & debounces them for a second', + async ({ getLocalTestUrl, page, browserName }) => { + sentryTest.skip(browserName === 'firefox', 'This consistently flakes on firefox.'); + + const url = await getLocalTestUrl({ testDir: __dirname }); + + await page.route('**/foo', route => { + return route.fulfill({ + status: 200, + body: JSON.stringify({ + userNames: ['John', 'Jane'], + }), + headers: { + 'Content-Type': 'application/json', + }, + }); }); - }); - - const promise = getFirstSentryEnvelopeRequest(page); - - await page.goto(url); - - await page.click('#button1'); - // not debounced because other target - await page.click('#button2'); - // This should be debounced - await page.click('#button2'); - - // Wait a second for the debounce to finish - await page.waitForTimeout(1000); - await page.click('#button2'); - - const [eventData] = await Promise.all([promise, page.evaluate('Sentry.captureException("test exception")')]); - - expect(eventData.exception?.values).toHaveLength(1); - - expect(eventData.breadcrumbs).toEqual([ - { - timestamp: expect.any(Number), - category: 'ui.click', - message: 'body > button#button1[type="button"]', - }, - { - timestamp: expect.any(Number), - category: 'ui.click', - message: 'body > button#button2[type="button"]', - }, - { - timestamp: expect.any(Number), - category: 'ui.click', - message: 'body > button#button2[type="button"]', - }, - ]); -}); + + const promise = getFirstSentryEnvelopeRequest(page); + + await page.goto(url); + + await page.click('#button1'); + // not debounced because other target + await page.click('#button2'); + // This should be debounced + await page.click('#button2'); + + // Wait a second for the debounce to finish + await page.waitForTimeout(1000); + await page.click('#button2'); + + const [eventData] = await Promise.all([promise, page.evaluate('Sentry.captureException("test exception")')]); + + expect(eventData.exception?.values).toHaveLength(1); + + expect(eventData.breadcrumbs).toEqual([ + { + timestamp: expect.any(Number), + category: 'ui.click', + message: 'body > button#button1[type="button"]', + }, + { + timestamp: expect.any(Number), + category: 'ui.click', + message: 'body > button#button2[type="button"]', + }, + { + timestamp: expect.any(Number), + category: 'ui.click', + message: 'body > button#button2[type="button"]', + }, + ]); + }, +); sentryTest( 'uses the annotated component name in the breadcrumb messages and adds it to the data object', From 100fa9b367b1ae982d1c351d441c2e31a1056c45 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Fri, 5 Jan 2024 15:11:54 +0000 Subject: [PATCH 2/2] chrome not ff --- .../suites/integrations/Breadcrumbs/dom/click/test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/click/test.ts b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/click/test.ts index 219f0e9e6d93..37ac97c633ca 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/click/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/Breadcrumbs/dom/click/test.ts @@ -7,7 +7,7 @@ import { getFirstSentryEnvelopeRequest } from '../../../../../utils/helpers'; sentryTest( 'captures Breadcrumb for clicks & debounces them for a second', async ({ getLocalTestUrl, page, browserName }) => { - sentryTest.skip(browserName === 'firefox', 'This consistently flakes on firefox.'); + sentryTest.skip(browserName === 'chromium', 'This consistently flakes on chrome.'); const url = await getLocalTestUrl({ testDir: __dirname });