File tree Expand file tree Collapse file tree 4 files changed +21
-5
lines changed
UITestsFoundation/Screens/Login Expand file tree Collapse file tree 4 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ extension XCTestCase {
88 removeBeforeLaunching: Bool = false ,
99 crashOnCoreDataConcurrencyIssues: Bool = true
1010 ) {
11+ // To avoid handling 'Save Password' prompts after login.
12+ disableAutoFillPasswords ( )
13+
1114 // To ensure that the test starts with a new simulator launch each time
1215 app. terminate ( )
1316 super. setUp ( )
@@ -32,6 +35,24 @@ extension XCTestCase {
3235 systemAlertHandler ( alertTitle: " “WordPress” Would Like to Access Your Photos " , alertButton: alertButtonTitle)
3336 }
3437
38+ public func disableAutoFillPasswords( ) {
39+ let settings = XCUIApplication ( bundleIdentifier: " com.apple.Preferences " )
40+ settings. activate ( )
41+ settings. staticTexts [ " Passwords " ] . tap ( )
42+
43+ let enterPasscodeScreen = XCUIApplication ( bundleIdentifier: " com.apple.springboard " )
44+ enterPasscodeScreen. secureTextFields [ " Passcode field " ] . typeText ( " " )
45+ enterPasscodeScreen. buttons [ " done " ] . tap ( )
46+
47+ settings. staticTexts [ " Password Options " ] . tap ( )
48+
49+ let autoFillPasswordsSwitch = settings. switches [ " AutoFill Passwords " ]
50+ if autoFillPasswordsSwitch. value as? String == " 1 " {
51+ autoFillPasswordsSwitch. tap ( )
52+ }
53+ settings. terminate ( )
54+ }
55+
3556 public func takeScreenshotOfFailedTest( ) {
3657 guard let failuresCount = testRun? . failureCount, failuresCount > 0 else { return }
3758
Original file line number Diff line number Diff line change @@ -82,8 +82,6 @@ public class LoginUsernamePasswordScreen: ScreenObject {
8282 passwordTextField. typeText ( password)
8383 }
8484 nextButton. tap ( )
85-
86- app. dismissSavePasswordPrompt ( )
8785 }
8886
8987 private func dismissQuickStartPromptIfNeeded( ) throws {
Original file line number Diff line number Diff line change @@ -58,7 +58,6 @@ public class PasswordScreen: ScreenObject {
5858
5959 passwordTextField. typeText ( password)
6060 continueButton. tap ( )
61- app. dismissSavePasswordPrompt ( )
6261 }
6362
6463 @discardableResult
Original file line number Diff line number Diff line change @@ -24,8 +24,6 @@ public class PrologueScreen: ScreenObject {
2424 public func selectContinue( ) throws -> GetStartedScreen {
2525 continueButton. tap ( )
2626
27- app. dismissSavePasswordPrompt ( )
28-
2927 return try GetStartedScreen ( )
3028 }
3129
You can’t perform that action at this time.
0 commit comments