Testing
Tools used to test the application:
- ESLint (static code analysis of JS files)
- Stylelint (static code analysis of CSS files)
- Markdownlint (static code analysis of Markdown files)
- Jest (unit tests)
- Playwright (visual and functional component testing)
Generally, npm test and npm run test:playwright-ct:all should be run within
their designated Docker containers before pushing changes to the repository.
Tools
You can run all tests with a single command:
npm run lint && npm test && npm run test:playwright-ct:all
Linters (ESLint, Markdownlint, Stylelint)
Run linters either all together:
npm run lint
or run linters individually:
npm run <eslint|markdownlint|stylelint>
Jest
npm run test:jest
Playwright
Configuration
Test parameters can be tweaked by creating and tweaking .env file.
Running Tests
Run tests:
npm run test:playwright-ct:<all|all-with-update>
You can also run specific tests by passing a path to the test files:
npm run test:playwright-ct:<all|all-with-update> -- -- <match_path>
You can also pass any CLI command to the test runner:
npm run test:playwright-ct:<all|all-with-update> -- -- <cli_argument>
Opening Test Report
After running Playwright tests, test report can be served by using the following command:
npm run test:playwright-ct:show-report
Then open the displayed URL (typically http://localhost:9323)
in your browser. Please note that the test report is only available
if the tests were run prior to serving the report.