Skip to content

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

Merged
merged 15 commits into from
Jan 18, 2023

Conversation

onurtemizkan
Copy link
Collaborator

@onurtemizkan onurtemizkan commented Jan 10, 2023

Ref: #6053

This PR migrates NextJS client-side integration tests from Puppeteer to Playwright, removing the dependency on the puppeteer package.

  • All current client-side tests are rewritten in Playwright.
  • countEnvelopes function is implemented in our integration-test utilities which gets the number of total envelopes sent in a certain timescale in browser.
  • Getting envelopes by their type is implemented in our integration-test utilities. The default behaviour hasn't changed.

Will be addressed in other PRs

  • Migration of the server-side tests to our node-integration-tests utilities.
  • Migration of test runners from shell script to TS.
  • Running tests on Windows.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 10, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.82 KB (0%)
@sentry/browser - ES5 CDN Bundle (minified) 61.47 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.5 KB (+0.02% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 54.77 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 20.22 KB (0%)
@sentry/browser - Webpack (minified) 66.17 KB (0%)
@sentry/react - Webpack (gzipped + minified) 20.24 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 47.51 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.73 KB (-0.02% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.02 KB (+0.02% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 43.12 KB (-0.83% 🔽)
@sentry/replay - Webpack (gzipped + minified) 38.45 KB (-1% 🔽)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 60.35 KB (-0.6% 🔽)

@onurtemizkan onurtemizkan force-pushed the onur/next-new-integration-tests branch 2 times, most recently from 73e0c47 to 372d196 Compare January 10, 2023 18:57
@onurtemizkan onurtemizkan self-assigned this Jan 12, 2023
@onurtemizkan onurtemizkan force-pushed the onur/next-new-integration-tests branch from 66b1c0c to 46a0403 Compare January 13, 2023 11:50
@onurtemizkan onurtemizkan force-pushed the onur/next-new-integration-tests branch from 9a070d2 to fb72f5e Compare January 16, 2023 14:28
@onurtemizkan onurtemizkan marked this pull request as ready for review January 16, 2023 15:32
@onurtemizkan onurtemizkan force-pushed the onur/next-new-integration-tests branch 2 times, most recently from 2840a77 to d5ea798 Compare January 16, 2023 16:01
@onurtemizkan onurtemizkan force-pushed the onur/next-new-integration-tests branch from d5ea798 to 9ea25b3 Compare January 17, 2023 17:36
@AbhiPrasad AbhiPrasad requested a review from lforst January 17, 2023 17:38
@AbhiPrasad AbhiPrasad merged commit 59e51bd into master Jan 18, 2023
@AbhiPrasad AbhiPrasad deleted the onur/next-new-integration-tests branch January 18, 2023 08:41
Copy link
Contributor

@lforst lforst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, these changes seem good to me! 👍

Just saw that @AbhiPrasad merged this but I think I identified some potential flakes we should get rid of.

Comment on lines +9 to +10
page.click('button'),
getMultipleSentryEnvelopeRequests<Event>(page, 1, { envelopeType: 'event' }),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential race condition

Copy link
Member

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:

await Promise.all([page.click('#throw-error'), getFirstSentryEnvelopeRequest<SessionContext>(page)])

We can adjust this if it is causing flakes.

Comment on lines +14 to +19
await page.waitForTimeout(250);

const [, events] = await Promise.all([
page.click('a#alsoHealthy'),
getMultipleSentryEnvelopeRequests<Session>(page, 2, { envelopeType: 'session' }),
]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential race conditions

Comment on lines +37 to +40
const [, events_2] = await Promise.all([
page.click('a#healthy'),
getMultipleSentryEnvelopeRequests<Session>(page, 2, { envelopeType: 'session' }),
]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

potential race condition

Comment on lines +24 to +25
page.click('a#server-side-props-page'),
getMultipleSentryEnvelopeRequests<Transaction>(page, 1, { envelopeType: 'transaction' }),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential race condition

Comment on lines +44 to +45
page.click('a#initial-props-page'),
getMultipleSentryEnvelopeRequests<Transaction>(page, 1, { envelopeType: 'transaction' }),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential race condition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants