Skip to content

[BUG] HTML Reporter: Image Mismatch Section Shows Even on non-Image Types #11183

@rwoll

Description

@rwoll

Context:

  • Playwright Version: ToT, 1.17.1

The HTML Reporter always shows an Image Mismatch section, even if the snapshot is not a common image format:

Screen Shot 2022-01-04 at 5 08 33 PM

In this example, our use case is API testing, so we are not doing visual regressions.

Would it be OK for me to suppress this block in the reporter if the snapshot is not a common image format?

I'd imagine we could infer the content type based on (1) sniffed mimetype from the contents, (2) the filename extension, and/or (3) an explicit (new) contentType option similar to what we have in https://github.com/microsoft/playwright/pull/10121/files.

For backwards compatibility (if we don't have (1)), we might have to inference in some cases and only NOT show it if the name explicitly has a textual extension (e.g. .json, .yml) or explicit (new) non-image contentType option. For instance, if a user is currently supplying their image snapshot name as foo (no extension), we wouldn't want to break the reporter so we would always show the Image mismatch block in this case.

(I know there is other work/conversations regarding snapshot testing, and I'm happy to wait on implementing this to see if it makes sense with whatever other changes land. Thanks!)

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