This project contains automated end-to-end tests using Playwright and TypeScript, designed to work with Specmatic for contract-driven testing.
specs/- Contains Playwright test specs (e.g.,example.spec.ts).playwright.config.ts- Playwright configuration file.package.json- Project dependencies and scripts.playwright-report/- Generated Playwright HTML reports.test-results/- Raw test result files.
Install dependencies:
npm install
# or
yarn installnpx playwright init-agents --loop=vscodeTo run all Playwright end-to-end tests.
npx playwright testTo run a specific test file:
npx playwright test tests/example.spec.tsRuns the tests in a specific file.
npx playwright test exampleStarts the interactive UI mode.
npx playwright test --uiRuns the tests only on Desktop Chrome.
npx playwright test --project=chromiumRuns the tests in debug mode.
npx playwright test --debugAuto generate tests with Codegen.
npx playwright codegenTo run tests with a specific tag (e.g., @dashboard-overview), use the following npm script:
npm run test:tag -- @dashboard-overviewNote: The
--is required to forward the tag argument to Playwright. This will run only the tests annotated with the specified tag.
You can also use any other tag, such as @admin, in the same way:
npm run test:tag -- @adminTo run tests with a specific tag using npx (no npm script required):
npx playwright test --grep @dashboard-overviewYou can use any tag, for example:
npx playwright test --grep @adminAfter running tests, view the HTML report:
npx playwright show-reportThe report will open in your default browser.
This project is intended to be used alongside Specmatic for contract-driven testing. Refer to the Specmatic documentation for integration steps and best practices.
MIT