diff options
| author | mojganii <mojgan.jelodar@codic.se> | 2024-10-07 17:17:48 +0200 |
|---|---|---|
| committer | Bug Magnet <marco.nikic@mullvad.net> | 2024-10-08 16:12:43 +0200 |
| commit | 8b1e180954e7a49a5d6e08dfd883d19cb9c9fd35 (patch) | |
| tree | 0504ff15f860d4f4785e00b3e64178bbe0c92938 /ios | |
| parent | ecd76bc08b4c5b30115cf585e8d140decd03acaa (diff) | |
| download | mullvadvpn-8b1e180954e7a49a5d6e08dfd883d19cb9c9fd35.tar.xz mullvadvpn-8b1e180954e7a49a5d6e08dfd883d19cb9c9fd35.zip | |
Add end-to-end test for multihop
Diffstat (limited to 'ios')
7 files changed, 73 insertions, 21 deletions
diff --git a/ios/MullvadVPN.xcodeproj/project.pbxproj b/ios/MullvadVPN.xcodeproj/project.pbxproj index 0cb01cf7d1..05f4a53e47 100644 --- a/ios/MullvadVPN.xcodeproj/project.pbxproj +++ b/ios/MullvadVPN.xcodeproj/project.pbxproj @@ -2361,13 +2361,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 014449932CA1B55200C0C2F2 /* EncryptedDnsProxy */ = { - isa = PBXGroup; - children = ( - ); - path = EncryptedDnsProxy; - sourceTree = "<group>"; - }; 062B45A228FD4C0F00746E77 /* Assets */ = { isa = PBXGroup; children = ( @@ -4191,7 +4184,6 @@ F0DC77A02B2223290087F09D /* Transport */ = { isa = PBXGroup; children = ( - 014449932CA1B55200C0C2F2 /* EncryptedDnsProxy */, F0164ED02B4F2DCB0020268D /* AccessMethodIterator.swift */, F0DC77A32B2315800087F09D /* Direct */, F0E5B2F62C9C689C0007F78C /* EncryptedDNS */, diff --git a/ios/MullvadVPN/Classes/AccessbilityIdentifier.swift b/ios/MullvadVPN/Classes/AccessbilityIdentifier.swift index b828221a88..95fc438805 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 937890579f..93b688d8a4 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 fc8a7fb76c..c7a3c8bc5f 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/TunnelControlPage.swift b/ios/MullvadVPNUITests/Pages/TunnelControlPage.swift index 56cf7f5709..cf90555e5a 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,13 @@ class TunnelControlPage: Page { return self } + /// Verify that the app attempts to connect over Multihop. + @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 +222,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 9b77ec4ded..2b2f8bcfe4 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 85e2b3767d..b000d2fe50 100644 --- a/ios/MullvadVPNUITests/RelayTests.swift +++ b/ios/MullvadVPNUITests/RelayTests.swift @@ -245,6 +245,43 @@ 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() + .tapBackButton() + + SettingsPage(app) + .tapDoneButton() + + 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) |
