|
| 1 | +// |
| 2 | +// ScreenshotTests.swift |
| 3 | +// MullvadVPNScreenshots |
| 4 | +// |
| 5 | +// Created by Jon Petersson on 2024-05-28. |
| 6 | +// Copyright © 2024 Mullvad VPN AB. All rights reserved. |
| 7 | +// |
| 8 | + |
| 9 | +import XCTest |
| 10 | + |
| 11 | +class ScreenshotTests: BaseUITestCase { |
| 12 | + override func setUp() { |
| 13 | + setupSnapshot(app, waitForAnimations: false) |
| 14 | + |
| 15 | + let argumentsJsonString = try? LaunchArguments( |
| 16 | + target: .screenshots, |
| 17 | + areAnimationsDisabled: true |
| 18 | + ).toJSON() |
| 19 | + app.launchEnvironment[LaunchArguments.tag] = argumentsJsonString |
| 20 | + |
| 21 | + super.setUp() |
| 22 | + |
| 23 | + agreeToTermsOfServiceIfShown() |
| 24 | + dismissChangeLogIfShown() |
| 25 | + |
| 26 | + if !isLoggedIn() { |
| 27 | + login(accountNumber: hasTimeAccountNumber) |
| 28 | + } |
| 29 | + |
| 30 | + if TunnelControlPage(app).connectionIsSecured { |
| 31 | + TunnelControlPage(app) |
| 32 | + .tapDisconnectButton() |
| 33 | + } |
| 34 | + } |
| 35 | + |
| 36 | + func testTakeScreenshotOfSecuredConnection() throws { |
| 37 | + TunnelControlPage(app) |
| 38 | + .tapSelectLocationButton() |
| 39 | + |
| 40 | + SelectLocationPage(app) |
| 41 | + .tapLocationCell(withName: "Sweden") |
| 42 | + |
| 43 | + TunnelControlPage(app) |
| 44 | + .waitForSecureConnectionLabel() |
| 45 | + |
| 46 | + snapshot("ConnectionSecured") |
| 47 | + } |
| 48 | + |
| 49 | + func testTakeScreenshotOfQuantumSecuredConnection() throws { |
| 50 | + addTeardownBlock { |
| 51 | + HeaderBar(self.app) |
| 52 | + .tapSettingsButton() |
| 53 | + |
| 54 | + SettingsPage(self.app) |
| 55 | + .tapVPNSettingsCell() |
| 56 | + |
| 57 | + VPNSettingsPage(self.app) |
| 58 | + .tapQuantumResistantTunnelExpandButton() |
| 59 | + .tapQuantumResistantTunnelOnCell() |
| 60 | + } |
| 61 | + |
| 62 | + HeaderBar(app) |
| 63 | + .tapSettingsButton() |
| 64 | + |
| 65 | + SettingsPage(app) |
| 66 | + .tapVPNSettingsCell() |
| 67 | + |
| 68 | + VPNSettingsPage(app) |
| 69 | + .tapQuantumResistantTunnelExpandButton() |
| 70 | + .tapQuantumResistantTunnelOnCell() |
| 71 | + .tapBackButton() |
| 72 | + |
| 73 | + SettingsPage(app) |
| 74 | + .tapDoneButton() |
| 75 | + |
| 76 | + TunnelControlPage(app) |
| 77 | + .tapSelectLocationButton() |
| 78 | + |
| 79 | + SelectLocationPage(app) |
| 80 | + .tapLocationCell(withName: "Sweden") |
| 81 | + |
| 82 | + TunnelControlPage(app) |
| 83 | + .waitForSecureConnectionLabel() |
| 84 | + |
| 85 | + snapshot("QuantumConnectionSecured") |
| 86 | + } |
| 87 | + |
| 88 | + func testTakeScreenshotOfCustomListSelected() throws { |
| 89 | + TunnelControlPage(app) |
| 90 | + .tapSelectLocationButton() |
| 91 | + |
| 92 | + SelectLocationPage(app) |
| 93 | + .tapWhereStatusBarShouldBeToScrollToTopMostPosition() |
| 94 | + .tapCustomListEllipsisButton() |
| 95 | + .tapAddNewCustomList() |
| 96 | + |
| 97 | + CustomListPage(app) |
| 98 | + .renameCustomList(name: "Low latency locations") |
| 99 | + .addOrEditLocations() |
| 100 | + |
| 101 | + EditCustomListLocationsPage(app) |
| 102 | + .scrollToLocationWith(identifier: "se") |
| 103 | + .unfoldLocationwith(identifier: "se") |
| 104 | + .unfoldLocationwith(identifier: "se-got") |
| 105 | + .toggleLocationCheckmarkWith(identifier: "se-got-wg-101") |
| 106 | + .scrollToLocationWith(identifier: "de") |
| 107 | + .unfoldLocationwith(identifier: "de") |
| 108 | + .toggleLocationCheckmarkWith(identifier: "de-ber") |
| 109 | + .scrollToLocationWith(identifier: "fi") |
| 110 | + .toggleLocationCheckmarkWith(identifier: "fi") |
| 111 | + .tapBackButton(action: .add) |
| 112 | + |
| 113 | + CustomListPage(app) |
| 114 | + .tapCreateListButton() |
| 115 | + |
| 116 | + SelectLocationPage(app) |
| 117 | + .tapLocationCell(withName: "Low latency locations") |
| 118 | + |
| 119 | + TunnelControlPage(app) |
| 120 | + .tapSelectLocationButton() |
| 121 | + |
| 122 | + SelectLocationPage(app) |
| 123 | + .tapLocationCellExpandButton(withName: "Low latency locations") |
| 124 | + |
| 125 | + snapshot("CustomListSelected") |
| 126 | + } |
| 127 | + |
| 128 | + func testTakeScreenshotOfRelayFilter() throws { |
| 129 | + TunnelControlPage(app) |
| 130 | + .tapSelectLocationButton() |
| 131 | + |
| 132 | + SelectLocationPage(app) |
| 133 | + .tapFilterButton() |
| 134 | + |
| 135 | + SelectLocationFilterPage(app) |
| 136 | + .tapOwnershipCellExpandButton() |
| 137 | + .tapProvidersCellExpandButton() |
| 138 | + |
| 139 | + snapshot("RelayFilter") |
| 140 | + } |
| 141 | + |
| 142 | + func testTakeScreenshotOfVPNSettings() throws { |
| 143 | + HeaderBar(app) |
| 144 | + .tapSettingsButton() |
| 145 | + |
| 146 | + SettingsPage(app) |
| 147 | + .tapVPNSettingsCell() |
| 148 | + |
| 149 | + snapshot("VPNSettings") |
| 150 | + } |
| 151 | + |
| 152 | + func testTakeScreenshotOfDNSSettings() throws { |
| 153 | + addTeardownBlock { |
| 154 | + DNSSettingsPage(self.app) |
| 155 | + .tapBlockAdsSwitch() |
| 156 | + .tapBlockTrackerSwitch() |
| 157 | + .tapBlockMalwareSwitch() |
| 158 | + .tapBlockAdultContentSwitch() |
| 159 | + .tapBlockGamblingSwitch() |
| 160 | + .tapBlockSocialMediaSwitch() |
| 161 | + } |
| 162 | + |
| 163 | + HeaderBar(app) |
| 164 | + .tapSettingsButton() |
| 165 | + |
| 166 | + SettingsPage(app) |
| 167 | + .tapVPNSettingsCell() |
| 168 | + |
| 169 | + VPNSettingsPage(app) |
| 170 | + .tapDNSSettingsCell() |
| 171 | + |
| 172 | + DNSSettingsPage(app) |
| 173 | + .tapDNSContentBlockersHeaderExpandButton() |
| 174 | + .tapBlockAdsSwitch() |
| 175 | + .tapBlockTrackerSwitch() |
| 176 | + .tapBlockMalwareSwitch() |
| 177 | + .tapBlockAdultContentSwitch() |
| 178 | + .tapBlockGamblingSwitch() |
| 179 | + .tapBlockSocialMediaSwitch() |
| 180 | + |
| 181 | + snapshot("DNSSettings") |
| 182 | + } |
| 183 | + |
| 184 | + func testTakeScreenshotOfAccount() throws { |
| 185 | + HeaderBar(app) |
| 186 | + .tapAccountButton() |
| 187 | + |
| 188 | + snapshot("Account") |
| 189 | + } |
| 190 | +} |
0 commit comments