Adjust integration tests to reflect new HTML structure.

Fixes #515. Fixes #514. And fixes a sparodic bug when waiting for jQuery to exist.