flexpect - v0.21.0
    Preparing search index...

    Interface Tolerance

    Describes a tolerance value that defines how much deviation from the expected result is acceptable for a matcher.

    This type can be reused across different matchers (e.g. alignment, spacing, size comparison) to allow flexible tolerance configuration.

    By default, the tolerance is expressed as a percentage, but a pixel-based value can also be used for more precise, fixed-size comparisons.

    // Allow up to 5% difference
    { tolerance: 5, toleranceUnit: ToleranceUnit.Percent }
    // Allow up to 3 pixels difference
    { tolerance: 3, toleranceUnit: ToleranceUnit.Pixels }
    interface Tolerance {
        tolerance?: number;
        toleranceUnit?: ToleranceUnit;
    }

    Hierarchy (View Summary)

    Index

    Properties

    tolerance?: number

    Allowed tolerance value.

    Must be greater than or equal to 0. Omitting this option defaults to 0, which will typically cause the assertion to fail or throw an error, since zero tolerance is allowed.

    toleranceUnit?: ToleranceUnit

    Defines the unit in which the tolerance is expressed.

    Defaults to percent if not specified.

    ToleranceUnit.Percent