This project uses Playwright for API testing. Playwright enables fast and reliable browser automation across different browsers and devices.
Ensure you have the following installed before running the tests:
- Node.js (v16 or later recommended)
- Visual Studio
- npm or yarn
Clone the repository and install playwright dependencies:
- git clone git@github.com:auto-qa-hub/petstore_playwright.git
- npm init playwright
Ensure Playwright dependencies are installed:
- npx playwright install
To execute tests, use the following commands:
- npx playwright test
- npx playwright test tests/example.spec.js
- npx playwright test --headed
- npx playwright test --ui
Generate and view test reports:
- npx playwright show-report
Playwright tests are located in the tests/ directory. Example structure:
/tests
- storeTests.spec.ts
- userTests.spec.ts
- petTests.spec.js
Refer to the Playwright documentation - https://playwright.dev/docs/intro for writing and structuring tests.
To integrate Playwright with CI/CD pipelines, configure .github/workflows/playwright.yml or relevant CI scripts. More - https://playwright.dev/docs/ci-intro
-
Ensure all dependencies are installed (npm install)
-
Verify Playwright browsers are installed (npx playwright install)
-
Run tests in debug mode: npx playwright test --debug