Skip to content

Root level threshold not being taken into account for comparison, in OSS mode #448

@n2o1988

Description

@n2o1988

Bug description

We're using the library in OSS mode (using pageShots) and noticed that the root-level threshold parameter (described in the docs) seems to be ignored in the comparison.
Only the snapshot-specific threshold seems to be getting into account:

{
  threshold: 0.1, // this is never used
  pageShots: [
    {
       threshold: undefined // this is used, if defined
       ...
    }
}

Looking at the code seems to confirm this hypothesis: https://github.com/lost-pixel/lost-pixel/blob/main/src/checkDifferences.ts#L70-L71

How to reproduce

  1. Use lost-pixel v3.22.0
  2. Setup config with pageShots and generateOnly: true
  3. Don't set any threshold in the pageShots' snapshots
  4. Set a global threshold in the root of the config
  5. For the example use a page that would produce a pixelDifferencePercentage below the specified threshold but greater than 0
  6. Run lost-pixel with the meta arg.
  7. See in lost-pixel action logs--> {"pixelDifference":681,"pixelDifferencePercentage":0.0004926215277780001,"isWithinThreshold":false}

Expected behavior

isWithinThreshold should be true.

Lost Pixel information

lost-pixel logs from CI

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions