Skip to content

Commit 06607e3

Browse files
jarilijjk
andauthored
Add Replay integration for dev e2e tests (vercel#40955)
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change that you're making: --> ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md) @ijjk moving this here. Co-authored-by: JJ Kasper <[email protected]>
1 parent 79a85b7 commit 06607e3

File tree

13 files changed

+1269
-415
lines changed

13 files changed

+1269
-415
lines changed

.github/workflows/build_test_deploy.yml

+19-1
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,27 @@ jobs:
405405
timeout-minutes: 5
406406
if: ${{needs.build.outputs.docsChange == 'nope'}}
407407

408-
- run: NEXT_TEST_MODE=dev node run-tests.js --type e2e --timings -g ${{ matrix.group }}/3
408+
- run: npx @replayio/playwright install chromium
409+
if: ${{needs.build.outputs.docsChange == 'nope'}}
410+
411+
- run: node run-tests.js --type e2e --timings -g ${{ matrix.group }}/3
409412
name: Run test/e2e (dev)
410413
if: ${{needs.build.outputs.docsChange == 'nope'}}
414+
env:
415+
RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testDevE2E / Group ${{ matrix.group }} / Node ${{ matrix.node }}
416+
RECORD_ALL_CONTENT: 1
417+
RECORD_REPLAY: 1
418+
NEXT_TEST_MODE: dev
419+
RECORD_REPLAY_TEST_METRICS: 1
420+
RECORD_REPLAY_WEBHOOK_URL: ${{ secrets.RECORD_REPLAY_WEBHOOK_URL }}
421+
# DEBUG: pw:browser*
422+
423+
- uses: replayio/[email protected]
424+
if: always()
425+
with:
426+
api-key: rwk_iKsQnEoQwKd31WAJxgN9ARPFuAlyXlVrDH4uhYpRnti
427+
public: true
428+
filter: ${{ 'function($v) { $v.metadata.test.result = "failed" }' }}
411429

412430
- name: Upload test trace
413431
if: always()

jest.replay.config.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const nextJest = require('next/jest')
2+
3+
const createJestConfig = nextJest()
4+
5+
// Any custom config you want to pass to Jest
6+
const customJestConfig = {
7+
testMatch: ['**/*.test.js', '**/*.test.ts', '**/*.test.tsx'],
8+
setupFilesAfterEnv: ['<rootDir>/jest-setup-after-env.ts'],
9+
verbose: true,
10+
rootDir: 'test',
11+
modulePaths: ['<rootDir>/lib'],
12+
transformIgnorePatterns: ['/next[/\\\\]dist/', '/\\.next/'],
13+
testTimeout: 60000,
14+
testRunner: '@replayio/jest/runner',
15+
}
16+
17+
// createJestConfig is exported in this way to ensure that next/jest can load the Next.js config which is async
18+
module.exports = createJestConfig(customJestConfig)

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969
"@next/polyfill-module": "workspace:*",
7070
"@next/polyfill-nomodule": "workspace:*",
7171
"@next/swc": "workspace:*",
72+
"@replayio/jest": "27.5.1-alpha.4",
73+
"@replayio/playwright": "0.2.26",
7274
"@svgr/webpack": "5.5.0",
7375
"@swc/cli": "0.1.55",
7476
"@swc/core": "1.2.203",

packages/next/compiled/assert/assert.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/next/compiled/babel-packages/packages-bundle.js

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/next/compiled/util/util.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/next/compiled/watchpack/watchpack.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/next/compiled/webpack/bundle5.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)