Browser testing

Running tests in the browser is simply a matter of making an HTML page that
loads your code and your tests, and then calls JS.Test.autorun(). The basics
are covered in the Getting started and Loading your
code tutorials.

Once you’ve covered that, the articles listed on the left explain how to run
your tests using various popular test-runner frameworks. When approaching
these tools, try to start by making your tests run as a static empty HTML page
that loads some static JavaScript files. If you have a page that can run your
tests without any additional tooling, it’s much easier to take those tests and
run them in other ways, for example using PhantomJS during a CI process.

HTML fixtures

If you want to remain flexible about how your tests are run, you should make
as few assumptions about the page and the environment your code is running in.
Don’t assume you can change the initial HTML of the host page. Don’t assume
you can load code from the server. Various tools don’t let you do either of
these.

For these reasons, it pays to keep your HTML fixtures in your tests
themselves. For example here’s a little test of some interaction with a
widget: