playwright/examples/components-vue
2022-09-08 08:37:38 -07:00
..
playwright chore: migrate vue component example to a new vite plugin (#13750) 2022-04-25 22:10:08 -07:00
public chore: add vue components example (#12797) 2022-03-15 14:47:42 -07:00
src Revert "chore: use plugins for component testing again (#13977)" (#13998) 2022-05-06 12:02:07 -07:00
.gitignore chore: add vue components example (#12797) 2022-03-15 14:47:42 -07:00
index.html chore: add vue components example (#12797) 2022-03-15 14:47:42 -07:00
package-lock.json chore(deps-dev): bump vite from 2.9.5 to 2.9.13 in /examples/components-vue (#16936) 2022-08-31 10:28:39 +02:00
package.json chore(deps-dev): bump vite from 2.9.5 to 2.9.13 in /examples/components-vue (#16936) 2022-08-31 10:28:39 +02:00
playwright.config.ts Revert "chore: use plugins for component testing again (#13977)" (#13998) 2022-05-06 12:02:07 -07:00
README.md docs: add a brief components doc (#13944) 2022-05-04 16:01:48 -07:00
vite.config.js chore: add vue components example (#12797) 2022-03-15 14:47:42 -07:00
vue.d.ts fix(ct): vue import errors (#17066) 2022-09-08 08:37:38 -07:00

Component testing with Playwright and Vue3

VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar) + Playwright Test for VSCode.

Project Setup

npm i

Compile and Hot-Reload for Development

npm run dev

Test project

Run tests from your VS Code, or execute

npm run test

How to add component tests using Playwright

  • npm init vue@latest was used to create a default project.

    npm init vue@latest
    
  • Install Playwright Test with component testing as dev dependencies.

    npm i --save-dev @playwright/test @playwright/experimental-ct-vue
    
  • playwright/index.html file was added that defines theming for the components through importing playwright/index.js.

  • playwright.config.ts was added that builds components before running tests.

  • A bunch of .spec.ts and .spec.tsx files were added to src that demonstrate Vue3 component testing with and without the use of JSX syntax.