Performance Testing
If you don’t want users leaving the app you have to think of performance. In fact nowadays if you site is not fast enough you get even “honored” with the badge of shame from Google. Thus performance budget is one of the aspects we address with end-to-end tests and include in CI/CD pipeline to ensure new releases do comply our requirements.
With Puppetry we can assert that:
Page loading times comply given restrictions
Total weight of assets (JavaScript, CSS, images, media, fonts, XHR) requested on the page satisfies given budget.
Total number of requested of assets satisfies given budget
Milestone timings
With page.assertPerformanceTiming
method we can establish budget for loading times. Namely:
Page loading: the whole process of navigation and page load
Redirection: the time taken by document request redirections
Network latency: the time taken to fetch app cache, lookup domain, establish TCP connection, send request, receive response
Page processing: the time taken for page load once the page is received from the server
In case of assertion failure we get a report like this:
Quantity-based metrics
With page.assertPerformanceAssetWeight
method we can assert the total weight of assets (JavaScript, CSS, images, media, fonts, XHR) requested on the page
In case of assertion failure we get a report like this:
By clicking on Download performance report
we can get the network activity details
With page.assertPerformanceAssetCount
method we can assert the total number of assets (JavaScript, CSS, images, media, fonts, XHR) requested on the page
Last updated