Skip to content

Commit

Permalink
Add Replay integration for dev e2e tests (#40955)
Browse files Browse the repository at this point in the history
<!--
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 <jj@jjsweb.site>
  • Loading branch information
jaril and ijjk committed Sep 29, 2022
1 parent 79a85b7 commit 06607e3
Show file tree
Hide file tree
Showing 13 changed files with 1,269 additions and 415 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/build_test_deploy.yml
Expand Up @@ -405,9 +405,27 @@ jobs:
timeout-minutes: 5
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: NEXT_TEST_MODE=dev node run-tests.js --type e2e --timings -g ${{ matrix.group }}/3
- run: npx @replayio/playwright install chromium
if: ${{needs.build.outputs.docsChange == 'nope'}}

- run: node run-tests.js --type e2e --timings -g ${{ matrix.group }}/3
name: Run test/e2e (dev)
if: ${{needs.build.outputs.docsChange == 'nope'}}
env:
RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testDevE2E / Group ${{ matrix.group }} / Node ${{ matrix.node }}
RECORD_ALL_CONTENT: 1
RECORD_REPLAY: 1
NEXT_TEST_MODE: dev
RECORD_REPLAY_TEST_METRICS: 1
RECORD_REPLAY_WEBHOOK_URL: ${{ secrets.RECORD_REPLAY_WEBHOOK_URL }}
# DEBUG: pw:browser*

- uses: replayio/action-upload@v0.4.5
if: always()
with:
api-key: rwk_iKsQnEoQwKd31WAJxgN9ARPFuAlyXlVrDH4uhYpRnti
public: true
filter: ${{ 'function($v) { $v.metadata.test.result = "failed" }' }}

- name: Upload test trace
if: always()
Expand Down
18 changes: 18 additions & 0 deletions jest.replay.config.js
@@ -0,0 +1,18 @@
const nextJest = require('next/jest')

const createJestConfig = nextJest()

// Any custom config you want to pass to Jest
const customJestConfig = {
testMatch: ['**/*.test.js', '**/*.test.ts', '**/*.test.tsx'],
setupFilesAfterEnv: ['<rootDir>/jest-setup-after-env.ts'],
verbose: true,
rootDir: 'test',
modulePaths: ['<rootDir>/lib'],
transformIgnorePatterns: ['/next[/\\\\]dist/', '/\\.next/'],
testTimeout: 60000,
testRunner: '@replayio/jest/runner',
}

// createJestConfig is exported in this way to ensure that next/jest can load the Next.js config which is async
module.exports = createJestConfig(customJestConfig)
2 changes: 2 additions & 0 deletions package.json
Expand Up @@ -69,6 +69,8 @@
"@next/polyfill-module": "workspace:*",
"@next/polyfill-nomodule": "workspace:*",
"@next/swc": "workspace:*",
"@replayio/jest": "27.5.1-alpha.4",
"@replayio/playwright": "0.2.26",
"@svgr/webpack": "5.5.0",
"@swc/cli": "0.1.55",
"@swc/core": "1.2.203",
Expand Down
2 changes: 1 addition & 1 deletion packages/next/compiled/assert/assert.js

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions packages/next/compiled/babel-packages/packages-bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/next/compiled/util/util.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/next/compiled/watchpack/watchpack.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/next/compiled/webpack/bundle5.js

Large diffs are not rendered by default.

0 comments on commit 06607e3

Please sign in to comment.