TeraTodayQualificationNavigation.swift (1021B)
1 import XCTest 2 3 @MainActor 4 enum TeraTodayQualificationNavigation { 5 static func unseenMarkers( 6 _ app: XCUIApplication, 7 feed: XCUIElement, 8 markers: [String], 9 maximumCards: Int 10 ) -> Set<String> { 11 var unseen = Set(markers) 12 guard (1 ... 15).contains(maximumCards) else { 13 XCTFail("The governed Today navigation card bound was invalid") 14 return unseen 15 } 16 // The closed fixture admits at most15 cards; AX5 rows span several screens. 17 // Observe every marker while traversing, without restarting for each one. 18 for forward in [true, false] { 19 for _ in 0 ..< maximumCards * 6 { 20 unseen = unseen.filter { marker in 21 !app.descendants(matching: .any).matching( 22 NSPredicate(format: "label CONTAINS %@", marker) 23 ).firstMatch.exists 24 } 25 if unseen.isEmpty { 26 return unseen 27 } 28 if forward { 29 feed.swipeUp() 30 } else { 31 feed.swipeDown() 32 } 33 } 34 } 35 return unseen 36 } 37 }