File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -35,10 +35,19 @@ class FirstTimePage: PageModel {
3535 app. buttons [ Locators . FirstTimePage. okButton. rawValue]
3636 }
3737
38+ var savePasswordSheet : XCUIElement {
39+ app. staticTexts [ " Save Password? " ]
40+ }
41+
42+ var notNowOptionOnSavePasswordSheet : XCUIElement {
43+ app. buttons [ " Not Now " ]
44+ }
45+
3846 var handler : ( XCTestCase , any NSObjectProtocol ) ?
3947
4048 // Tap OK button on first time using Wire popup
4149 func acceptFirstTimeAlert( ) -> FirstTimePage {
50+ dismissSavePasswordAlertIfPresent ( )
4251 okButton. tap ( )
4352 return self
4453 }
@@ -65,4 +74,11 @@ class FirstTimePage: PageModel {
6574 }
6675 self . handler = ( testCase, handler)
6776 }
77+
78+ private func dismissSavePasswordAlertIfPresent( ) {
79+ if savePasswordSheet. waitForExistence ( timeout: 2 ) {
80+ notNowOptionOnSavePasswordSheet. tap ( )
81+ _ = savePasswordSheet. waitToDisappear ( timeout: 2 )
82+ }
83+ }
6884}
Original file line number Diff line number Diff line change @@ -35,4 +35,13 @@ extension XCUIElement {
3535 }
3636 return self
3737 }
38+
39+ @discardableResult
40+ func waitToDisappear( timeout: TimeInterval = 2 ) -> Bool {
41+ let exp = XCTNSPredicateExpectation (
42+ predicate: NSPredicate ( format: " exists == false " ) ,
43+ object: self
44+ )
45+ return XCTWaiter ( ) . wait ( for: [ exp] , timeout: timeout) == . completed
46+ }
3847}
You canβt perform that action at this time.
0 commit comments