These are questions about browser testing and state.
Imagine a large suite of browser tests that intend to deeply regression test an application. Like most web apps, this involves different types of state: user permissions, expected data in a database, etc. Testing the application requires logging in as different users and/or user types to test different views into the data.
- What are patterns for creating expected state prior to running browser tests?
- Is it appropriate for the browser tests to communicate directly with the database of the system under test, creating state in the same manner that you would in an integration test?
- How important is it that browser tests be decoupled from the application under test, such that the only thing required to run tests are the tests themselves, which can be pointed at any applicable URL (dev, test, staging)?