Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update screenshots test to work with updated UI #5061

Merged
merged 2 commits into from
Sep 20, 2023
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
2 changes: 1 addition & 1 deletion ios/MullvadVPN.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>";
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 @@ -17,6 +17,7 @@ struct AlertMetadata {
struct AlertAction {
let title: String
let style: AlertActionStyle
var accessibilityID: String?
var handler: (() -> Void)?
}

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
Loading