Exercises for training tests mocking.
All exercises have detailed descriptions available after signing here: https://jaktestowac.pl/mockowanie/ You will get link to recording of webinar, presentation and tips (in Polish language).
Information how to get tested app is located in page available after registering here https://jaktestowac.pl/mockowanie/
Node.js
Visual Studio Code
- extensions for VSC (after installing project it should be suggested for installation):
Prettier - Code formatter
- for formattingPlaywright Test for VSCode
- for easy Playwright test runningGitLens
- for commits handlingCode Spell Checker
- for highlighting spelling mistakes
Download this repository and open it main folder, then:
-
Install packages:
npm i
-
Install Playwright browsers:
npx playwright install
-
Configure
playwright.config.json
- Set baseURL to your app main url.
- Set timeout to desired value (current 6s can be to short)
There are few ways of test running:
- Navigate to folder with given exercise an simply run test by pressing green arrow
- Open
Testing
tab located in left menu (flask icon), unfold all tests and choose one or as many as you want to be run. If test not appears, refresh tab or checkplaywright.config.ts
if you have everything set properly withprojects
section. - Run npm scripts by copy pasting scripts form
package.json
formscripts
section. - Use VSC npm script run section:
- in
Explorer
tab menu checkNPM Scripts
- in very bottom of Explorer tab you will find section
NPM SCRIPTS
- choose script you want to run
- in
Just run script form package.json
:
npm run test:ui
Recommended option is running this script in separate console.
- there are two main folder for tests and you can compare implementation with or without mocking
- broke test and try to find problem in report
- some tests are designed to fail and those tests contains tag
@fail
in name - if tests fail without clear reason:
- check if tested app is up and running,
- check timeout in playwright.config.ts (on slow machines it need to be increased)