Skip to content
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

Record Playwright tests with Replay #348

Closed
wants to merge 14 commits into from
4 changes: 3 additions & 1 deletion .github/workflows/e2e-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ jobs:
- name: Build NPM package
run: pnpm prerelease
- name: Run Playwright tests
run: cd packages/react-resizable-panels-website && pnpm test:e2e
run: cd packages/react-resizable-panels-website && pnpm test:e2e --project replay-chromium
env:
REPLAY_API_KEY: ${{ secrets.REPLAY_API_KEY }}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"devDependencies": {
"@babel/preset-typescript": "^7.22.5",
"@playwright/test": "^1.37.0",
"@replayio/playwright": "3.0.0-alpha.6",
Copy link
Contributor

Choose a reason for hiding this comment

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

this could now be bumped to .7

Copy link
Owner Author

Choose a reason for hiding this comment

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

Gotcha. Just bumped the version.

Noticed that I can't run e2e tests locally though:

$ p test:e2e        

> react-resizable-panels-website@0.0.1 test:e2e /Users/bvaughn/Documents/git/oss/react-resizable-panels/packages/react-resizable-panels-website
> playwright test

[replay.io]: Failed to send test metrics
[replay.io]: Error: request to https://webhooks.replay.io/api/metrics failed, reason: socket hang up
[replay.io]: 🕑 Completing some outstanding work ...
[replay.io]: 
[replay.io]: ❌ We encountered some unexpected errors processing your recordings and was unable to upload them.
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io
[replay.io]:    - Failed to upload recording: Cannot connect to server wss://dispatch.replay.io

Maybe this is because I didn't pass the api token env var? But the error message isn't great if that's the case, and this would mean that no contributors could run these tests either.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Also the terminal was totally silent for several seconds before printing this. I'm not sure if that meant tests weren't running, or if it was just swallowing the stdout output. (That output is important to debug.)

Copy link
Contributor

Choose a reason for hiding this comment

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

So you have this error, CI reports "RecordingUploadError: Failed to set recording metadata Error: Protocol client is not initialized" and I have "RecordingUploadError: Failed to set recording metadata Protocol error 1: Internal error" locally now 😂

Well, I'm investigating all of this now ;p

"@types/jest": "^29.5.3",
"@types/node": "^18.17.5",
"@types/react": "latest",
Expand Down
16 changes: 16 additions & 0 deletions packages/react-resizable-panels-website/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
import type { PlaywrightTestConfig } from "@playwright/test";
import {
createReplayReporterConfig,
devices as replayDevices,
} from "@replayio/playwright";

const { DEBUG } = process.env;

const config: PlaywrightTestConfig = {
projects: [
{
name: "replay-chromium",
use: { ...replayDevices["Replay Chromium"] },
},
],
reporter: [
createReplayReporterConfig({
apiKey: process.env.REPLAY_API_KEY,
upload: true,
}),
],
use: {
browserName: "chromium",
headless: true,
Expand Down
Loading
Loading