diff --git a/ios/MullvadVPN/Classes/AccessbilityIdentifier.swift b/ios/MullvadVPN/Classes/AccessbilityIdentifier.swift index b828221a8863..95fc4388054a 100644 --- a/ios/MullvadVPN/Classes/AccessbilityIdentifier.swift +++ b/ios/MullvadVPN/Classes/AccessbilityIdentifier.swift @@ -21,7 +21,6 @@ public enum AccessibilityIdentifier: String { case appLogsShareButton case applyButton case cancelButton - case connectionPanelButton case continueWithLoginButton case collapseButton case expandButton diff --git a/ios/MullvadVPN/View controllers/Tunnel/ConnectionPanelView.swift b/ios/MullvadVPN/View controllers/Tunnel/ConnectionPanelView.swift index 937890579f69..93b688d8a4e5 100644 --- a/ios/MullvadVPN/View controllers/Tunnel/ConnectionPanelView.swift +++ b/ios/MullvadVPN/View controllers/Tunnel/ConnectionPanelView.swift @@ -48,13 +48,14 @@ class ConnectionPanelView: UIView { } private let collapseView: ConnectionPanelCollapseView = { - let button = ConnectionPanelCollapseView() - button.axis = .horizontal - button.alignment = .top - button.distribution = .fill - button.translatesAutoresizingMaskIntoConstraints = false - button.tintColor = .white - return button + let collapseView = ConnectionPanelCollapseView() + collapseView.axis = .horizontal + collapseView.alignment = .top + collapseView.distribution = .fill + collapseView.translatesAutoresizingMaskIntoConstraints = false + collapseView.tintColor = .white + collapseView.isAccessibilityElement = false + return collapseView }() private let inAddressRow = ConnectionPanelAddressRow() @@ -316,8 +317,6 @@ class ConnectionPanelCollapseView: UIStackView { addArrangedSubview(UIView()) // Pushes content left. updateImage() - - accessibilityIdentifier = .connectionPanelButton } required init(coder: NSCoder) { diff --git a/ios/MullvadVPN/View controllers/Tunnel/TunnelControlView.swift b/ios/MullvadVPN/View controllers/Tunnel/TunnelControlView.swift index fc8a7fb76c21..c7a3c8bc5fb9 100644 --- a/ios/MullvadVPN/View controllers/Tunnel/TunnelControlView.swift +++ b/ios/MullvadVPN/View controllers/Tunnel/TunnelControlView.swift @@ -44,7 +44,7 @@ final class TunnelControlView: UIView { private let locationContainerView: UIStackView = { let view = UIStackView() view.translatesAutoresizingMaskIntoConstraints = false - view.isAccessibilityElement = true + view.isAccessibilityElement = false view.accessibilityTraits = .summaryElement view.axis = .vertical view.spacing = 8 diff --git a/ios/MullvadVPNUITests/Pages/SelectLocationPage.swift b/ios/MullvadVPNUITests/Pages/SelectLocationPage.swift index db401a0305c7..45a13ed17b40 100644 --- a/ios/MullvadVPNUITests/Pages/SelectLocationPage.swift +++ b/ios/MullvadVPNUITests/Pages/SelectLocationPage.swift @@ -13,7 +13,7 @@ class SelectLocationPage: Page { @discardableResult override init(_ app: XCUIApplication) { super.init(app) - self.pageElement = app.otherElements[.selectLocationView] + self.pageElement = app.otherElements[.selectLocationViewWrapper] waitForPageToBeShown() } diff --git a/ios/MullvadVPNUITests/Pages/TunnelControlPage.swift b/ios/MullvadVPNUITests/Pages/TunnelControlPage.swift index 56cf7f5709b1..b0b44295162f 100644 --- a/ios/MullvadVPNUITests/Pages/TunnelControlPage.swift +++ b/ios/MullvadVPNUITests/Pages/TunnelControlPage.swift @@ -121,7 +121,7 @@ class TunnelControlPage: Page { } @discardableResult func tapRelayStatusExpandCollapseButton() -> Self { - app.buttons[AccessibilityIdentifier.relayStatusCollapseButton].tap() + app.otherElements[AccessibilityIdentifier.relayStatusCollapseButton].press(forDuration: .leastNonzeroMagnitude) return self } @@ -202,6 +202,21 @@ class TunnelControlPage: Page { return self } + /// Verify that the app attempts to connect over Diata. + @discardableResult func verifyConnectingOverDaita() -> Self { + let relayName = getCurrentRelayName().lowercased() + let elements = relayName.components(separatedBy: .whitespacesAndNewlines) + XCTAssertTrue(elements.contains("daita")) + return self + } + + /// Verify that the app attempts to connect over Diata. + @discardableResult func verifyConnectingOverMultihop() -> Self { + let relayName = getCurrentRelayName().lowercased() + XCTAssertTrue(relayName.contains("via")) + return self + } + func getInIPAddressFromConnectionStatus() -> String { let inAddressRow = app.otherElements[AccessibilityIdentifier.connectionPanelInAddressRow] @@ -215,7 +230,7 @@ class TunnelControlPage: Page { } func getCurrentRelayName() -> String { - let relayExpandButton = app.buttons[.relayStatusCollapseButton] + let relayExpandButton = app.otherElements[.relayStatusCollapseButton] guard let relayName = relayExpandButton.value as? String else { XCTFail("Failed to read relay name from tunnel control page") diff --git a/ios/MullvadVPNUITests/Pages/VPNSettingsPage.swift b/ios/MullvadVPNUITests/Pages/VPNSettingsPage.swift index 9b77ec4ded87..2b2f8bcfe45a 100644 --- a/ios/MullvadVPNUITests/Pages/VPNSettingsPage.swift +++ b/ios/MullvadVPNUITests/Pages/VPNSettingsPage.swift @@ -205,4 +205,22 @@ class VPNSettingsPage: Page { XCTAssertEqual(switchValue, "1") return self } + + @discardableResult func tapDaitaSwitchIfOn() -> Self { + let switchElement = app.cells[.daitaSwitch].switches[AccessibilityIdentifier.customSwitch] + + if switchElement.value as? String == "1" { + tapDaitaSwitch() + } + return self + } + + @discardableResult func tapMultihopSwitchIfOn() -> Self { + let switchElement = app.cells[.multihopSwitch].switches[AccessibilityIdentifier.customSwitch] + + if switchElement.value as? String == "1" { + tapMultihopSwitch() + } + return self + } } diff --git a/ios/MullvadVPNUITests/RelayTests.swift b/ios/MullvadVPNUITests/RelayTests.swift index 85e2b3767d44..1651fcced9b9 100644 --- a/ios/MullvadVPNUITests/RelayTests.swift +++ b/ios/MullvadVPNUITests/RelayTests.swift @@ -245,6 +245,40 @@ class RelayTests: LoggedInWithTimeUITestCase { .tapDisconnectButton() } + func testMultihopSettings() throws { + // Undo enabling Multihop in teardown + addTeardownBlock { + HeaderBar(self.app) + .tapSettingsButton() + + SettingsPage(self.app) + .tapVPNSettingsCell() + + VPNSettingsPage(self.app) + .tapMultihopSwitchIfOn() + } + + HeaderBar(app) + .tapSettingsButton() + + SettingsPage(app) + .tapVPNSettingsCell() + + VPNSettingsPage(app) + .tapMultihopSwitch() + .swipeDownToDismissModal() + + TunnelControlPage(app) + .tapSecureConnectionButton() + + allowAddVPNConfigurationsIfAsked() + + TunnelControlPage(app) + .waitForSecureConnectionLabel() + .verifyConnectingOverMultihop() + .tapDisconnectButton() + } + /// Connect to a relay in the default country and city, get name and IP address of the relay the app successfully connects to. Assumes user is logged on and at tunnel control page. private func getDefaultRelayInfo() -> RelayInfo { TunnelControlPage(app)