1 package com.atlassian.selenium.visualcomparison.v2;
2
3 import com.atlassian.annotations.ExperimentalApi;
4
5 import javax.annotation.Nonnull;
6
7 /**
8 * The main tool for visual comparison. Instances of this interface can be used for performing visual comparison of
9 * a single page. They should be {@link ComparisonSettings configurable} at the instance level, as well as per
10 * {@link #compare(String, ComparisonSettings) single comparison}. The settings passed on for comparison should merge
11 * into, or override the comparer settings where appropriate.
12 *
13 * @since 2.3
14 */
15 @ExperimentalApi
16 public interface Comparer
17 {
18
19 /**
20 * Take a snapshot of the current page and compare it with a baseline using given {@code id}. Use default settings
21 * specific to this instance of {@code Comparer}.
22 *
23 * @param id ID of the comparison
24 * @throws VisualComparisonFailedException if the visual comparison fails. Depending on the settings, this may also
25 * trigger generating a report containing details of what parts of the page did not match the baseline.
26 * @throws IllegalStateException if settings associated with this comparison are invalid for the purpose of this
27 * comparison
28 */
29 void compare(@Nonnull String id);
30
31 /**
32 * Take a snapshot of the current page and compare it with a baseline using given {@code id}. Use {@code settings}
33 * in preference, or in addition to any settings specified for this {@code Comparer} itself.
34 *
35 * @param id ID of the comparison
36 * @param settings extra settings specific to this comparison
37 * @throws VisualComparisonFailedException if the visual comparison fails. Depending on the settings, this may also
38 * trigger generating a report containing details of what parts of the page did not match the baseline.
39 * @throws IllegalStateException if settings associated with this comparison are invalid for the purpose of this
40 * comparison
41 */
42 void compare(@Nonnull String id, @Nonnull ComparisonSettings settings);
43 }