Our Analytics practice relies on a
dataLayer object that is injected onto the DOM at build time, this object must follow a specific structure and format, values will vary based on application and route of the website. We should test for that structure, format and values as part of our automated testing.
- validate structure & format (consistent across all implementations)
- validate values across pages per project (custom schemas needed in each project)
Additionally, if a custom schema is provided for the project level, it will validate values as well.
These are automated gating tests. If the structure or content of your objects is incorrect, the test will fail, and the delivery pipeline will be halted.
Writing analytics tests: Up on story completion, make sure to include the assertion, also make sure to pull the latest starter-kit change regarding dataLayer to incorporate latest analytics checklist
Running analytics tests: As part of the delivery pipeline
Analytics team to set
- create a standalone
nightwatch-json-schemaOSS package that implements the logic above
- if the
dataLayerschema can be shared publicly, we should separate that into it's own package
dataLayerdefinition and schema ownership
- @delivery, @developers, @qa: tooling & implementation