docs: Add a new heading section on Casper debugging.

Also enhance the error output from the casper tool.
This commit is contained in:
Tim Abbott
2019-06-16 22:19:13 -07:00
parent 4049a19e0e
commit e6cb83b6e9
2 changed files with 18 additions and 3 deletions

View File

@@ -19,6 +19,22 @@ from `frontend_tests/casper_tests/`.
## Debugging Casper.JS
When a Casper test fails, the first things to check (before you bother
trying to use the Casper debugging tools are:
* Does your branch actually work if you just open the webapp and try
to follow the flow being tested? Often the answer is no, and you'll
find the debugging experience in your browser to be a much more
convenient way to fix the issue.
* Does your branch use ES6 syntax like arrow functions in a context
that isn't transpiled (i.e. non-TypeScript code)? Casper uses the
PhantomJS browser, which doesn't support ES6 syntax, so use of
non-transpiled ES6 syntax will generally be first discovered via the
Casper tests failing..
* Are there any errors in `var/casper/server.log` (from the root of
your `zulip` checkout? That's where the `run-dev.py` console output
goes when running Casper tests.
Casper.js (via PhantomJS) has support for remote debugging. However, it
is not perfect. Here are some steps for using it and gotchas you might
want to know; you'll likely also want to read the section on writing

View File

@@ -106,9 +106,8 @@ def run_tests(files: Iterable[str], external_host: str) -> None:
break
if ret != 0:
print("""
Oops, the frontend tests failed. Tips for debugging:
* Check the screenshots of failed tests at var/casper/casper-failure*.png
* Try remote debugging the test web browser as described in docs/testing/testing-with-casper.md
The Casper frontend tests failed! For help debugging, read:
https://zulip.readthedocs.io/en/latest/testing/testing-with-casper.html
""", file=sys.stderr)
sys.exit(ret)