dev:contributing:qa
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
dev:contributing:qa [2023/09/17 12:38] – Add angular e2e tests sandbergja | dev:contributing:qa [2025/09/09 14:55] (current) – lint section sleary | ||
---|---|---|---|
Line 53: | Line 53: | ||
npm run build-prod | npm run build-prod | ||
npm run test | npm run test | ||
+ | |||
+ | ==== Angular Lint ==== | ||
+ | |||
+ | See '' | ||
+ | |||
+ | To run on a running Evergreen server: | ||
+ | |||
+ | <code sh> | ||
+ | cd Open-ILS/ | ||
+ | ng lint | ||
+ | </ | ||
+ | |||
+ | To fix syntax errors automatically: | ||
+ | |||
+ | <code sh> | ||
+ | cd Open-ILS/ | ||
+ | ng lint --fix | ||
+ | </ | ||
+ | |||
+ | We also have several [[https:// | ||
+ | |||
+ | You can check out [[https:// | ||
==== Angular Unit Tests ==== | ==== Angular Unit Tests ==== | ||
See [[dev: | See [[dev: | ||
+ | |||
+ | To run on a running Evergreen server: | ||
+ | |||
+ | <code sh> | ||
+ | cd Open-ILS/ | ||
+ | npm run test | ||
+ | </ | ||
+ | |||
+ | === Common things that break Angular unit tests === | ||
+ | |||
+ | == Changing DOM selectors == | ||
+ | |||
+ | If the test is expecting a certain DOM element, but you change the structure within an Angular template, the test might start failing. | ||
+ | |||
+ | Note that you can use text of a button as a selector. | ||
+ | |||
+ | To fix it: update the selector in the test. Or perhaps the test can be made more general. | ||
+ | |||
+ | == Adding a new service == | ||
+ | |||
+ | Adding a new service | ||
+ | |||
+ | To fix it: add a mock for the new service in the test. Or even better, consider if you can simplify or refactor the component so that it does not need many different services. | ||
+ | |||
+ | == Lifecycle/ | ||
+ | |||
+ | Interacting with anything asynchronous (especially grid and combobox) requires some care! | ||
+ | |||
+ | To fix it: You may be able to add a setTimeout. | ||
==== Angular e2e (end-to-end) Tests ==== | ==== Angular e2e (end-to-end) Tests ==== | ||
Line 83: | Line 134: | ||
For more tips and documentation, | For more tips and documentation, | ||
+ | |||
+ | ==== OPAC Javascript Unit Tests ==== | ||
+ | |||
+ | To run tests for the javascript in the OPAC: | ||
+ | <code sh> | ||
+ | cd Open-ILS/ | ||
+ | npm i && npm run test | ||
+ | </ | ||
+ | |||
==== Perl Unit Tests ==== | ==== Perl Unit Tests ==== | ||
Line 185: | Line 245: | ||
At time of writing, there is no equivalent to " | At time of writing, there is no equivalent to " | ||
+ | |||
+ | {{tag> |
dev/contributing/qa.1694968726.txt.gz · Last modified: 2023/09/17 12:38 by sandbergja