feat/cmcd-v2-request-validation#163
Conversation
Adds comprehensive E2E tests using Playwright to validate CMCD v2 payloads at the network level during real playback. Uses @svta/cml-cmcd validation functions (validateCmcd, validateCmcdHeaders, validateCmcdEvent, validateCmcdKeys) for spec-level compliance checks across query, header, and event modes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…CD v2 Replace the Playwright-based E2E test suite with Karma functional tests that use XHR interceptors to validate CMCD v2 spec compliance. This eliminates the @playwright/test dependency (~100MB) while maintaining full test coverage across all three transmission modes (query, header, event), key filtering, and version validation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CmcdRequestCollector now stores raw CMCD strings instead of pre-parsed objects, removing its dependency on @svta/cml-cmcd entirely. Tests use validation function return values (result.data) for both spec validation and data assertions in a single pass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello @littlespex, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the project's testing capabilities by adding a suite of functional tests for CMCD version 2. These tests ensure that CMCD data is correctly generated and transmitted in various modes (query, header, and event), validating adherence to the CMCD v2 specification. The changes also include necessary dependency updates and a new utility for collecting request data during tests. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive suite of functional tests for CMCD version 2, which is a great addition for ensuring the correctness of the implementation. The new tests are well-structured, covering query mode, header mode, event mode, key filtering, and versioning aspects. The introduction of CmcdRequestCollector.js to intercept and inspect XHR requests is a solid approach for this kind of testing. The code is of high quality. I have one minor suggestion to improve debuggability in the new test helper.
…ests Rewrite CmcdRequestCollector with a single requests array storing httpRequest objects compatible with CML's validateCmcdRequest(). Replace mode-specific validators (validateCmcd, validateCmcdHeaders) with the unified validateCmcdRequest() and remove the invalid validateCmcdKeys test that was passing a string to a function expecting a parsed object. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Feature MPD update on validity expiration (#68) * Revert "Feature MPD update on validity expiration (#68)" This reverts commit bf31094. * feat: implement CMCD v2 functionality * event mode with body transmission mode only * remove url encode from body transmission mode * add editable configs to cmcd sample page * add src input to cmcd v2 sample page * create provider for CMCDParameters lazy loading * chore: CMCDv2 migration to CMCD Reporter (#159) * cmcd reporter initialization * request mode migration * event mode migration * cmcd model migration * fix cmcd model unit tests * fixes for cmcd parameters and cleanup - protection controller fixes WIP * cleanup and update unit tests * refactor unit tests and fixes * fix unit tests and remove batchTimer * Cmcdv2: keys compliance check (#160) * ab, lab and tab inner list and request mode * ab, tab and lab inner list for v2 * bl inner list and event mode * br inner list and event mode * toInnerList helper * bsd inner list * mtp inner list and event mode * nor inner list * pb inner list and event mode * tp inner list and event mode * tpb inner list and event mode * fix unit tests * feat: update CML dependencies * fix race condition on cmcd contrller for cmcd parameters * Feature/cmcdv2 update (#162) * chore: update CML dependencies * fix: update common media request * fix: update resourceTiming properties to use performance.now() * fix: update cmcd data formatting * fix: remove redundant rr values * refactor: simplify cmcd reporting * fix: test mock requests missing parameters * chore: update cml cmcd version * should not send report if events are undefined * fix unit tests --------- Co-authored-by: cotid-qualabs <constanzad@qualabs.com> * feat/cmcd-v2-request-validation (#163) * feat: add CMCD v2 Playwright E2E tests with spec validation Adds comprehensive E2E tests using Playwright to validate CMCD v2 payloads at the network level during real playback. Uses @svta/cml-cmcd validation functions (validateCmcd, validateCmcdHeaders, validateCmcdEvent, validateCmcdKeys) for spec-level compliance checks across query, header, and event modes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: replace Playwright E2E tests with Karma functional tests for CMCD v2 Replace the Playwright-based E2E test suite with Karma functional tests that use XHR interceptors to validate CMCD v2 spec compliance. This eliminates the @playwright/test dependency (~100MB) while maintaining full test coverage across all three transmission modes (query, header, event), key filtering, and version validation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: remove double parsing from CMCD v2 tests CmcdRequestCollector now stores raw CMCD strings instead of pre-parsed objects, removing its dependency on @svta/cml-cmcd entirely. Tests use validation function return values (result.data) for both spec validation and data assertions in a single pass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: update cml packages * fix: add logging to xhr collector * refactor: use unified collector and validateCmcdRequest for CMCD v2 tests Rewrite CmcdRequestCollector with a single requests array storing httpRequest objects compatible with CML's validateCmcdRequest(). Replace mode-specific validators (validateCmcd, validateCmcdHeaders) with the unified validateCmcdRequest() and remove the invalid validateCmcdKeys test that was passing a string to a function expecting a parsed object. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * chore: update CMCD version * Dedicated sample section for CMCD * Use headers transmission mode string from CML * Align CMCD v2 config naming with CML spec Rename targets->eventTargets, timeInterval->interval, includeOnRequests-> includeInRequests across settings, samples, and tests. Switch event validation to validateCmcdEvents (batch). HTTPLoader now accepts empty POST bodies so CMCD event endpoints don't trigger retries. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: update cml versions * Catch errors in recordResponseReceived * Fix wrong URLs in CMCD demos * Small refactoring in DashManifestModel.js * Minor refactoring * Cleanup all events in CmcdController.js when resetting * Refactor CustomParametersModel.js * Add CMCD version to reference UI * Small refactoring in CmcdModel.js * Add link to sample setion in reference UI * Add missing CMCD fields to JSDoc in Settings.js * Add include in requests CMCD field to reference UI * Add a warning when catching an error in the CmcdController.js * Add a simple express.js server that the local CMCD demos can report against * Refactoring of CMCD demo and classes * Additional CMCD refactoring * fix: update CML dependencies to address missing CMCD nor values * Check for CMCD enabled directly for each request * Function renaming for CMCD * Rework the CMCD samples * Fix unit tests * Adjust samples * Fix linting issues * Rename context to dataContext for clarity * Fix wrong use of this instead of instance * Reset _isSeeking and remove wrong payload for getGenericCmcdData * Remove duplicate entries in HTTPRequest.js * Do not execute CMCD tests when no init segment was identified * Avoid error when representationController is not defined in _onDataUpdateCompleted --------- Co-authored-by: Sebastian Piquerez <89274285+sebastianpiq@users.noreply.github.com> Co-authored-by: Casey Occhialini <1508707+littlespex@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Daniel Silhavy <daniel.silhavy@fokus.fraunhofer.de>
Add functional tests to validate CMCD version 2 requests