Skip to content

Commit 8b1d1db

Browse files
fix: handle save password bottom sheet - WPB-21181 πŸ’ (#3757)
Co-authored-by: Manish Singh <[email protected]>
1 parent 05e2ff8 commit 8b1d1db

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

β€Žwire-ios/WireUITests/Pages/FirstTimePage.swiftβ€Ž

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

β€Žwire-ios/WireUITests/XCUIElement+Additions.swiftβ€Ž

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
Β (0)