In this chapter we are going to learn about caveats and their work arounds.
There are essentially 3 main caveats.
The first one is dynamic pages where small sections of pages constantly change on a weekly basis.
So, if you depend on the screenshot after the functionality to verify if the functionality is working, you’ll get false positives.
If you are using DOM-diffing tools or pixel-by-pixel comparison tools this is going to be a big challenge to the point that this approach won’t work at all.
As you saw in the Handling Dynamic Pages chapter with API tools because of the AI and all the tools we provide, this is not an issue at all.
You could use features such as Ignore Region, Floating Region, Layout Region, etc. on a full-page screenshot to easily work around any dynamic sections of the page.
You could also analyze entire page in different modes such as the Layout Mode [LAYOUT
].
Further, you can simply take a screenshot of a small region [using checkRegion
method] if that’s the only region that’s reliable inside a given page and everything else is changing.
Then you can also use things like Automated Maintenance to update all these changes with one click.
The 2nd limitation is you may not be able to take a screenshot itself in some cases.
One such place is when a native select-menu is open, you can’t take a screenshot.
The other place is when you see a native popup.
In both these places it’s really a limitation of the browser itself.
If you can manually take a screenshot and upload it to Applitools, it’ll work fine.
But practically speaking, you may need to revert back to using code-based assertions.
Now, there may be a couple more such cases, but they are few and far between.
The 3rd one is the speed.
Since this approach needs to take screenshots, it’s much slower than the regular functional tests.
The workaround here is to simply run tests in parallel and avoid taking duplicate screenshots.
For example, if you're already taking a screenshot of a page in one of the tests, then don't take that screenshot again in a different test.
So those are the three main caveats and workarounds you need to be aware of.