- Navigate to https://cmd.wopee.io/
- Create an account (auto-registration with GitHub is available and recommended)
- Create a new integration project
- Create a new API key for the project
- Install Node.js: https://nodejs.org/en/download/
- Set up VS Code and Playwright: https://playwright.dev/docs/getting-started-vscode
In VS code: Ctrl+Shift+P -> Git: Clone -> link to this repository
https://github.com/autonomous-testing/ws-getting-started-w-playwright-visual-testing
export WOPEE_API_KEY=your_api_keyGet your WOPEE_API_KEY from Wopee.io commander (Navigate to project > Project Settings > API KEYS tab > Create new key).
npm i-
First test:
npx playwright test tests/1-first.spec.ts -
Working with reports:
- Change the
baseUrlby adding/gallery.htmlto the URL - Run the test:
npx playwright test tests/1-first.spec.tsagain - Open the report in the browser:
npx playwright show-report - Explore how visual diffs are reported
-
Updating snapshots:
npx playwright test -uAlternatively: You can update only some tests, see Playwright documentation about Command line options and Tagging test
-
Why Visual Testing is a good idea and why not (slides).
-
Testing specific element:
npx playwright test tests/2-element.spec.ts -
Running tests in UI mode:
npx playwright test --headed tests/2-element.spec.tsornpx playwright test --ui -
More advanced visual testing:
npx playwright test tests/3-advanced.spec.tsSee also documentation: toHaveScreenshot
-
Good practices for visual testing (slides).
-
First test with Wopee.io:
npx playwright test tests/w1-basics.spec.ts
- Wopee.io Commander: https://cmd.wopee.io/
- Make sure key
WOPEE_API_KEYis set up correctly
- Working with Wopee.io commander:
- Approve baseline
- Explore how visual diffs are reported
- Explore baseline tab
- [optional]
- Testing specific element:
npx playwright test tests/w2-element.spec.ts - More options for visual testing, more complex scenario example:
npx playwright test tests/3-more.spec.ts
- Other ideas (slides).
-
Learn more from our blog: Getting Started with Playwright Visual Testing
-
Do you have any idea how to improve this workshop or Wopee.io? Share it with us
-
Do you have any questions or need help? Ask us here
-
Would you like to help us improve Wopee.io? PRs are welcome here