Open NicMcPhee opened 2 years ago
It might also be worth knowing that Cypress can run component tests as well as e2e tests. I thought we might want to consider using Cypress for both just to reduce the number of different things the students have to figure out.
There is also this "Real World App" with Cypress testing in it that I didn't know about until at least halfway through Spring 2023. Seems like a nice resource: Cypress Real World App
Cypress (now?) supports code coverage, and it looks like we might even be able to combine Cypress and Karma coverage into a single report. That could be really nice, because then we could set limits on combined coverage and let the teams decide how to best achieve the desired coverage. The one possible downside is that we might see a serious shift to almost entirely E2E tests since (I'm guessing) they'll provide the most coverage for the least amount of effort. That said, I suspect there are going to be edge cases and error conditions that will still be easier to test for with unit tests.
I was able use follow the changes in "Implementing code coverage with Angular and Cypress" on one of the final projects from S22, but that broke a lot of tests. I was able to fix most of them by adding
"proxyConfig": "proxy.conf.json"
toprojects -> client -> architect -> serve-coverage -> options
inangular.json
. Theproxy.conf.json
file is where we say that calls to/api
should go to port 4567, and that what was breaking for most of the tests. (I think the remaining broken tests are due to some slow code on their end, although I'm not sure.)Even with a few tests that still fail, the E2E coverage was very good:
For comparison, here's the Karma coverage from that project:
The E2E coverage is a little to substantially better than the Karma coverage in every category except for branches, where it's slightly worse (83% vs 87%). If I took the time to combine the two, I'm guessing that we'd have over 90% coverage in all four categories, which would be super spiffy.
Some potentially useful resources: