-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log browser console errors experienced when running TestCafe tests. #1030
base: master
Are you sure you want to change the base?
Conversation
.afterEach(async t => { | ||
const { log, warn, error } = await t.getBrowserConsoleMessages(); | ||
|
||
console.log('Captured console.log() messages:'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like (later) we could put these behind a conditional if log
, warn
, etc. is empty or null (since these appear to be arrays).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, although unfortunately, our app constantly prints stuff to console.log()
and console.error()
even during normal behavior. For instance, every page load on a development server causes the "React-Hot-Loader: misconfiguration detected, using production version in non-production environment." error message. It looks like the right way to do this kind of thing in TestCafe is with a custom Reporter, so I might port this code into a reporter once I actually get it working.
I'm still trying to debug the issue, since I still apparently have not logged enough information to get the real answer.
40cddbb
to
0763584
Compare
a468ac9
to
4e388f0
Compare
Sigh. Apparently logging the response body doesn't help at all because we don't actually return any information in the response body when an API call fails. Trying two more things:
|
I've stopped being able to reproduce the error, which is annoying for this PR, but it does seem like restarting the other failing PRs is getting them to pass now, so I'm at least happy with that. |
I'm having a terrible time debugging or reproducing the TestCafe errors in
master
.No matter what I do, I can't reproduce the errors locally, even when I check out the
master
branches of both repos and I reset my database. When I look at the video recording of the browser test failures in Sauce Labs, I can see that in the "Add resource phone number" always triggers a "Sorry! An error occurred." message when the test tries to hit the Save button, but I have no idea what's causing it. According to the code, that error message appears if any of the multiple HTTP request promises fails. It looks like we do log the promise error to the console, but that's not possible for us to view from the current Travis CI output or the TestCafe output.This PR is an attempt at getting TestCafe to print out any console errors that it sees in the browser to the command line console (i.e. Travis CI) so that we have more useful debug information. This isn't the cleanest way of doing things, since it pollutes the console output for even tests that succeed with stuff that looks like this:
However, I want to submit this as a PR so that I can at least see why the current "Add resource phone number" test fails and whether this gives us more useful information before I clean it up a bit more.