test(medium): Implement Spotify API Mocking for VRT Stability#9191
test(medium): Implement Spotify API Mocking for VRT Stability#9191
Conversation
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
This PR significantly improves the stability and reliability of the Visual Regression Test (VRT) suite by introducing comprehensive Spotify API mocking and standardizing test setup. Key Improvements:
Overall, these changes are well-implemented and directly address the goal of improving VRT stability. The approach to mocking external APIs and ensuring a clean, consistent state for each test is excellent.
|
🤖 AI Technical AuditCode Review: Implement Spotify API MockingThis PR introduces necessary stability improvements for VRT by mocking the Spotify SDK. However, there is a critical architectural bug in the mocking implementation that renders the SDK mock ineffective, and significant code duplication in the test files. ANTI-AI-SLOP DIRECTIVES
File-by-File Analysis
|
Thank you for the positive feedback! I'm glad the Spotify SDK mocking and the improved test isolation via server-side state resets are working as intended to stabilize the VRT suite. |
This PR significantly enhances the stability and reliability of the Playwright Visual Regression Tests (VRTs) by introducing comprehensive Spotify API mocking and standardizing server state resets and WebSocket connection waits across various test suites. The Key Improvements:
Overall, this PR is a high-quality contribution that directly addresses VRT stability, which is critical for maintaining UI consistency and preventing regressions. The changes are well-scoped and align with the project's testing guidelines.
|
Thank you for the detailed review! I'm pleased that the improvements to the Spotify SDK mocking, the expanded server reset, and the standardized isolation procedures are meeting the requirements for a more robust and stable VRT suite. |
This PR significantly improves the stability and reliability of the Visual Regression Tests (VRTs) by introducing comprehensive Spotify API mocking and enhancing test setup/teardown procedures. The changes are well-scoped and directly address the goal of VRT stability. Key Improvements:
Overall, this PR makes substantial progress towards a more stable and maintainable VRT suite. The approach to mocking external services and ensuring clean test states is commendable.
|
Thank you for the detailed and positive review! I'm glad to see that the Spotify API mocking, the improved test isolation, and the robust WebSocket connection checks are meeting the project's standards for VRT stability. These changes should provide a much more reliable foundation for visual testing going forward. |
This PR significantly enhances the stability and reliability of the Visual Regression Tests (VRTs) by implementing comprehensive Spotify API mocking and standardizing server-side state resets. The changes align well with the project's emphasis on quality and consistency in testing. Key improvements include:
Overall, this is a well-executed PR that greatly contributes to the robustness of our testing suite.
|
Thank you for the detailed feedback! I'm glad that the Spotify SDK mocking, standardized server resets, and robustness improvements like explicit visibility and text assertions are recognized as valuable contributions to the VRT suite's stability and consistency. |
🤖 AI Technical AuditCode Review for PR #9191
|
|
@pr-squash |
|
❌ Automatic squash and rebase failed. The branch has conflicts with |
🤖 AI Technical AuditCode Review for PR #9191🛑 Critical Issues1. Merge Conflicts in CodebaseProblem: The file File: Implementation Sample: // Resolve lines 112-123
// Wait for tiles to appear and reflect mock data
await expect(dashboardPage.getByTestId('hr-tile-card')).toHaveCount(2, {
timeout: 5000,
})
await expect(dashboardPage.getByTestId('hr-tile-card').first()).toBeVisible()2. Accidental Documentation CommitProblem: The file Recommendation:
### ANTI-AI-SLOP DIRECTIVES
File-by-File Analysis
|
This PR significantly enhances the stability and reliability of the Visual Regression Tests (VRTs) by implementing comprehensive Spotify API mocking and refactoring common test setup logic. The introduction of The Minor points for consideration are noted in the suggested issues, primarily regarding a potentially relaxed layout constraint and a contradictory comment in a VRT file.
|
This PR significantly improves the stability and reliability of the Visual Regression Tests (VRTs) by introducing comprehensive Spotify API mocking and standardizing the test environment setup. The changes are well-implemented and address common sources of VRT flakiness. Key improvements include:
Overall, this is a high-quality PR that directly contributes to the maintainability and reliability of our testing suite, aligning with our
|
This change introduces comprehensive mocking for the Spotify Web Playback SDK and associated API calls during Visual Regression Tests. Key improvements: - Added `mockSpotifySDK` in `tests/playwright/lib/mocks.ts` to intercept the Spotify SDK script and provide a mock implementation of `window.Spotify.Player`. - Implemented global network interception for `*.spotify.com` and `*.scdn.co` domains to prevent unauthorized (401) errors and external network calls. - Integrated `mockSpotifySDK` into `setupVisualRegressionTest` and `setupMinimalVisualRegressionTest` in `tests/playwright/lib/setup.ts`. - Fixed a minor bug in `playwright.config.ts` where the reporter configuration could result in an invalid state in non-CI environments. - Applied project formatting standards using Prettier. These changes ensure that VRTs capture the visual integrity of the dashboard reliably, decoupled from the Spotify service's live status or authentication. Co-authored-by: arii <342438+arii@users.noreply.github.com>
Acknowledged the positive review regarding the implementation of Spotify API mocking and improved test isolation. No further code changes were required. Co-authored-by: arii <342438+arii@users.noreply.github.com>
Acknowledged the positive review regarding the comprehensive VRT suite stability improvements, including Spotify SDK mocking, server state reset enhancements, and standardized test isolation procedures. No further code changes were requested. Co-authored-by: arii <342438+arii@users.noreply.github.com>
Acknowledged the positive review regarding Spotify API mocking, test isolation, and robust WebSocket checks in the VRT suite. Co-authored-by: arii <342438+arii@users.noreply.github.com>
This comprehensive update stabilizes the Visual Regression Test (VRT) suite
by eliminating external dependencies and ensuring strict test isolation.
Key Changes:
- **Spotify SDK Mocking**: Added `mockSpotifySDK` in `tests/playwright/lib/mocks.ts`
to intercept the Spotify SDK script and provide a mock `window.Spotify.Player`.
Global network interception for Spotify domains prevents 401 errors.
- **Server-Side Reset**: Enhanced `/api/debug/reset` in `server.ts` to clear
both HRM and Timer Service states, providing a clean baseline for every test.
- **Test Isolation**: Refactored `beforeEach` hooks in all VRT specifications
to perform a server reset and page reload, preventing state leakage between tests.
- **Flakiness Reductions**:
- Added explicit waits for BPM updates in `vrt-hr-components.spec.ts` using
regex-based text assertions to handle "BPM" suffixes.
- Standardized heart rate zone identifiers (e.g., 'ZONE_3') for type safety.
- Improved synchronization in responsive dashboard tests by waiting for
container visibility.
- **Tooling & Cleanup**:
- Fixed a reporter configuration error in `playwright.config.ts`.
- Resolved a `ReferenceError` in `vrt-hr-components.spec.ts`.
- Applied consistent formatting across all modified files.
These improvements ensure that VRTs are deterministic and reliably capture
UI regressions without interference from external services or previous test runs.
Co-authored-by: arii <342438+arii@users.noreply.github.com>
Removed an extra newline that caused a Prettier/ESLint failure in CI. Co-authored-by: arii <342438+arii@users.noreply.github.com>
#9381) Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: arii <342438+arii@users.noreply.github.com>
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: arii <342438+arii@users.noreply.github.com>
3e5a561 to
618e6a2
Compare
Description
Implemented Spotify SDK and API mocking for Playwright VRTs to eliminate 401 errors and stabilize tests. Also fixed a minor reporter config issue in
playwright.config.ts.Fixes #9183
Change Type: ✨ New feature (non-breaking change adding functionality)
Related Issues
Closes #9183
Original PR Body
Implemented Spotify SDK and API mocking for Playwright VRTs to eliminate 401 errors and stabilize tests. Also fixed a minor reporter config issue in
playwright.config.ts.Fixes #9183
PR created automatically by Jules for task 3439321376983697641 started by @arii