diff --git a/ios/MullvadVPN.xcodeproj/project.pbxproj b/ios/MullvadVPN.xcodeproj/project.pbxproj index 16fa53b8293d..03de4dd1ab9a 100644 --- a/ios/MullvadVPN.xcodeproj/project.pbxproj +++ b/ios/MullvadVPN.xcodeproj/project.pbxproj @@ -2584,9 +2584,9 @@ 7A83C3FC2A55B39500DFB83A /* TestPlans */ = { isa = PBXGroup; children = ( - 7A02D4EA2A9CEC7A00C19E31 /* MullvadVPNScreenshots.xctestplan */, 7A83C3FE2A55B72E00DFB83A /* MullvadVPNApp.xctestplan */, 7A83C4002A55B81A00DFB83A /* MullvadVPNCI.xctestplan */, + 7A02D4EA2A9CEC7A00C19E31 /* MullvadVPNScreenshots.xctestplan */, ); path = TestPlans; sourceTree = ""; diff --git a/ios/MullvadVPN/Coordinators/AlertCoordinator.swift b/ios/MullvadVPN/Coordinators/AlertCoordinator.swift index 3dbdc59f7aa5..c06691e22230 100644 --- a/ios/MullvadVPN/Coordinators/AlertCoordinator.swift +++ b/ios/MullvadVPN/Coordinators/AlertCoordinator.swift @@ -39,7 +39,12 @@ final class AlertCoordinator: Coordinator, Presentable { } presentation.buttons.forEach { action in - alertController.addAction(title: action.title, style: action.style, handler: action.handler) + alertController.addAction( + title: action.title, + style: action.style, + accessibilityId: action.accessibilityID, + handler: action.handler + ) } } } diff --git a/ios/MullvadVPN/Coordinators/ChangeLogCoordinator.swift b/ios/MullvadVPN/Coordinators/ChangeLogCoordinator.swift index ae86829b1211..e55a31b13db7 100644 --- a/ios/MullvadVPN/Coordinators/ChangeLogCoordinator.swift +++ b/ios/MullvadVPN/Coordinators/ChangeLogCoordinator.swift @@ -38,6 +38,7 @@ final class ChangeLogCoordinator: Coordinator, Presentable { comment: "" ), style: .default, + accessibilityId: "OkButton", handler: { [weak self] in guard let self else { return } didFinish?(self) diff --git a/ios/MullvadVPN/View controllers/Alert/AlertPresentation.swift b/ios/MullvadVPN/View controllers/Alert/AlertPresentation.swift index 9fcaac842906..c09d0e1e72e5 100644 --- a/ios/MullvadVPN/View controllers/Alert/AlertPresentation.swift +++ b/ios/MullvadVPN/View controllers/Alert/AlertPresentation.swift @@ -17,6 +17,7 @@ struct AlertMetadata { struct AlertAction { let title: String let style: AlertActionStyle + var accessibilityID: String? var handler: (() -> Void)? } diff --git a/ios/MullvadVPN/View controllers/Alert/AlertViewController.swift b/ios/MullvadVPN/View controllers/Alert/AlertViewController.swift index 0a3fced6716f..bac96175b2a8 100644 --- a/ios/MullvadVPN/View controllers/Alert/AlertViewController.swift +++ b/ios/MullvadVPN/View controllers/Alert/AlertViewController.swift @@ -120,14 +120,15 @@ class AlertViewController: UIViewController { } } - func addAction(title: String, style: AlertActionStyle, handler: (() -> Void)? = nil) { + func addAction(title: String, style: AlertActionStyle, accessibilityId: String?, handler: (() -> Void)? = nil) { // The presence of a button should reset any custom button margin to default. containerView.directionalLayoutMargins.bottom = UIMetrics.CustomAlert.containerMargins.bottom let button = AppButton(style: style.buttonStyle) - button.addTarget(self, action: #selector(didTapButton), for: .touchUpInside) button.setTitle(title, for: .normal) + button.accessibilityIdentifier = accessibilityId + button.addTarget(self, action: #selector(didTapButton), for: .touchUpInside) containerView.addArrangedSubview(button) handler.flatMap { handlers[button] = $0 } diff --git a/ios/MullvadVPNScreenshots/MullvadVPNScreenshots.swift b/ios/MullvadVPNScreenshots/MullvadVPNScreenshots.swift index 4621728c32f9..0e050b872ddc 100644 --- a/ios/MullvadVPNScreenshots/MullvadVPNScreenshots.swift +++ b/ios/MullvadVPNScreenshots/MullvadVPNScreenshots.swift @@ -71,6 +71,7 @@ class MullvadVPNScreenshots: XCTestCase { if cityCell.exists { cityCell.tap() } else { + _ = countryCell.buttons["CollapseButton"].waitForExistence(timeout: 5) countryCell.buttons["CollapseButton"].tap() cityCell.tap() }