@@ -37,6 +37,33 @@ def fixture_logged_in_chrome_driver(
3737 driver .quit ()
3838
3939
40+ @pytest .fixture (name = "_logged_in_session" , autouse = True )
41+ def fixture_logged_in_session (
42+ logged_in_chrome_driver : WebDriver ,
43+ vws_credentials : VWSCredentials ,
44+ ) -> None :
45+ """Log in again if the shared session has expired.
46+
47+ ``logged_in_chrome_driver`` is module-scoped, so it logs in once and
48+ every test in the module shares that one session. A module which
49+ runs for longer than the session lasts leaves the later tests
50+ driving a logged-out browser, which surfaces as a timeout waiting
51+ for an element that is never going to appear. Load a page which
52+ needs a session before each test, and log in again if the portal
53+ sends the browser to the login page instead.
54+ """
55+ logged_in_chrome_driver .get (
56+ url = "https://developer.vuforia.com/develop/databases" ,
57+ )
58+ current_url = logged_in_chrome_driver .current_url
59+ if "/auth/login" in current_url : # pragma: no cover
60+ vws_web_tools .log_in (
61+ driver = logged_in_chrome_driver ,
62+ email_address = vws_credentials .email_address ,
63+ password = vws_credentials .password ,
64+ )
65+
66+
4067@pytest .fixture (name = "license_name" , scope = "module" )
4168def fixture_license_name (
4269 logged_in_chrome_driver : WebDriver ,
0 commit comments