From dd2051cded6e0af19cbea1b31e51ad4ba697469a Mon Sep 17 00:00:00 2001 From: Tiago Marques Date: Sat, 8 Jul 2023 03:17:53 -0300 Subject: [PATCH 1/2] Disable Auto Fill Passwords --- .../UITests/Utils/XCTest+Extensions.swift | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/WordPress/UITests/Utils/XCTest+Extensions.swift b/WordPress/UITests/Utils/XCTest+Extensions.swift index 0aa3e36dabc7..fafec54a8389 100644 --- a/WordPress/UITests/Utils/XCTest+Extensions.swift +++ b/WordPress/UITests/Utils/XCTest+Extensions.swift @@ -8,6 +8,9 @@ extension XCTestCase { removeBeforeLaunching: Bool = false, crashOnCoreDataConcurrencyIssues: Bool = true ) { + // To avoid handling 'Save Password' prompts after login. + disableAutoFillPasswords() + // To ensure that the test starts with a new simulator launch each time app.terminate() super.setUp() @@ -32,6 +35,24 @@ extension XCTestCase { systemAlertHandler(alertTitle: "“WordPress” Would Like to Access Your Photos", alertButton: alertButtonTitle) } + public func disableAutoFillPasswords() { + let settings = XCUIApplication(bundleIdentifier: "com.apple.Preferences") + settings.activate() + settings.staticTexts["Passwords"].tap() + + let enterPasscodeScreen = XCUIApplication(bundleIdentifier: "com.apple.springboard") + enterPasscodeScreen.secureTextFields["Passcode field"].typeText(" ") + enterPasscodeScreen.buttons["done"].tap() + + settings.staticTexts["Password Options"].tap() + + let autoFillPasswordsSwitch = settings.switches["AutoFill Passwords"] + if autoFillPasswordsSwitch.value as? String == "1" { + autoFillPasswordsSwitch.tap() + } + settings.terminate() + } + public func takeScreenshotOfFailedTest() { guard let failuresCount = testRun?.failureCount, failuresCount > 0 else { return } From 628f6e9b9b52c10afd1ed43d648ffadd3a3f1f95 Mon Sep 17 00:00:00 2001 From: Tiago Marques Date: Sat, 8 Jul 2023 03:21:24 -0300 Subject: [PATCH 2/2] Remove Save Password prompt dismiss --- .../Screens/Login/LoginUsernamePasswordScreen.swift | 2 -- .../Screens/Login/Unified/PasswordScreen.swift | 3 --- .../Screens/Login/Unified/PrologueScreen.swift | 2 -- 3 files changed, 7 deletions(-) diff --git a/WordPress/UITestsFoundation/Screens/Login/LoginUsernamePasswordScreen.swift b/WordPress/UITestsFoundation/Screens/Login/LoginUsernamePasswordScreen.swift index e4cad8fc1423..7d62d1cc14e9 100644 --- a/WordPress/UITestsFoundation/Screens/Login/LoginUsernamePasswordScreen.swift +++ b/WordPress/UITestsFoundation/Screens/Login/LoginUsernamePasswordScreen.swift @@ -86,8 +86,6 @@ public class LoginUsernamePasswordScreen: ScreenObject { passwordTextField.typeText(password) } nextButton.tap() - - app.dismissSavePasswordPrompt() } private func dismissQuickStartPromptIfNeeded() throws { diff --git a/WordPress/UITestsFoundation/Screens/Login/Unified/PasswordScreen.swift b/WordPress/UITestsFoundation/Screens/Login/Unified/PasswordScreen.swift index acfb9af7c8d1..feedfc1bb143 100644 --- a/WordPress/UITestsFoundation/Screens/Login/Unified/PasswordScreen.swift +++ b/WordPress/UITestsFoundation/Screens/Login/Unified/PasswordScreen.swift @@ -29,8 +29,6 @@ public class PasswordScreen: ScreenObject { public func proceedWithValidPassword() throws -> LoginEpilogueScreen { try tryProceed(password: "pw") - app.dismissSavePasswordPrompt() - return try LoginEpilogueScreen() } @@ -60,7 +58,6 @@ public class PasswordScreen: ScreenObject { passwordTextField.typeText(password) continueButton.tap() - app.dismissSavePasswordPrompt() } @discardableResult diff --git a/WordPress/UITestsFoundation/Screens/Login/Unified/PrologueScreen.swift b/WordPress/UITestsFoundation/Screens/Login/Unified/PrologueScreen.swift index 0553f0f62187..69910acb90f8 100644 --- a/WordPress/UITestsFoundation/Screens/Login/Unified/PrologueScreen.swift +++ b/WordPress/UITestsFoundation/Screens/Login/Unified/PrologueScreen.swift @@ -24,8 +24,6 @@ public class PrologueScreen: ScreenObject { public func selectContinue() throws -> GetStartedScreen { continueButton.tap() - app.dismissSavePasswordPrompt() - return try GetStartedScreen() }