Check settings
checkSettings
generates a screenshot of the current page and adds it to the Applitools Eyes test.
The methods in this class are used as part of the eyes.check(image, tag: "Main Screen")
Fluent API to configure and execute checkpoints. To use these methods, first create a target object using a method from the Target class, then call one or more of the methods in this class on the returned object, using a series of nested calls.
Import statement
import EyesImages
Match level
The match level determines the way by which Eyes compares the checkpoint image with the baseline image.
The default match level is Strict
. To change it:
// Option 1: For the rest of the execution
eyes.matchLevel = .layout
// Option 2: For a single checkpoint
eyes.check(withTag: "Viewport", andSettings: Target.image(image).layout())
eyes.check(withTag: "Viewport", andSettings: Target.image(image).strict())
eyes.check(withTag: "Viewport", andSettings: Target.image(image).content())
eyes.check(withTag: "Viewport", andSettings: Target.image(image).exact())
For more information, see How to use Eyes match levels in the Eyes Knowledge Center.
Region screenshot
To take an region screenshot, you can specify a rectangle.
The parameter to the method specifies the region to be matched. The enclosing frames are selected by the previous calls in the chain to Target.frame
.
Example
eyes.check(withTag: "Region by coordinates", andSettings: Target.image(image).region(Region(
left: 10,
top: 20,
width: 200,
height: 80
)))
Ignore regions
The test will not report any mismatches in an ignore region. This is useful for areas on the screen whose content is different on every run, such as a time of day field.
eyes.check(withTag: "Ignored regions", andSettings: Target.image(image).ignore([region1, region2, ...]))
Floating regions
In a floating region, the position of a region can move without reporting a mismatch.
eyes.check(withTag: "Floating regions", andSettings: Target.image(image).floating([region1, region2, ...], maxOffset: offset))
Region match levels
You can set the following match levels for a region:
- Strict: Detect any mismatch visible to the human eye.
- Layout: Check only the layout and ignore actual text and graphics.
- Content: Similar to the strict match level but ignores changes in colors.
eyes.check(withTag: "screenshot with strict regions", andSettings: Target.image(image).strict([region1, region2, ...]))
eyes.check(withTag: "screenshot with layout regions", andSettings: Target.image(image).layout([region1, region2, ...]))
eyes.check(withTag: "screenshot with content regions", andSettings: Target.image(image).content([region1, region2, ...]))
For more information, see How to use Eyes match levels in the Eyes Knowledge Center.