By Janice Lan and Brian Higgins
The rapidly evolving device and browser landscape allows us to collect increasingly rich data via our snippet. Because we host the snippet and our customers fetch it from us dynamically, expanding its functionality requires a strict eye on compatibility for all of our customers’ end users. Our primary concerns are safety and iteration speed, and we’ve invested heavily in robust testing and deployment infrastructure to allow us to confidently roll changes out without spending weeks in manual testing. This blog post dives into how we built these tools and issues we encountered along the way. Specifically, we focus on:
- Our priorities for test coverage
- Challenges we tackled while writing tests
- How to gradually roll out a CDN hosted resource
Testing Coverage & Priorities
Beyond checking functionality, we also evaluate the snippet on customer websites to identify and prevent changes to customers’ sites. We look for the following issues:
- Changing the visual layout of the page
- Creating pop–ups or security notifications
- Creating or modifying variables in the global scope
- Affecting page load performance
With these checks, we verify that our snippet will not change the user experience of our customers’ websites.
Challenges Tackled While Creating Tests
To address this issue, we remove everything in the page that could change DOM elements after the page renders. We followed these steps:
- Load the page and let it render completely.
- Take the rendered page source from the DOM and store it.
- Replace the HTML of the page with the “cleaned” version.
- Run initial tests to create a baseline snapshot of the page.
- Re-run tests and compare results to initial results — there should be no changes.
In our manual testing process, we evaluate the new snippet by replacing the CDN–hosted version with a locally hosted development version. Switching the snippet in place enables us to view our customers’ sites exactly as an end user would after we deploy. This strategy allows us to spot check various customer integrations, major web frameworks, popular devices and operating systems prior to deployment.
Staged Deployment of a CDN Resource
If these topics interest you, or you want to help build trust on the internet, check out our careers page!