Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions WordPress/UITests/Utils/XCTest+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ public class LoginUsernamePasswordScreen: ScreenObject {
passwordTextField.typeText(password)
}
nextButton.tap()

app.dismissSavePasswordPrompt()
}

private func dismissQuickStartPromptIfNeeded() throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ public class PasswordScreen: ScreenObject {
public func proceedWithValidPassword() throws -> LoginEpilogueScreen {
try tryProceed(password: "pw")

app.dismissSavePasswordPrompt()

return try LoginEpilogueScreen()
}

Expand Down Expand Up @@ -60,7 +58,6 @@ public class PasswordScreen: ScreenObject {

passwordTextField.typeText(password)
continueButton.tap()
app.dismissSavePasswordPrompt()
}

@discardableResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ public class PrologueScreen: ScreenObject {
public func selectContinue() throws -> GetStartedScreen {
continueButton.tap()

app.dismissSavePasswordPrompt()

return try GetStartedScreen()
}

Expand Down