-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[draft] Experiment: unfreeze PR #1637 tests #1762
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
base: master
Are you sure you want to change the base?
Conversation
Without this change, build would fail because the produced stylesheet assumes the `package.json['name']` i.e., `styles/rrweb.css`. To maintain the existing behavior, these changes are required. See https://vite.dev/guide/migration.html#customize-css-output-file-name-in-library-mode
Update playwright dependency to latest version and refactor test execution options to use a shared configuration with increased timeout for stability.
Update playwright dependency to latest version and refactor test execution options to use a shared configuration with increased timeout for stability.
🦋 Changeset detectedLatest commit: 4deec4a The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…cess Add detailed console.log statements throughout the transformToVideo function to track execution flow and debug potential issues. Logging covers browser launch, context creation, page navigation, replay progress, and video file operations.
…bility - Add Playwright Chromium installation step to CI workflow - Change test execution stdio from 'pipe' to 'inherit' for better debugging
…t listeners Set autoPlay to false in replayer configuration and manually call play() after all event listeners are attached. This ensures event handlers are properly registered before playback begins, preventing potential race conditions. Also refactor test execution options to separate stdio configuration from timeout settings for better control over test output visibility.
Add comprehensive error handling to prevent hanging during video transformation: - Add 2-minute timeout for replay finish event - Add console and error listeners for better debugging - Improve promise chain with proper error catching - Clear timeout on successful completion or error This prevents the process from hanging indefinitely when the replay finish event never fires.
Wrap replayer initialization in try-catch block to handle potential errors gracefully. Restructure Player instantiation to use rrwebPlayer directly instead of rrwebPlayer.Player, and move width/height into props object for correct API usage. On error, log to console and trigger onReplayFinish callback to prevent hanging state.
| Object.assign(config, options); | ||
| if (config.resolutionRatio > 1) config.resolutionRatio = 1; // The max value is 1. | ||
|
|
||
| console.log('[DEBUG] Starting transformToVideo'); |
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.
| console.log('[DEBUG] Starting transformToVideo'); |
| const outputPath = path.isAbsolute(config.output) | ||
| ? config.output | ||
| : path.resolve(process.cwd(), config.output); | ||
| console.log('[DEBUG] Reading events from:', eventsPath); |
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.
| console.log('[DEBUG] Reading events from:', eventsPath); |
|
|
||
| // Make the browser viewport fit the player size. | ||
| const maxViewport = getMaxViewport(events); | ||
| console.log('[DEBUG] Max viewport:', maxViewport); |
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.
| console.log('[DEBUG] Max viewport:', maxViewport); |
| ), | ||
| }; | ||
| Object.assign(config.rrwebPlayer, scaledViewport); | ||
| console.log('[DEBUG] Launching browser with headless:', config.headless); |
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.
| console.log('[DEBUG] Launching browser with headless:', config.headless); |
| console.log('[DEBUG] Browser launched successfully'); | ||
| console.log( | ||
| '[DEBUG] Creating browser context with viewport:', | ||
| scaledViewport, | ||
| ); |
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.
| console.log('[DEBUG] Browser launched successfully'); | |
| console.log( | |
| '[DEBUG] Creating browser context with viewport:', | |
| scaledViewport, | |
| ); |
| .finally(() => void cleanFiles(videoPath)), | ||
| browser.close(), | ||
| ]); | ||
| console.log('[DEBUG] Video transformation complete'); |
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.
| console.log('[DEBUG] Video transformation complete'); |
| }); | ||
| console.log('[DEBUG] Getting video path'); | ||
| const videoPath = (await page.video()?.path()) || ''; | ||
| console.log('[DEBUG] Video path:', videoPath); |
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.
| console.log('[DEBUG] Video path:', videoPath); |
| reject(err); | ||
| }); | ||
| }); | ||
| console.log('[DEBUG] Getting video path'); |
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.
| console.log('[DEBUG] Getting video path'); |
| .exposeFunction('onReplayFinish', () => resolve()) | ||
| .then(() => page.setContent(getHtml(events, config))), | ||
| ); | ||
| console.log('[DEBUG] Starting replay'); |
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.
| console.log('[DEBUG] Starting replay'); |
| const timeout = setTimeout(() => { | ||
| console.error('[DEBUG] Replay timeout - finish event never fired'); | ||
| reject(new Error('Replay timeout')); | ||
| }, 120000); // 2 minute timeout |
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.
@copilot this timeout does not care about the duration of the events, and also doesn't care about their playback speed. Please calculate the duration of the events using their min/max timestamp multiplied by the playback speed + 2 minute buffer
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.
Pull request overview
This PR upgrades major dependencies (Vite 5.x → 6.0.1, Playwright 1.32.1 → 1.56.1, esbuild 0.21.5 → 0.24.2) across the entire monorepo and fixes critical issues in the rrvideo package to unfreeze tests from PR #1637. The changes focus on resolving playback stalls in rrvideo by refactoring how rrweb-player is initialized, adding comprehensive error handling and debug logging, and ensuring Playwright browsers are properly installed in CI.
- Major dependency upgrades across all packages (Vite, Playwright, esbuild)
- Fixed rrvideo playback issues with improved player initialization and error handling
- Added debug logging and timeout handling for better troubleshooting
Reviewed changes
Copilot reviewed 26 out of 27 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| yarn.lock | Updated lockfile with new versions of esbuild (0.24.2), playwright (1.56.1), vite (6.0.11), and related dependencies including new optional platform dependencies |
| vite.config.default.ts | Added cssFileName configuration and removed commented rollup options |
| packages/*/package.json (18 files) | Updated vite dependency to ^6.0.1 across all packages; updated playwright to ^1.56.1 in rrvideo |
| packages/rrweb/package.json | Added new CSS export path "./dist/rrweb.css" |
| packages/rrvideo/src/index.ts | Refactored replayer initialization from Player class to direct constructor, added try-catch error handling, manual play() call, extensive debug logging, timeout mechanism, and console/error listeners |
| packages/rrvideo/test/cli.test.ts | Added timeout configuration (60s) and changed stdio from 'pipe' to 'inherit' for better debugging |
| .github/workflows/ci-cd.yml | Added step to install Playwright chromium browser before running tests |
| .changeset/*.md | Added changesets documenting patches for rrvideo improvements and dropping base64 inlined workers |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }); | ||
| window.replayer.addEventListener('finish', () => window.onReplayFinish()); | ||
| window.replayer.addEventListener('ui-update-progress', (payload)=> window.onReplayProgressUpdate(payload)); | ||
| window.replayer.addEventListener('resize',()=>document.querySelector('.replayer-wrapper').style.transform = 'scale(${ |
Copilot
AI
Jan 2, 2026
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.
Missing space after "resize',()=>" which violates standard JavaScript formatting conventions. This should be "resize', () =>" for consistency and readability.
| window.replayer.addEventListener('resize',()=>document.querySelector('.replayer-wrapper').style.transform = 'scale(${ | |
| window.replayer.addEventListener('resize', () => document.querySelector('.replayer-wrapper').style.transform = 'scale(${ |
| }); | ||
|
|
||
| const execOptions = { timeout: 60_000 } as const; | ||
| const execOptionsWithOutput = { ...execOptions, stdio: 'inherit' } as const; |
Copilot
AI
Jan 2, 2026
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.
The timeout is set to 60 seconds (60_000 ms), but the code also sets stdio to 'inherit' in execOptionsWithOutput. This change is good for debugging, but using 'inherit' means the test output will be mixed with the command output. Consider documenting why this was changed from 'pipe' to 'inherit', or use a conditional based on an environment variable if this is just for debugging purposes.
| const execOptionsWithOutput = { ...execOptions, stdio: 'inherit' } as const; | |
| // Use 'inherit' for easier debugging when RRVIDEO_CLI_TEST_DEBUG is set, | |
| // otherwise keep stdio as 'pipe' to avoid mixing test and CLI output. | |
| const execOptionsWithOutput = { | |
| ...execOptions, | |
| stdio: process.env.RRVIDEO_CLI_TEST_DEBUG ? 'inherit' : 'pipe', | |
| } as const; |
| build: { | ||
| // See https://vitejs.dev/guide/build.html#library-mode | ||
| lib: { | ||
| cssFileName: 'style', |
Copilot
AI
Jan 2, 2026
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.
The cssFileName property is set to 'style', but this might conflict with the existing CSS file export in packages/rrweb/package.json which exports both "./dist/rrweb.css" and "./dist/style.css". This could create ambiguity about which file is which. Consider using a more specific name or verifying that this aligns with the intended CSS output structure.
| cssFileName: 'style', | |
| cssFileName: name, |
| @@ -0,0 +1,2 @@ | |||
| --- | |||
| --- | |||
Copilot
AI
Jan 2, 2026
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 changeset file appears to be empty except for the frontmatter. An empty changeset may not be intentional and could cause issues with versioning. Either this file should be removed, or it should include a description of what changes were made and which packages are affected.
| --- | |
| --- | |
| This changeset file contains no versioning information and was created accidentally; it can be safely removed when cleaning up changesets. |
| window.replayer = new rrwebPlayer({ | ||
| target: document.body, | ||
| props: { | ||
| width: userConfig.width, | ||
| height: userConfig.height, | ||
| ...userConfig, | ||
| events, | ||
| showController: false, | ||
| autoPlay: false, | ||
| }, | ||
| }); |
Copilot
AI
Jan 2, 2026
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.
The old API used "new rrwebPlayer.Player({...})" but the new code uses "new rrwebPlayer({...})". This is a breaking change in how the player is instantiated. The "width" and "height" properties are being spread separately before userConfig, but they're already part of userConfig. This could cause the values to be overwritten if userConfig also contains width/height properties. Consider either not spreading them separately or spreading userConfig first so the explicit values take precedence.
| window.replayer.addEventListener('ui-update-progress', (payload)=> window.onReplayProgressUpdate(payload)); | ||
| window.replayer.addEventListener('resize',()=>document.querySelector('.replayer-wrapper').style.transform = 'scale(${ |
Copilot
AI
Jan 2, 2026
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.
Missing space after "payload)=>" which violates standard JavaScript formatting conventions. This should be "payload) =>" for consistency and readability.
| window.replayer.addEventListener('ui-update-progress', (payload)=> window.onReplayProgressUpdate(payload)); | |
| window.replayer.addEventListener('resize',()=>document.querySelector('.replayer-wrapper').style.transform = 'scale(${ | |
| window.replayer.addEventListener('ui-update-progress', (payload) => window.onReplayProgressUpdate(payload)); | |
| window.replayer.addEventListener('resize', () => document.querySelector('.replayer-wrapper').style.transform = 'scale(${ |
Experiment to see if I can get: #1637 to pass the tests