From 5a60afd2a517359f86ae5cac20d294d074e142ca Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Thu, 11 Apr 2024 10:52:15 +0200 Subject: [PATCH] test(ci): Fix failing tests (#11554) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This hopefully fixes these tests that randomly started failing 😬 debugging this on CI, I saw that the second session envelope it sent was about discarding session events because sending them failed. So ensuring we don't drop the sessions should fix this, I think. --- .../suites/sessions/initial-scope/test.ts | 8 ++++++++ .../suites/sessions/start-session/test.ts | 8 ++++++++ .../suites/sessions/v7-hub-start-session/test.ts | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/dev-packages/browser-integration-tests/suites/sessions/initial-scope/test.ts b/dev-packages/browser-integration-tests/suites/sessions/initial-scope/test.ts index b7de815b7825..8a9ba80cdbc4 100644 --- a/dev-packages/browser-integration-tests/suites/sessions/initial-scope/test.ts +++ b/dev-packages/browser-integration-tests/suites/sessions/initial-scope/test.ts @@ -25,6 +25,14 @@ sentryTest('should start a new session with navigation.', async ({ getLocalTestP const url = await getLocalTestPath({ testDir: __dirname }); await page.route('**/foo', (route: Route) => route.fulfill({ path: `${__dirname}/dist/index.html` })); + await page.route('https://dsn.ingest.sentry.io/**/*', route => { + return route.fulfill({ + status: 200, + contentType: 'application/json', + body: JSON.stringify({ id: 'test-id' }), + }); + }); + const initSession = await getFirstSentryEnvelopeRequest(page, url); await page.click('#navigate'); diff --git a/dev-packages/browser-integration-tests/suites/sessions/start-session/test.ts b/dev-packages/browser-integration-tests/suites/sessions/start-session/test.ts index 1359f90ac0e0..62c969d2e76d 100644 --- a/dev-packages/browser-integration-tests/suites/sessions/start-session/test.ts +++ b/dev-packages/browser-integration-tests/suites/sessions/start-session/test.ts @@ -24,6 +24,14 @@ sentryTest('should start a new session with navigation.', async ({ getLocalTestP const url = await getLocalTestPath({ testDir: __dirname }); await page.route('**/foo', (route: Route) => route.fulfill({ path: `${__dirname}/dist/index.html` })); + await page.route('https://dsn.ingest.sentry.io/**/*', route => { + return route.fulfill({ + status: 200, + contentType: 'application/json', + body: JSON.stringify({ id: 'test-id' }), + }); + }); + const initSession = await getFirstSentryEnvelopeRequest(page, url); await page.locator('#navigate').click(); diff --git a/dev-packages/browser-integration-tests/suites/sessions/v7-hub-start-session/test.ts b/dev-packages/browser-integration-tests/suites/sessions/v7-hub-start-session/test.ts index 1359f90ac0e0..62c969d2e76d 100644 --- a/dev-packages/browser-integration-tests/suites/sessions/v7-hub-start-session/test.ts +++ b/dev-packages/browser-integration-tests/suites/sessions/v7-hub-start-session/test.ts @@ -24,6 +24,14 @@ sentryTest('should start a new session with navigation.', async ({ getLocalTestP const url = await getLocalTestPath({ testDir: __dirname }); await page.route('**/foo', (route: Route) => route.fulfill({ path: `${__dirname}/dist/index.html` })); + await page.route('https://dsn.ingest.sentry.io/**/*', route => { + return route.fulfill({ + status: 200, + contentType: 'application/json', + body: JSON.stringify({ id: 'test-id' }), + }); + }); + const initSession = await getFirstSentryEnvelopeRequest(page, url); await page.locator('#navigate').click();