This article will explain the screenshot adjustment that Applitools Eyes provides, using Ruby examples.
For your convenience, please find the following video guide:
In automated visual tests, it's crucial to make sure that your screenshots are reliable and sound.
With a dependency of the browser, sometimes making the screenshot resemble the reality might be a bit more challenging, especially when using functions that include dynamic behavior, such as floating menus or infinite scroll bar.
Most browsers don't automatically get a full page screenshot: the browser grabs only what is visible in the viewport of the browser's window while the test is running.
In order to get a full page screenshot, we have to enable it with Applitools Eyes.
In order to do so, there are two available methods:
1. Force full page screenshot:
2. Use CSS transition:
If you don't enable CSS transition, the floating bar will appear several times, due to the fact that without using CSS transition, Applitools will use Selenium to scroll the page, capture screenshots, and patch them together, which will trigger a visual anomaly that will fail the test, as you can see below:
With the two options enabled, the menu bar only appears once, and no scrollbar events will be triggered. In addition, the infinite scrollbar problem will not occur, since the only thing that appears on the screen is the content of the viewport.
In case you still see a scrollbar, you can hide it using the following method:
The following lines contain the syntax for the different programming languages:
Java:
eyes.setForceFullPageScreenshot(true);
Python:
eyes.force_full_page_screenshot = True
Ruby:
eyes.force_fullpage_screenshot = true
.Net:
eyes.ForceFullPageScreenshot = true
Javascript:
eyes.setForceFullPageScreenshot(true);