diff options
| author | Jon Petersson <jon.petersson@mullvad.net> | 2025-08-08 15:58:22 +0200 |
|---|---|---|
| committer | Jon Petersson <jon.petersson@mullvad.net> | 2025-08-18 12:31:20 +0200 |
| commit | 4d84a6bbe68ae1cdd9cf2b5f2a63b60ea70c17a2 (patch) | |
| tree | f440695f4fa3ef32d4e3ba669bc34952917f31ee /ios | |
| parent | 65e312df31734c93dc7232e67a616b8669559489 (diff) | |
| download | mullvadvpn-4d84a6bbe68ae1cdd9cf2b5f2a63b60ea70c17a2.tar.xz mullvadvpn-4d84a6bbe68ae1cdd9cf2b5f2a63b60ea70c17a2.zip | |
Fix nightly E2E tests
Diffstat (limited to 'ios')
14 files changed, 35 insertions, 21 deletions
diff --git a/ios/MullvadVPN/Classes/AccessbilityIdentifier.swift b/ios/MullvadVPN/Classes/AccessbilityIdentifier.swift index b7113fb11e..3819a755dd 100644 --- a/ios/MullvadVPN/Classes/AccessbilityIdentifier.swift +++ b/ios/MullvadVPN/Classes/AccessbilityIdentifier.swift @@ -186,7 +186,6 @@ public enum AccessibilityIdentifier: Equatable { case deleteAccountTextField case socks5AuthenticationSwitch case statusImageView - case deviceListView case deviceRemovalProgressView // DNS settings diff --git a/ios/MullvadVPN/Coordinators/Settings/APIAccess/List/ListAccessMethodView.swift b/ios/MullvadVPN/Coordinators/Settings/APIAccess/List/ListAccessMethodView.swift index f9786daa3f..85fad5fb75 100644 --- a/ios/MullvadVPN/Coordinators/Settings/APIAccess/List/ListAccessMethodView.swift +++ b/ios/MullvadVPN/Coordinators/Settings/APIAccess/List/ListAccessMethodView.swift @@ -48,6 +48,7 @@ struct ListAccessMethodView<ViewModel>: View where ViewModel: ListAccessViewMode ) { viewModel.addNewMethod() } + .accessibilityIdentifier(AccessibilityIdentifier.addAccessMethodButton.asString) .padding(.top, 24) }, content: { item in let accessibilityId: AccessibilityIdentifier? = switch item.id { @@ -89,7 +90,6 @@ struct ListAccessMethodView<ViewModel>: View where ViewModel: ListAccessViewMode $0 } } - .accessibilityIdentifier(AccessibilityIdentifier.addAccessMethodButton.asString) Spacer() } .background(Color.mullvadBackground) diff --git a/ios/MullvadVPN/View controllers/Account/AccountDeviceRow.swift b/ios/MullvadVPN/View controllers/Account/AccountDeviceRow.swift index a8643b4c76..72b4164a08 100644 --- a/ios/MullvadVPN/View controllers/Account/AccountDeviceRow.swift +++ b/ios/MullvadVPN/View controllers/Account/AccountDeviceRow.swift @@ -54,6 +54,7 @@ class AccountDeviceRow: UIView { string: title, attributes: attributes ) + button.setAccessibilityIdentifier(.deviceManagementButton) return button }() diff --git a/ios/MullvadVPN/View controllers/DeviceList/DeviceListView.swift b/ios/MullvadVPN/View controllers/DeviceList/DeviceListView.swift index 47d9c5fc87..cfdabe317a 100644 --- a/ios/MullvadVPN/View controllers/DeviceList/DeviceListView.swift +++ b/ios/MullvadVPN/View controllers/DeviceList/DeviceListView.swift @@ -55,7 +55,7 @@ struct DeviceListView: View { title: LocalizedStringKey(device.name), state: device.isCurrentDevice ? "Current device" : nil, detail: "Created: \(device.created.formatted(date: .long, time: .omitted))", - accessibilityIdentifier: AccessibilityIdentifier.deviceCellRemoveButton, + accessibilityIdentifier: .deviceCellRemoveButton, pressed: { onRemoveDevice?(device) } @@ -75,7 +75,7 @@ struct DeviceListView: View { ) } ) - .accessibilityIdentifier(.deviceListView) + .accessibilityIdentifier(.deviceManagementView) } } diff --git a/ios/MullvadVPN/View controllers/SelectLocation/LocationSectionHeaderFooterView.swift b/ios/MullvadVPN/View controllers/SelectLocation/LocationSectionHeaderFooterView.swift index c49e04efff..11a858a109 100644 --- a/ios/MullvadVPN/View controllers/SelectLocation/LocationSectionHeaderFooterView.swift +++ b/ios/MullvadVPN/View controllers/SelectLocation/LocationSectionHeaderFooterView.swift @@ -21,6 +21,7 @@ class LocationSectionHeaderFooterView: UITableViewHeaderFooterView { // Configure button button.setImage(UIImage(systemName: "ellipsis"), for: .normal) button.tintColor = UIColor(white: 1, alpha: 0.6) + button.accessibilityIdentifier = AccessibilityIdentifier.openCustomListsMenuButton.asString contentView.addConstrainedSubviews([label, button]) { label.pinEdgesToSuperviewMargins(.all().excluding(.trailing)) diff --git a/ios/MullvadVPN/Views/List/MullvadListActionItemView.swift b/ios/MullvadVPN/Views/List/MullvadListActionItemView.swift index 83d371a115..7b23305fd2 100644 --- a/ios/MullvadVPN/Views/List/MullvadListActionItemView.swift +++ b/ios/MullvadVPN/Views/List/MullvadListActionItemView.swift @@ -62,8 +62,8 @@ struct MullvadListActionItemView<Icon: View>: View { } label: { icon } - .padding(.leading, 8) .accessibilityIdentifier(accessibilityIdentifier) + .padding(.leading, 8) } } .padding(EdgeInsets( diff --git a/ios/MullvadVPNUITests/AccountTests.swift b/ios/MullvadVPNUITests/AccountTests.swift index 97d711ec50..9110c3dad6 100644 --- a/ios/MullvadVPNUITests/AccountTests.swift +++ b/ios/MullvadVPNUITests/AccountTests.swift @@ -77,7 +77,7 @@ class AccountTests: LoggedOutUITestCase { DeviceManagementPage(app) .verifyCurrentDeviceExists() - .verifyNoDeviceCanBeRemoved() + .verifyCurrentDeviceCannotBeRemoved() } func testRemoveOtherDevice() throws { @@ -172,7 +172,7 @@ class AccountTests: LoggedOutUITestCase { DeviceManagementPage(app) .waitForDeviceList() - .tapRemoveDeviceButton(cellIndex: 0) + .tapRemoveDeviceButton(cellIndex: 1) DeviceManagementLogOutDeviceConfirmationAlert(app) .tapYesLogOutDeviceButton() diff --git a/ios/MullvadVPNUITests/Base/BaseUITestCase.swift b/ios/MullvadVPNUITests/Base/BaseUITestCase.swift index ebae341a33..fe79d961b2 100644 --- a/ios/MullvadVPNUITests/Base/BaseUITestCase.swift +++ b/ios/MullvadVPNUITests/Base/BaseUITestCase.swift @@ -21,10 +21,13 @@ class BaseUITestCase: XCTestCase { /// The apps default country - the preselected country location after fresh install static let appDefaultCountry = "Sweden" - /// Default country to use in tests. + /// Default country to use in tests static let testsDefaultCountryName = "Sweden" static let testsDefaultCountryIdentifier = "se" + /// Default DAITA supported country to use in tests + static let testsDefaultDAITACountryName = "Relay Software Country" + /// Default city to use in tests static let testsDefaultCityName = "Gothenburg" static let testsDefaultCityIdentifier = "se-got" @@ -32,6 +35,7 @@ class BaseUITestCase: XCTestCase { /// Default relay to use in tests static let testsDefaultRelayName = "se-got-wg-001" + /// Default QUIC supported relay to use in tests static let testsDefaultQuicCountryName = "Ireland" static let testsDefaultQuicCityName = "Dublin" static let testsDefaultQuicRelayName = "ie-dub-wg-001" @@ -102,7 +106,7 @@ class BaseUITestCase: XCTestCase { /// Create temporary account without time. Will be created using partner API if token is configured, else falling back to app API func createTemporaryAccountWithoutTime() -> String { - if partnerApiToken != nil { + if let partnerApiToken, !partnerApiToken.isEmpty { let partnerAPIClient = PartnerAPIClient() return partnerAPIClient.createAccount() } else { diff --git a/ios/MullvadVPNUITests/Pages/APIAccessPage.swift b/ios/MullvadVPNUITests/Pages/APIAccessPage.swift index ca43cc91f3..a69643d106 100644 --- a/ios/MullvadVPNUITests/Pages/APIAccessPage.swift +++ b/ios/MullvadVPNUITests/Pages/APIAccessPage.swift @@ -23,7 +23,10 @@ class APIAccessPage: Page { } func getAccessMethodCells() -> [XCUIElement] { - app.collectionViews[AccessibilityIdentifier.apiAccessListView].buttons.allElementsBoundByIndex + var elements = app.collectionViews[AccessibilityIdentifier.apiAccessListView].buttons.allElementsBoundByIndex + elements.removeFirst() + elements.removeLast() + return elements } func getAccessMethodCell(accessibilityId: AccessibilityIdentifier) -> XCUIElement { diff --git a/ios/MullvadVPNUITests/Pages/DeviceManagementPage.swift b/ios/MullvadVPNUITests/Pages/DeviceManagementPage.swift index 622838a8a9..53a5c9236b 100644 --- a/ios/MullvadVPNUITests/Pages/DeviceManagementPage.swift +++ b/ios/MullvadVPNUITests/Pages/DeviceManagementPage.swift @@ -33,7 +33,7 @@ class DeviceManagementPage: Page { @discardableResult func waitForDeviceList() -> Self { XCTAssertTrue( app - .collectionViews[AccessibilityIdentifier.deviceListView] + .collectionViews[AccessibilityIdentifier.deviceManagementView] .waitForExistence(timeout: BaseUITestCase.longTimeout) ) @@ -63,12 +63,13 @@ class DeviceManagementPage: Page { return self } - @discardableResult public func verifyNoDeviceCanBeRemoved() -> Self { - XCTAssertTrue( - app - .buttons[AccessibilityIdentifier.deviceCellRemoveButton] - .waitForNonExistence(timeout: BaseUITestCase.defaultTimeout) - ) + @discardableResult public func verifyCurrentDeviceCannotBeRemoved() -> Self { + let cells = app.cells + let buttons = cells.buttons + + // Button count should equal the amount of cells, except for the cell that cannot + // be removed and the information text cell at the top of the page. + XCTAssertEqual(buttons.count, cells.count - 2) return self } diff --git a/ios/MullvadVPNUITests/Pages/TunnelControlPage.swift b/ios/MullvadVPNUITests/Pages/TunnelControlPage.swift index b671be2234..c591a39683 100644 --- a/ios/MullvadVPNUITests/Pages/TunnelControlPage.swift +++ b/ios/MullvadVPNUITests/Pages/TunnelControlPage.swift @@ -129,7 +129,6 @@ class TunnelControlPage: Page { @discardableResult func verifyConnectingOverTCPAfterUDPAttempts() -> Self { let connectionAttempts = waitForConnectionAttempts(3, timeout: 30) - // TODO: Revisit this when QUIC obfuscation is added // Should do three connection attempts but due to UI bug sometimes only two are displayed, sometimes all three if connectionAttempts.count == 3 { // Expected retries flow for (attemptIndex, attempt) in connectionAttempts.enumerated() { diff --git a/ios/MullvadVPNUITests/Pages/VPNSettingsPage.swift b/ios/MullvadVPNUITests/Pages/VPNSettingsPage.swift index 6ed78d2ce0..91b0e18c41 100644 --- a/ios/MullvadVPNUITests/Pages/VPNSettingsPage.swift +++ b/ios/MullvadVPNUITests/Pages/VPNSettingsPage.swift @@ -32,6 +32,7 @@ class VPNSettingsPage: Page { let expandButton = matchingCells.buttons[.expandButton] let lastCell = tableView.cells.allElementsBoundByIndex.last! tableView.scrollDownToElement(element: lastCell) + _ = expandButton.waitForExistence(timeout: BaseUITestCase.defaultTimeout) return expandButton } diff --git a/ios/MullvadVPNUITests/RelayTests.swift b/ios/MullvadVPNUITests/RelayTests.swift index 0decdb1b01..1e790b93e9 100644 --- a/ios/MullvadVPNUITests/RelayTests.swift +++ b/ios/MullvadVPNUITests/RelayTests.swift @@ -514,7 +514,7 @@ class RelayTests: LoggedInWithTimeUITestCase { .tapSelectLocationButton() SelectLocationPage(app) - .tapLocationCell(withName: BaseUITestCase.testsDefaultQuicCountryName) + .tapLocationCell(withName: BaseUITestCase.testsDefaultDAITACountryName) TunnelControlPage(app) .verifyConnectingUsingDAITA() diff --git a/ios/MullvadVPNUITests/SettingsMigrationTests.swift b/ios/MullvadVPNUITests/SettingsMigrationTests.swift index 64e631deb9..5c59aa398b 100644 --- a/ios/MullvadVPNUITests/SettingsMigrationTests.swift +++ b/ios/MullvadVPNUITests/SettingsMigrationTests.swift @@ -140,13 +140,18 @@ class SettingsMigrationTests: BaseUITestCase { .tapPort5001Cell() .tapPort80Cell() .tapBackButton() + VPNSettingsPage(app) .tapShadowsocksPortSelectorButton() + ShadowsocksObfuscationSettingsPage(app) .tapAutomaticPortCell() .tapCustomCell() .enterText("1234") .tapBackButton() + + VPNSettingsPage(app) + .tapWireGuardObfuscationUdpOverTcpCell() } func testVerifySettingsStillChanged() { @@ -170,12 +175,12 @@ class SettingsMigrationTests: BaseUITestCase { .tapBackButton() VPNSettingsPage(app) + .tapQuantumResistantTunnelExpandButton() + .verifyQuantumResistantTunnelOnSelected() .tapWireGuardPortsExpandButton() .verifyCustomWireGuardPortSelected(portNumber: wireGuardPort) .tapWireGuardObfuscationExpandButton() .verifyWireGuardObfuscationOnSelected() .verifyUDPOverTCPPort80Selected() - .tapQuantumResistantTunnelExpandButton() - .verifyQuantumResistantTunnelOnSelected() } } |
