microsoft / playwright-pytest

Pytest plugin to write end-to-end browser tests with Playwright.
https://playwright.dev/python/docs/test-runners
Apache License 2.0
415 stars 67 forks source link

[FEATURE] Add support for visual regression / snapshot testing #63

Open kumaraditya303 opened 3 years ago

kumaraditya303 commented 3 years ago

Add support for snapshots of the page, screenshots etc like in jest toMatchSnapshot

Example: https://github.com/kumaraditya303/pytest-playwright-snapshot

kumaraditya303 commented 2 years ago

I have implemented this feature in a separate pytest plugin, it also supports threshold for comparing snapshots

See https://github.com/kumaraditya303/pytest-playwright-snapshot

Install it with

$ pip install pytest-playwright-snapshot

cc to some users who requested it: @TommyXie1990 @utapyngo @chasays

ghost commented 8 months ago

There is a strong use case for including this type of testing, and my team would benefit from having this feature.

Thank you for creating a separate plugin for it, though it would be great to have it baked in.

aspenboy commented 8 months ago

@bgronemanLIO my tests are quite heavy on visual assertions. After trying couple of different solutions and pytest plugins I ended up with https://github.com/Visual-Regression-Tracker/Visual-Regression-Tracker - it's free, configuration is quite easy and provides reliable results. Also - it support few different comparison libs, so you can tweak the settings according to your needs.

It would be nice to have this kind of feature out-of-the-box, though - but I guess it's rather unlikely.

ghost commented 8 months ago

@aspenboy thanks for sharing that tool. It seem very robust I will consider integrating it into our pipeline.

aspenboy commented 8 months ago

No problem :) good luck!

paigusov commented 5 months ago

Can you tell me when this method is planned to be implemented? pytest-playwright-snapshot is weak