Skip to main content

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 how Eyes compares the checkpoint image with the baseline image.

The following match levels are available:

  • Strict - (Default) Detects changes in text, font, color, graphics, and position of elements. It aims to detect differences that are visible to the human eye while ignoring differences in pixel values that are platform dependent due to the rendering software and hardware.

  • Layout - Identifies changes in various page elements, such as text, images, buttons, and columns, and verifies that the relative positions of these elements are consistent. This match level can detect elements that have appeared, disappeared, or moved. With this match level, Eyes ignores differences in the actual content text and graphics, color, and other style changes. This level is useful for pages with dynamic content, language localization, and cross-environment testing where a single baseline is used for multiple execution environments.

  • Ignore colors - Similar to the strict match level but ignores changes in colors. It is effective when your content is static but the color varies, for example if there are buttons or screen elements that can appear in a variety of colors.

  • Exact - Pixel-to-pixel comparison of the checkpoint and baseline images. It is sensitive to differences such as rendering anomalies that are not visible to the human eye. It is not recommended for ordinary verification purposes.

  • Dynamic - Recognizes defined text patterns such as a date, email address, or URL. For details, see Dynamic text match level

For more information, see How to use Eyes match levels.

The default match level is Strict.

To change the match level for the rest of the execution:

eyes.matchLevel = .layout

To change the match level 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())

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.