Qali
🐺 What is Qali?
Qali is a Node.js library for creating browser tests. Run one command (npx qawolf init
) to configure your project and set up CI.
- Skip writing boilerplate: Your browser actions are converted to Playwright/Jest code.
- Create stable tests: Your tests automatically wait for elements. Element selectors use test attributes when possible, and CSS/text otherwise.
- Edit your tests: Edit your code as it is created and add steps to existing tests. Re-run your tests automatically with watch mode.
- Debug with ease: Each test can report full interactive replayable session with logs.
🖥️ Install
Set up your project for browser tests:
cd /my/awesome/project
yarn create qali
Configure your test directory and CI provider:
? rootDir: Directory to create tests in (e2e)
This will install qali
, jest
and playwright
as dev dependencies and create a [CI workflow file] to:
-
🐎 Run tests in parallel -
📄 Create reports
🎨 Create a test
yarn qali create http://example.com testName
A new browser page will be opened where you can record the test flow.
Take screenshots with ctrl/cmd + S
Check the existence a string in page with ctrl/cmd+click
End the test by hitting Enter in the terminal that started the test recording
Hints:
- try to do things slowly
- click directly on text
- type slowly
✅ Run your tests
On Chromium:
yarn qali test [name]
On Firefox:
yarn qali test --firefox [name]
On Webkit:
yarn qali test --webkit [name]
On all browsers:
yarn qali test --all-browsers [name]
Run the tests headlessly with `yarn qali test --headless`
To mock api requests run (This means that every request/response that is sent to backend is stored in a file and then replayed so there is no need to run a backend server) ``` yarn qali test --mock ```
To create a report for each test
yarn qali test --report
To add more logs to tests(eg server logs)
yarn qali test --report --more-logs logs.txt,server.logs
The logs must be in the form per line
{
"timestamp": 1608040047816,
"method": "log",
"data": [
"%cbackend_dev |%c INFO 2020-12-15 15:47:27,819 basehttp 36 139840204351232 \"GET /api/users/me/ HTTP/1.0\" 200 430\r",
"color:rgb(0,153,102)",
"color:rgb(-51,-153,-204)"
]
}
To run the ci script:
npx qali-ci --url https://github.com/digigov/example --commit feature-qali-ci --qaliPath ui/e2e --report --prepareScript "cp backend-defaults.env backend-local.env" --port 80