Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.8k
test(nextjs): Migrate Next SDK's client side tests to Playwright.#6718
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
523e133667ddf5af9a2d6386f066eb34768155b29abf09a6b65b4c0b3950398494e3e08817c2f248e4f7725c8ad1e90f9a9ea25b3File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import type { PlaywrightTestConfig } from '@playwright/test'; | ||
| const config: PlaywrightTestConfig = { | ||
| retries: 2, | ||
| timeout: 12000, | ||
| use: { | ||
| baseURL: 'http://localhost:3000', | ||
| }, | ||
| workers: 3, | ||
| webServer: { | ||
| command: 'yarn test:integration:prepare', | ||
| port: 3000, | ||
| }, | ||
| }; | ||
| export default config; |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { getMultipleSentryEnvelopeRequests } from './utils/helpers'; | ||
| import { test, expect } from '@playwright/test'; | ||
| import { Event } from '@sentry/types'; | ||
| test('should capture error triggered on click', async ({ page }) => { | ||
| await page.goto('/errorClick'); | ||
| const [_, events] = await Promise.all([ | ||
| page.click('button'), | ||
| getMultipleSentryEnvelopeRequests<Event>(page, 1, { envelopeType: 'event' }), | ||
| ]); | ||
| expect(events[0].exception?.values?.[0]).toMatchObject({ | ||
| type: 'Error', | ||
| value: 'Sentry Frontend Error', | ||
| }); | ||
| }); | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import { getMultipleSentryEnvelopeRequests } from './utils/helpers'; | ||
| import { test, expect } from '@playwright/test'; | ||
| import { Event } from '@sentry/types'; | ||
| test('should capture a globally triggered event', async ({ page }) => { | ||
| const event = await getMultipleSentryEnvelopeRequests<Event>(page, 1, { url: '/crashed', envelopeType: 'event' }); | ||
| expect(event[0].exception?.values?.[0]).toMatchObject({ | ||
| type: 'Error', | ||
| value: 'Crashed', | ||
| }); | ||
| }); |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { test, expect } from '@playwright/test'; | ||
| // This test verifies that a faulty configuration of `getInitialProps` in `_app` will not cause our | ||
| // auto - wrapping / instrumentation to throw an error. | ||
| // See `_app.tsx` for more information. | ||
| test('should not fail auto-wrapping when `getInitialProps` configuration is faulty.', async ({ page }) => { | ||
| await page.goto('/faultyAppGetInitialProps'); | ||
| const serverErrorText = await page.$('//*[contains(text(), "Internal Server Error")]'); | ||
| expect(serverErrorText).toBeFalsy(); | ||
| }); |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { countEnvelopes, getMultipleSentryEnvelopeRequests } from './utils/helpers'; | ||
| import { test, expect } from '@playwright/test'; | ||
| import { Session } from '@sentry/types'; | ||
| test('should report crashed sessions', async ({ page }) => { | ||
| const event = await getMultipleSentryEnvelopeRequests<Session>(page, 2, { url: '/crashed', envelopeType: 'session' }); | ||
| expect(event[0]).toMatchObject({ | ||
| init: true, | ||
| status: 'ok', | ||
| errors: 0, | ||
| }); | ||
| expect(event[1]).toMatchObject({ | ||
| init: false, | ||
| status: 'crashed', | ||
| errors: 1, | ||
| }); | ||
| expect(await countEnvelopes(page, { url: '/crashed', envelopeType: 'session' })).toBe(2); | ||
| }); |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential race condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've done this before with no issues:
sentry-javascript/packages/integration-tests/suites/sessions/update-session/test.ts
Line 11 in 59e51bd
We can adjust this if it is causing flakes.