-
Notifications
You must be signed in to change notification settings - Fork 143
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
♻️ use playwright for e2e #3159
base: main
Are you sure you want to change the base?
Conversation
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
2d0d0e3
to
ba625db
Compare
1dd0038
to
8dfc67f
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3159 +/- ##
==========================================
- Coverage 93.61% 93.56% -0.05%
==========================================
Files 291 291
Lines 7691 7694 +3
Branches 1751 1754 +3
==========================================
- Hits 7200 7199 -1
- Misses 491 495 +4 ☔ View full report in Codecov by Sentry. |
dc360fb
to
faf30a2
Compare
894fb1b
to
959889f
Compare
Playwright can show network request in traces if needed
abee53e
to
602e7f2
Compare
602e7f2
to
7a042c0
Compare
c1a8d23
to
07fc44b
Compare
3c4673f
to
2df1d26
Compare
test/e2e/lib/framework/createTest.ts
Outdated
function tearDownPassedTest({ intakeRegistry, withBrowserLogs }: TestContext) { | ||
expect(intakeRegistry.telemetryErrorEvents).toHaveLength(0) | ||
validateRumFormat(intakeRegistry.rumEvents) | ||
await withBrowserLogs((logs) => { | ||
logs.forEach((browserLog) => { | ||
log(`Browser ${browserLog.source}: ${browserLog.level} ${browserLog.message}`) | ||
}) | ||
expect(logs.filter((l) => (l as any).level === 'SEVERE')).toEqual([]) | ||
withBrowserLogs((logs) => { | ||
expect(logs.filter((log) => log.level === 'error')).toHaveLength(0) | ||
}) | ||
} | ||
|
||
async function tearDownTest({ flushEvents, deleteAllCookies }: TestContext) { | ||
await flushEvents() | ||
await deleteAllCookies() | ||
} |
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.
Split tearDownTest
and tearDownPassedTest
so that when a test fails no more expect
than the one failing is executed. This is because if the log shows only the last failing expect, hence if the teardown expect fails, it will show only this log which make debugging failing test difficult.
This reverts commit 342e334.
test/e2e/lib/helpers/browser.ts
Outdated
test.info().annotations.push({ | ||
type: 'dd_tags[test.fixme]', | ||
description: 'Unnexpected Console log message: "Ignoring unsupported entryTypes: *"', | ||
}) |
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.
This add the property @test.fixme
in CI visibility, this is very useful to create dashboards
Motivation
Improve reliability and speed of our e2e tests.
Changes
We now uses Playwright as a e2e test runner. There is small changes to the API but things remains very similar.
Speed 🚀
(*) BrowserStack timing does not account for the time spend waiting for BS resources.
(**): Temporary estimation
Playwright already allow e2e to be faster, however there is a few other optimizations:
unit-bs
ande2e-bs
jobs run as soon asunit
ande2e
jobs are finished respectively. This is so we don't wait for the slowertest-performance
job.e2e-bs
job will retry each test up to two time to be more resilient for flakiness, however, the job will stop as soon as a single test fails in order to free up browserstack resources.new useful commands:
yarn test:e2e --ui
run playwright locally in UI modeyarn test:e2e test/e2e/scenario/rum/init.scenario.ts
to run one test fileyarn test:e2e recorder
to run all test files that haverecorder
in the nameyarn test:e2e -g unhandled rejections
to grep tests by nameyarn test:e2e --debug
to playwright in debug modeyarn test:e2e --project firefox
to run tests in firefox. available projects:chromium
(default),firefox
,webkit
,android
, and*
(all)yarn test:e2e --repeat-each 3
to run each test 3 times, useful for catching flaky testsBS_USERNAME=johdoe_abcD BS_ACCESS_KEY=askldjhfn yarn test:e2e:bs
to run the tests in BrowserstackImportant
yarn test:e2e
does not build the SDK automatically, runyarn build:bundle
if you have made change to the source code of the SDK.new useful method:
expect([1, 2, 3]).toHaveLength(3)
, will show a better error message when failing, including the actual array content.await page.pause()
to use with--debug
Testing
Locally, run
yarn test:e2e --ui
I have gone over the contributing documentation.