chore: Run automated tests on example pages#1285
Conversation
|
@spuppo-mux is attempting to deploy a commit to the Mux Team on Vercel. A member of the Team first needs to authorize it. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
## Description This PR addresses specific edge cases in `media-controller` that were not covered in previous updates. The goal is to handle a few remaining cleanup tasks and state ownership issues identified after muxinc#1261. ### Changes: * **Shortcut Dialog Cleanup:** Fixed an issue where the shortcuts dialog was not being removed from the DOM/state on teardown. * **MediaStore stateOwners:** Added logic to ensure `stateOwners` are cleared from the `mediaStore` when the controller is disconnected. * **media-time-range Animation:** Added an explicit stop call to the animation in `disconnectedCallback()` instead of using `toggleRangeAnimation()`. > **Note:** This was added to force the stop on disconnect, but I'd appreciate a second look to see if this is actually redundant or necessary. ## Related Issues Relates to [Issue muxinc#1235](muxinc/elements#1235) Follow-up to [PR muxinc#1261](muxinc#1261) ## Testing Instructions 1. **General Regression:** Can be verified using the same environment/steps as PR muxinc#1261. 2. **Full Flow:** To test the integration from `mux-player-react`, see the example in [PR muxinc#1285](muxinc/elements#1285). 3. **Specific Scenarios:** * Trigger the shortcuts dialog and verify it's destroyed when the player/controller is unmounted. * Check that `stateOwners` are no longer present in `mediaStore` after disposal. * Confirm `media-time-range` animations cease correctly upon component disconnection. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Moderate risk because it changes `media-controller` connect/disconnect behavior and MediaStore state-owner updates, which can affect fullscreen handling and event propagation across the component tree. > > **Overview** > Reduces teardown-related memory leaks by **explicitly clearing DOM state ownership** when `media-controller` disconnects (dispatching `fullscreenelementchangerequest`/`documentelementchangerequest` with `undefined`) and by ensuring the current `fullscreenElement` is set on connect. > > Improves cleanup paths by removing the keyboard shortcuts dialog from the DOM on controller teardown, stopping `media-time-range`’s `RangeAnimation` directly on disconnect, and resetting internal pending/DOM references (`#isResizePending` in `media-container`, focus/invoker refs in `media-chrome-menu`). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 0f93c20. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1285 +/- ##
==========================================
- Coverage 78.55% 73.56% -4.99%
==========================================
Files 59 56 -3
Lines 11080 13889 +2809
Branches 0 783 +783
==========================================
+ Hits 8704 10218 +1514
- Misses 2376 3638 +1262
- Partials 0 33 +33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
* Initial smoke testing, custom element are defined. * mux-video example was missing menu index import * Added test retries and timeout to account for possible flakiness
* Extracted logic into helper functions * Added interaction tests
* Feature specific and playback specs * Added parallel mode to run tests faster (as per playwright recommendation) * Excluded JWPlayer from playback tests * Changed continue into skip to add visibility * Changed JWPlayer src to a working asset. * Added option to run this suite conditionally
* Moved test:examples into it's own job * Added names to differentiate test jobs
* Added React Web Server configurations * Changed media-chrome dependency from link to file on vite react example and deduped react dependencies to fix broken example * Added expected hydration error for nextjs app * Moved port definition into constants module
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9108a6c. Configure here.

Overview
Closes #1111 - This is the epic branch for this work.
Adds an automated Playwright-based test suite that runs against the example pages (both vanilla and React) on every PR, so regressions in example wiring, component registration, and feature integration are caught in CI.
What's included
The work was split across several sub-PRs merged into this epic branch:
FEATURE_TESTS=true npm run test:examplesOther changes
<mux-video>exampleNote
Medium Risk
Adds a new Playwright-based CI job that boots multiple dev servers and runs end-to-end checks across many example pages, which can introduce flakiness and lengthen pipelines. Also updates example dependencies and Node typings, which could affect build/test environments.
Overview
Adds automated Playwright coverage for the repo’s example pages and wires it into CI.
CI/CD now runs
test:unit:allfor unit tests, and CI gains a newtest-examplesjob that builds the package, installs example app deps (Vite + Next), starts three web servers, and runsnpm run test:examplesbefore canary release.Introduces a new Playwright test suite under
test/examples/**(smoke, playback, and feature-focused interaction checks), plus shared helpers (HTML discovery + synthetic media streams) and a Playwright config/port setup. Updates a couple of example assets/imports (JWPlayer URL,mux-videomenu import) and adjusts the Vite React example to use real React deps + Vitededupe, along with bumping@types/node.Reviewed by Cursor Bugbot for commit 19cf102. Bugbot is set up for automated code reviews on this repo. Configure here.