summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJon Petersson <jon.petersson@kvadrat.se>2023-08-29 11:16:56 +0200
committerBug Magnet <marco.nikic@mullvad.net>2023-09-20 09:22:03 +0200
commitb3b58ec8c49482d0bb6535e52544cfd8327fb766 (patch)
tree2a9c8b052e1b8dd516489e02c5220e86d0a61db7
parente2ce740995aaf7175852475daba1fd73c0a54a0d (diff)
downloadmullvadvpn-b3b58ec8c49482d0bb6535e52544cfd8327fb766.tar.xz
mullvadvpn-b3b58ec8c49482d0bb6535e52544cfd8327fb766.zip
Update screenshots test to work with updated UI
-rw-r--r--ios/MullvadVPN.xcodeproj/project.pbxproj2
-rw-r--r--ios/MullvadVPN/Coordinators/AccountCoordinator.swift1
-rw-r--r--ios/MullvadVPN/Coordinators/AlertCoordinator.swift7
-rw-r--r--ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift7
-rw-r--r--ios/MullvadVPN/Coordinators/ChangeLogCoordinator.swift1
-rw-r--r--ios/MullvadVPN/Operations/PresentAlertOperation.swift59
-rw-r--r--ios/MullvadVPN/View controllers/Alert/AlertPresentation.swift1
-rw-r--r--ios/MullvadVPN/View controllers/Alert/AlertViewController.swift5
-rw-r--r--ios/MullvadVPNScreenshots/MullvadVPNScreenshots.swift1
9 files changed, 14 insertions, 70 deletions
diff --git a/ios/MullvadVPN.xcodeproj/project.pbxproj b/ios/MullvadVPN.xcodeproj/project.pbxproj
index 16fa53b829..03de4dd1ab 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 = "<group>";
diff --git a/ios/MullvadVPN/Coordinators/AccountCoordinator.swift b/ios/MullvadVPN/Coordinators/AccountCoordinator.swift
index 4202a0076c..0338d7427b 100644
--- a/ios/MullvadVPN/Coordinators/AccountCoordinator.swift
+++ b/ios/MullvadVPN/Coordinators/AccountCoordinator.swift
@@ -136,6 +136,7 @@ final class AccountCoordinator: Coordinator, Presentable, Presenting {
let presentation = AlertPresentation(
id: "account-logout-alert",
icon: .spinner,
+ message: nil,
buttons: []
)
diff --git a/ios/MullvadVPN/Coordinators/AlertCoordinator.swift b/ios/MullvadVPN/Coordinators/AlertCoordinator.swift
index 3dbdc59f7a..c06691e222 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/ApplicationCoordinator.swift b/ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift
index e6ede7a06c..7f6cb1d474 100644
--- a/ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift
+++ b/ios/MullvadVPN/Coordinators/ApplicationCoordinator.swift
@@ -1008,10 +1008,3 @@ fileprivate extension AppPreferencesDataSource {
// swiftlint:disable:next file_length
}
-
-private protocol Poppable: Presentable {
- func popFromNavigationStack(
- animated: Bool,
- completion: () -> Void
- )
-}
diff --git a/ios/MullvadVPN/Coordinators/ChangeLogCoordinator.swift b/ios/MullvadVPN/Coordinators/ChangeLogCoordinator.swift
index ae86829b12..e55a31b13d 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/Operations/PresentAlertOperation.swift b/ios/MullvadVPN/Operations/PresentAlertOperation.swift
deleted file mode 100644
index cd6f5b02c2..0000000000
--- a/ios/MullvadVPN/Operations/PresentAlertOperation.swift
+++ /dev/null
@@ -1,59 +0,0 @@
-//
-// PresentAlertOperation.swift
-// MullvadVPN
-//
-// Created by pronebird on 06/09/2021.
-// Copyright © 2021 Mullvad VPN AB. All rights reserved.
-//
-
-import Operations
-import UIKit
-
-final class PresentAlertOperation: AsyncOperation {
- private let alertController: AlertViewController
- private let presentingController: UIViewController
- private let presentCompletion: (() -> Void)?
-
- init(
- alertController: AlertViewController,
- presentingController: UIViewController,
- presentCompletion: (() -> Void)? = nil
- ) {
- self.alertController = alertController
- self.presentingController = presentingController
- self.presentCompletion = presentCompletion
-
- super.init(dispatchQueue: .main)
- }
-
- override func operationDidCancel() {
- // Guard against trying to dismiss the alert when operation hasn't started yet.
- guard isExecuting else { return }
-
- // Guard against dismissing controller during transition.
- if !alertController.isBeingPresented, !alertController.isBeingDismissed {
- dismissAndFinish()
- }
- }
-
- override func main() {
- alertController.didDismiss = { [weak self] in
- self?.finish()
- }
-
- presentingController.present(alertController, animated: true) {
- self.presentCompletion?()
-
- // Alert operation was cancelled during transition?
- if self.isCancelled {
- self.dismissAndFinish()
- }
- }
- }
-
- private func dismissAndFinish() {
- alertController.dismiss(animated: false) {
- self.finish()
- }
- }
-}
diff --git a/ios/MullvadVPN/View controllers/Alert/AlertPresentation.swift b/ios/MullvadVPN/View controllers/Alert/AlertPresentation.swift
index 9fcaac8429..c09d0e1e72 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 0a3fced671..bac96175b2 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 4621728c32..0e050b872d 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()
}