Skip to content
Open
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
@@ -1,5 +1,6 @@
import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';
import { waitForHydration } from './waitForHydration';

test.describe('client-side errors', async () => {
test('captures error thrown on click', async ({ page }) => {
Expand All @@ -8,6 +9,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/client-error`);
await waitForHydration(page);
await page.locator('#errorBtn').click();

const error = await errorPromise;
Expand Down Expand Up @@ -35,7 +37,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/test-param/1234`);
await page.waitForFunction(() => typeof window.__SENTRY__ === 'object');
await waitForHydration(page);
await page.locator('#errorBtn').click();

const error = await errorPromise;
Expand Down Expand Up @@ -65,6 +67,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/client-error`);
await waitForHydration(page);
await page.locator('#errorBtn').click();

const error1 = await error1Promise;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';
import { waitForHydration } from './waitForHydration';

test.describe('server-side errors', async () => {
test('captures api fetch error (fetched on click)', async ({ page }) => {
Expand All @@ -8,6 +9,7 @@ test.describe('server-side errors', async () => {
});

await page.goto(`/fetch-server-error`);
await waitForHydration(page);
await page.getByText('Fetch Server API Error', { exact: true }).click();

const error = await errorPromise;
Expand Down Expand Up @@ -42,6 +44,7 @@ test.describe('server-side errors', async () => {
});

await page.goto(`/test-param/1234`);
await waitForHydration(page);
await page.getByRole('button', { name: 'Fetch Server API Error', exact: true }).click();

const error = await errorPromise;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { Page } from '@playwright/test';

type NuxtRootContainer = HTMLElement & { __vue_app__?: { $nuxt?: { isHydrating?: boolean } } };

// Server-rendered elements are clickable before Vue hydration attaches their event handlers.
export async function waitForHydration(page: Page): Promise<void> {
await page.waitForFunction(
() => (document.getElementById('__nuxt') as NuxtRootContainer | null)?.__vue_app__?.$nuxt?.isHydrating === false,
);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';
import { waitForHydration } from './waitForHydration';

test.describe('client-side errors', async () => {
test('captures error thrown on click', async ({ page }) => {
Expand All @@ -8,6 +9,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/client-error`);
await waitForHydration(page);
await page.locator('#errorBtn').click();

const error = await errorPromise;
Expand Down Expand Up @@ -35,6 +37,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/test-param/1234`);
await waitForHydration(page);
await page.locator('#errorBtn').click();

const error = await errorPromise;
Expand Down Expand Up @@ -64,6 +67,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/client-error`);
await waitForHydration(page);
await page.locator('#errorBtn').click();

const error1 = await error1Promise;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';
import { waitForHydration } from './waitForHydration';

test.describe('server-side errors', async () => {
test('captures api fetch error (fetched on click)', async ({ page }) => {
Expand All @@ -8,6 +9,7 @@ test.describe('server-side errors', async () => {
});

await page.goto(`/fetch-server-error`);
await waitForHydration(page);
await page.getByText('Fetch Server API Error', { exact: true }).click();

const error = await errorPromise;
Expand Down Expand Up @@ -42,6 +44,7 @@ test.describe('server-side errors', async () => {
});

await page.goto(`/test-param/1234`);
await waitForHydration(page);
await page.getByRole('button', { name: 'Fetch Server API Error', exact: true }).click();

const error = await errorPromise;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { Page } from '@playwright/test';

type NuxtRootContainer = HTMLElement & { __vue_app__?: { $nuxt?: { isHydrating?: boolean } } };

// Server-rendered elements are clickable before Vue hydration attaches their event handlers.
export async function waitForHydration(page: Page): Promise<void> {
await page.waitForFunction(
() => (document.getElementById('__nuxt') as NuxtRootContainer | null)?.__vue_app__?.$nuxt?.isHydrating === false,
);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';
import { waitForHydration } from './waitForHydration';

test.describe('client-side errors', async () => {
test('captures error thrown on click', async ({ page }) => {
Expand All @@ -8,6 +9,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/client-error`);
await waitForHydration(page);
await page.locator('#errorBtn').click();

const error = await errorPromise;
Expand Down Expand Up @@ -35,6 +37,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/test-param/1234`);
await waitForHydration(page);
await page.locator('#errorBtn').click();

const error = await errorPromise;
Expand Down Expand Up @@ -64,6 +67,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/client-error`);
await waitForHydration(page);
await page.locator('#errorBtn').click();

const error1 = await error1Promise;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect, test } from '@playwright/test';
import { getSpanOp, waitForError, waitForStreamedSpan } from '@sentry-internal/test-utils';
import { waitForHydration } from './waitForHydration';

test.describe('server-side errors', async () => {
test('captures api fetch error (fetched on click)', async ({ page }) => {
Expand All @@ -18,6 +19,7 @@ test.describe('server-side errors', async () => {
});

await page.goto(`/fetch-server-error`);
await waitForHydration(page);
await page.getByText('Fetch Server API Error', { exact: true }).click();

const serverSpan = await serverSpanPromise;
Expand Down Expand Up @@ -66,6 +68,7 @@ test.describe('server-side errors', async () => {
});

await page.goto(`/fetch-server-error`);
await waitForHydration(page);
await page.getByText('Fetch Server API Error', { exact: true }).click();

await serverSpanPromise;
Expand All @@ -82,6 +85,7 @@ test.describe('server-side errors', async () => {
});

await page.goto(`/test-param/1234`);
await waitForHydration(page);
await page.getByRole('button', { name: 'Fetch Server API Error', exact: true }).click();

const error = await errorPromise;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { Page } from '@playwright/test';

type NuxtRootContainer = HTMLElement & { __vue_app__?: { $nuxt?: { isHydrating?: boolean } } };

// Server-rendered elements are clickable before Vue hydration attaches their event handlers.
export async function waitForHydration(page: Page): Promise<void> {
await page.waitForFunction(
() => (document.getElementById('__nuxt') as NuxtRootContainer | null)?.__vue_app__?.$nuxt?.isHydrating === false,
);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';
import { waitForHydration } from './waitForHydration';

test.describe('client-side errors', async () => {
test('captures error thrown on click', async ({ page }) => {
Expand All @@ -8,6 +9,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/client-error`);
await waitForHydration(page);
await page.locator('#errorBtn').click();

const error = await errorPromise;
Expand Down Expand Up @@ -35,6 +37,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/client-error`);
await waitForHydration(page);
await page.locator('#error-in-error-boundary').click();

const error = await errorPromise;
Expand Down Expand Up @@ -77,6 +80,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/test-param/1234`);
await waitForHydration(page);
await page.locator('#errorBtn').click();

const error = await errorPromise;
Expand Down Expand Up @@ -106,6 +110,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/client-error`);
await waitForHydration(page);
await page.locator('#errorBtn').click();

const error1 = await error1Promise;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';
import { waitForHydration } from './waitForHydration';

test.describe('server-side errors', async () => {
test('captures api fetch error (fetched on click)', async ({ page }) => {
Expand All @@ -8,6 +9,7 @@ test.describe('server-side errors', async () => {
});

await page.goto(`/fetch-server-error`);
await waitForHydration(page);
await page.getByText('Fetch Server API Error', { exact: true }).click();

const error = await errorPromise;
Expand Down Expand Up @@ -42,6 +44,7 @@ test.describe('server-side errors', async () => {
});

await page.goto(`/test-param/1234`);
await waitForHydration(page);
await page.getByRole('button', { name: 'Fetch Server API Error', exact: true }).click();

const error = await errorPromise;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { Page } from '@playwright/test';

type NuxtRootContainer = HTMLElement & { __vue_app__?: { $nuxt?: { isHydrating?: boolean } } };

// Server-rendered elements are clickable before Vue hydration attaches their event handlers.
export async function waitForHydration(page: Page): Promise<void> {
await page.waitForFunction(
() => (document.getElementById('__nuxt') as NuxtRootContainer | null)?.__vue_app__?.$nuxt?.isHydrating === false,
);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';
import { waitForHydration } from './waitForHydration';

test.describe('client-side errors', async () => {
test('captures error thrown on click', async ({ page }) => {
Expand All @@ -8,6 +9,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/client-error`);
await waitForHydration(page);
await page.locator('#errorBtn').click();

const error = await errorPromise;
Expand Down Expand Up @@ -35,6 +37,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/client-error`);
await waitForHydration(page);
await page.locator('#error-in-error-boundary').click();

const error = await errorPromise;
Expand Down Expand Up @@ -77,6 +80,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/test-param/1234`);
await waitForHydration(page);
await page.locator('#errorBtn').click();

const error = await errorPromise;
Expand Down Expand Up @@ -106,6 +110,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/client-error`);
await waitForHydration(page);
await page.locator('#errorBtn').click();

const error1 = await error1Promise;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';
import { waitForHydration } from './waitForHydration';

test.describe('server-side errors', async () => {
test('captures api fetch error (fetched on click)', async ({ page }) => {
Expand All @@ -8,6 +9,7 @@ test.describe('server-side errors', async () => {
});

await page.goto(`/fetch-server-routes`);
await waitForHydration(page);
await page.getByText('Fetch Server API Error', { exact: true }).click();

const error = await errorPromise;
Expand Down Expand Up @@ -42,6 +44,7 @@ test.describe('server-side errors', async () => {
});

await page.goto(`/test-param/1234`);
await waitForHydration(page);
await page.getByRole('button', { name: 'Fetch Server API Error', exact: true }).click();

const error = await errorPromise;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { Page } from '@playwright/test';

type NuxtRootContainer = HTMLElement & { __vue_app__?: { $nuxt?: { isHydrating?: boolean } } };

// Server-rendered elements are clickable before Vue hydration attaches their event handlers.
export async function waitForHydration(page: Page): Promise<void> {
await page.waitForFunction(
() => (document.getElementById('__nuxt') as NuxtRootContainer | null)?.__vue_app__?.$nuxt?.isHydrating === false,
);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect, test } from '@playwright/test';
import { waitForError } from '@sentry-internal/test-utils';
import { waitForHydration } from './waitForHydration';

test.describe('client-side errors', async () => {
test('captures error thrown on click', async ({ page }) => {
Expand All @@ -8,6 +9,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/client-error`);
await waitForHydration(page);
await page.locator('#errorBtn').click();

const error = await errorPromise;
Expand Down Expand Up @@ -35,6 +37,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/client-error`);
await waitForHydration(page);
await page.locator('#error-in-error-boundary').click();

const error = await errorPromise;
Expand Down Expand Up @@ -77,6 +80,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/test-param/1234`);
await waitForHydration(page);
await page.locator('#errorBtn').click();

const error = await errorPromise;
Expand Down Expand Up @@ -106,6 +110,7 @@ test.describe('client-side errors', async () => {
});

await page.goto(`/client-error`);
await waitForHydration(page);
await page.locator('#errorBtn').click();

const error1 = await error1Promise;
Expand Down
Loading
Loading