Skip to content

Commit

Permalink
Update screenshots test to work with updated UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Petersson committed Aug 29, 2023
1 parent 314a03d commit 376779e
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ios/MullvadVPN.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2527,9 +2527,9 @@
7A83C3FC2A55B39500DFB83A /* TestPlans */ = {
isa = PBXGroup;
children = (
7A02D4EA2A9CEC7A00C19E31 /* MullvadVPNScreenshots.xctestplan */,
7A83C3FE2A55B72E00DFB83A /* MullvadVPNApp.xctestplan */,
7A83C4002A55B81A00DFB83A /* MullvadVPNCI.xctestplan */,
7A02D4EA2A9CEC7A00C19E31 /* MullvadVPNScreenshots.xctestplan */,
);
path = TestPlans;
sourceTree = "<group>";
Expand Down
7 changes: 6 additions & 1 deletion ios/MullvadVPN/Coordinators/AlertCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}
}
}
1 change: 1 addition & 0 deletions ios/MullvadVPN/Coordinators/ChangeLogCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ import Foundation
struct AlertAction {
let title: String
let style: AlertActionStyle
var accessibilityID: String?
var handler: (() -> Void)?
}

struct AlertPresentation: Identifiable {
let id = NSUUID()
let id = UUID()

var header: String?
var icon: AlertIcon?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
1 change: 1 addition & 0 deletions ios/MullvadVPNScreenshots/MullvadVPNScreenshots.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit 376779e

Please sign in to comment.