Open sbarber2 opened 3 weeks ago
As a recent example, #566 occurred as an issue because no one noticed that module.export() works fine in node.js when running standalone Jest tests via node.js, but then throws an error in Chrome. The error didn't appear to affect operation of the app (because it was the last statement in the .js file and because it wasn't necessary in the browser app's design). But it was invisible to us during dev and test until I happened to open the browser console looking for a different issue.
So there are at least two use cases here:
Ah, we can have Jest tests fail by overriding console.error (and/or console.warn?): https://stackoverflow.com/questions/28615293/is-there-a-jest-config-that-will-fail-tests-on-console-warn
Good or bad idea?: discuss at #571
(This probably would not have helped with #566 though, since Jest is by definition running in a simulated browser environment in a node.js process. But for other console issues, it could still be helpful to find some console errors/warnings this way.)
If and when we start using Playwright for in-browser testing, here's a way to catch console errors.
And here's a way to do this in selenium.
We have learned so much about this project, we should write an article for a CMQ that tells people who have skills from 1520 years ago how to get caught up to speed with the modern dev stack.
I wonder how much of the testing that we’ve implemented we would’ve gotten free with react. Does Joe know?
On Sun, Oct 13, 2024 at 8:47 AM Steve Barber @.***> wrote:
And here's a way https://stackoverflow.com/questions/4189312/capturing-javascript-error-in-selenium to do this in selenium.
— Reply to this email directly, view it on GitHub https://github.com/Plant-Tracer/webapp/issues/542#issuecomment-2408966713, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMFHLBPO6ER2ELY5SVRRD3Z3JTVXAVCNFSM6AAAAABPWT7VXCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBYHE3DMNZRGM . You are receiving this because you are subscribed to this thread.Message ID: @.***>
I have some free time tomorrow, I can potentially draft a couple jest tests to catch console errors so that we can have an understanding of how it would work.
See #454
Browser console messages are maddeningly ephemeral and usually invisible.
We need 4 ways to handle JavaScript console errors and/or warns, since we are using (or plan to use) 4 different kinds of testing technology:
For Manual dev/test, we can try:
We could do something like this during development and testing.
Or maybe this
For the other three, see comments below.