Playwright tests for the SauceDemo website.
- Node (version is specified in the .nvmrc file). You may want to use nvm to manage multiple Node versions.
- pnpm (version is specified in the package.json file,
engines
field)
- Clone this repository.
- Run
pnpm install
to install the dependencies.
-
Run
pnpm run playwright:test
to run all the tests on Chrome, Firefox, and Safari. -
Run
pnpm run playwright:ui
to open the Playwright in UI mode. -
Run one of
pnpm run playwright:test:high-priority
pnpm run playwright:test:medium-priority
pnpm run playwright:test:low-priority
to run only tests with @high or @medium or @low priority annotation.
- The tests are located in the tests folder.
- Tests are written using the Page Object Models (PoM) pattern. PoM classes are located in the tests/pages folder.
- Common steps/fixtures are located in the tests/fixtures folder.
So far, I have created a few positive and negative tests for Login, and positive tests for Products/Inventory page and for Shopping Cart page. Also, I have created most of the Page Objects classes for pages in the app.
- It's possible to extract base page class with common locators visible in rest of the pages.
- It would be good to include API interaction and API tests, however, SauceDemo doesn't have API (everything is kept in FE state), so I didn't do it.