TIL-4 Automated screenshots using your testing framework.
Recently we had a requirement where we needed to generate screenshots and this was part of a flow.
buy vs build
Like all other tools, we first went on a lookout for existing tools which support our requirements. We found quite handful that were close enough, but finally decided on building our own solution due to 2 main reasons:
- We wanted more(compared to these 3rd party services) control over when our screenshots were taken.
These provided only timeout option — which was definitely helpful but not precise enough. - In one go, we wanted to scrap the app and open links on the page as well to take multiple screenshots.
build it was
Once we had decided on that, we had one more choice to make: which framework to pick cypress(frontend) or selenium(backend)
We POC’ed both solutions, I personally liked cypress solution better as it was more relevant and had better control over network controls. But our backend containers relied heavily on java, so instead of adding one more service which would have meant more maintenance and also adding one more node would have contributed to latency.
Finally we landed up using selenium with java with our rough architecture looking something like:

Though I hate using selenium in 2023, it fit our needs perfectly. And thats what tech should be about — fitting business needs.