Normally you would test each plugin/section of code in isolation. Your test page would have the appropriate HTML elements to work with, the plugin code, and the code that runs through the tests.
You can read about testing a plugin in my article on
my plugin framework, and can download the actual code and tests at the bottom of that page.
For testing entire applications in the browser look at Selenium and other such frameworks.