Good tests shouldn't shouldn't have duplication and should be concise, however when testing a web application with authentication the test must first get past authentication to perform the desired function.
With many tests this quickly means that the login screen (or equivalent) will be tested numerous times. I would ideally like to avoid this repetition.
One method is to create cookies and sessions to "trick" the browser into thinking the state for the test exists. This method quickly becomes complex with potentially many sessions needing to be created, and also increases the overhead of the test, especially if these need to be combined with database states.
Does anyone have a good solution for a complex applications, or a good pattern for managing multiple sessions, databases, and cookies if this is how they work?