@@ -358,7 +358,7 @@ class RealBackendTestCase: ShellTestCase {
358358 screenshot ( " j10-relaunched " )
359359
360360 guard signOut else {
361- note ( " sign-out skipped: it would end the session the secret holds " )
361+ note ( " sign-out skipped: it would end the session the secret holds (video input real_sign_out runs it) " )
362362 return
363363 }
364364 // Sign out from the web app's own menu: on production the drawer (its sidebar toggle), then
@@ -367,13 +367,21 @@ class RealBackendTestCase: ShellTestCase {
367367 webElement ( app , label : " Show sidebar " ) . tap ( )
368368 sleep ( 2 )
369369 }
370- let screen = app . windows . firstMatch . frame
371- let candidates = ( app . webViews . popUpButtons . allElementsBoundByIndex + app . webViews . buttons . allElementsBoundByIndex )
372- . filter { $0 . exists && $0 . frame . midX < 80 && $0 . frame . midY > screen . height * 0.7 && $0 . frame . height > 10 }
373- . sorted { $0 . frame . midY > $1 . frame . midY }
370+ // Production's account button is not exposed as a button: look at anything in the drawer's
371+ // bottom-left corner, and failing that tap where its avatar sits.
372+ let web = app . webViews . firstMatch
373+ let area = web . frame
374+ let corner = web . descendants ( matching : . any ) . allElementsBoundByIndex . prefix ( 600 ) . filter { element in
375+ guard element . exists else { return false }
376+ let frame = element . frame
377+ return frame . width > 12 && frame . width < 220 && frame . height > 12 && frame . height < 80
378+ && frame . midX < area . minX + 70 && frame . midY > area . minY + area . height * 0.8
379+ } . sorted { $0 . frame . midY > $1 . frame . midY }
374380 var signedOut = false
375- for candidate in candidates . prefix ( 3 ) where candidate . isHittable {
376- candidate . tap ( )
381+ var attempts : [ ( ) -> Void ] = corner . prefix ( 3 ) . map { element in { element . tap ( ) } }
382+ attempts . append { web . coordinate ( withNormalizedOffset : CGVector ( dx : 24 / max ( area . width , 1 ) , dy : 0.94 ) ) . tap ( ) }
383+ for attempt in attempts {
384+ attempt ( )
377385 let item = webElement ( app , label : " Sign out " )
378386 if item . waitForExistence ( timeout : 3 ) {
379387 screenshot ( " j11-account-menu " )
@@ -523,7 +531,9 @@ final class RealBackendDebugUITests: RealBackendTestCase {
523531 XCTFail ( " production rejected the session cookie (it may be stale or copied wrong) " )
524532 return
525533 }
526- realSignedInJourney ( app , relaunch : { self . launch ( base : nil , moment : " relaunch " , reset : false ) } , signOut : false )
534+ // Signing out ends the session the secret holds: only when asked (video input real_sign_out).
535+ let signOut = ProcessInfo . processInfo . environment [ " OPENBOT_SHELL_REAL_SIGN_OUT " ] == " 1 "
536+ realSignedInJourney ( app , relaunch : { self . launch ( base : nil , moment : " relaunch " , reset : false ) } , signOut : signOut )
527537 }
528538
529539 /// The hosted sign-in in the system sheet, without credentials: what is reachable there.
0 commit comments