Skip to content

test(sveltekit): Unflake SvelteKit fetch proxy E2E test #15311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
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,12 +4,10 @@ test.describe('SDK-internal behavior', () => {
test('Injects fetch proxy script for SvelteKit<2.16.0', async ({ page }) => {
await page.goto('/');

const sentryCarrier = await page.evaluate('typeof window.__SENTRY__');
// @ts-expect-error this is defined
await page.waitForFunction(() => typeof window.__SENTRY__ === 'object');
const proxyHandle = await page.evaluate('typeof window._sentryFetchProxy');

// sanity check
expect(sentryCarrier).toBe('object');

// fetch proxy script ran
expect(proxyHandle).toBe('function');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { waitForInitialPageload } from './utils';
test.describe('SDK-internal behavior', () => {
test("Doesn't inject fetch proxy script for SvelteKit>=2.16.0", async ({ page }) => {
await waitForInitialPageload(page, { route: '/' });
const sentryCarrier = await page.evaluate('typeof window.__SENTRY__');
const proxyHandle = await page.evaluate('typeof window._sentryFetchProxy');

// sanity check
expect(sentryCarrier).toBe('object');
// @ts-expect-error this is defined
await page.waitForFunction(() => typeof window.__SENTRY__ === 'object');

const proxyHandle = await page.evaluate('typeof window._sentryFetchProxy');

// fetch proxy script didn't run
expect(proxyHandle).toBe('undefined');
Expand Down
Loading