Skip to content

autonomous-testing/ws-getting-started-w-playwright-visual-testing

Repository files navigation

Workshop: Getting Started with Playwright Visual Testing

Setup

Set up Wopee.io

  • 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

Set up VS Code and Playwright

Clone this repository

In VS code: Ctrl+Shift+P -> Git: Clone -> link to this repository

https://github.com/autonomous-testing/ws-getting-started-w-playwright-visual-testing

Set up the environment

export WOPEE_API_KEY=your_api_key

Get your WOPEE_API_KEY from Wopee.io commander (Navigate to project > Project Settings > API KEYS tab > Create new key).

Install node dependencies

npm i

Agenda

  1. First test: npx playwright test tests/1-first.spec.ts

  2. Working with reports:

  • Change the baseUrl by adding /gallery.html to the URL
  • Run the test: npx playwright test tests/1-first.spec.ts again
  • Open the report in the browser: npx playwright show-report
  • Explore how visual diffs are reported
  1. Updating snapshots: npx playwright test -u

    Alternatively: You can update only some tests, see Playwright documentation about Command line options and Tagging test

  2. Why Visual Testing is a good idea and why not (slides).

  3. Testing specific element: npx playwright test tests/2-element.spec.ts

  4. Running tests in UI mode: npx playwright test --headed tests/2-element.spec.ts or npx playwright test --ui

  5. More advanced visual testing: npx playwright test tests/3-advanced.spec.ts

    See also documentation: toHaveScreenshot

  6. Good practices for visual testing (slides).

  7. First test with Wopee.io: npx playwright test tests/w1-basics.spec.ts

  1. Working with Wopee.io commander:
  • Approve baseline
  • Explore how visual diffs are reported
  • Explore baseline tab
  1. [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
  1. Other ideas (slides).

Next steps

About

Workshop: Getting started with Playwright Visual Testing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors