mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	docs: Add a new heading section on Casper debugging.
Also enhance the error output from the casper tool.
This commit is contained in:
		@@ -19,6 +19,22 @@ from `frontend_tests/casper_tests/`.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## Debugging Casper.JS
 | 
					## 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
 | 
					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
 | 
					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
 | 
					want to know; you'll likely also want to read the section on writing
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -106,9 +106,8 @@ def run_tests(files: Iterable[str], external_host: str) -> None:
 | 
				
			|||||||
                break
 | 
					                break
 | 
				
			||||||
    if ret != 0:
 | 
					    if ret != 0:
 | 
				
			||||||
        print("""
 | 
					        print("""
 | 
				
			||||||
Oops, the frontend tests failed. Tips for debugging:
 | 
					The Casper frontend tests failed!  For help debugging, read:
 | 
				
			||||||
 * Check the screenshots of failed tests at var/casper/casper-failure*.png
 | 
					  https://zulip.readthedocs.io/en/latest/testing/testing-with-casper.html
 | 
				
			||||||
 * Try remote debugging the test web browser as described in docs/testing/testing-with-casper.md
 | 
					 | 
				
			||||||
""", file=sys.stderr)
 | 
					""", file=sys.stderr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        sys.exit(ret)
 | 
					        sys.exit(ret)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user