-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite screenshot tests to use new syntax
- Loading branch information
Jon Petersson
committed
May 29, 2024
1 parent
2211f28
commit 640ead4
Showing
8 changed files
with
230 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
// | ||
// ScreenshotTests.swift | ||
// MullvadVPNScreenshots | ||
// | ||
// Created by Jon Petersson on 2024-05-28. | ||
// Copyright © 2024 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
|
||
class ScreenshotTests: BaseUITestCase { | ||
override func setUp() { | ||
setupSnapshot(app, waitForAnimations: false) | ||
|
||
let argumentsJsonString = try? LaunchArguments( | ||
target: .screenshots, | ||
areAnimationsDisabled: true | ||
).toJSON() | ||
app.launchEnvironment[LaunchArguments.tag] = argumentsJsonString | ||
|
||
super.setUp() | ||
|
||
agreeToTermsOfServiceIfShown() | ||
dismissChangeLogIfShown() | ||
|
||
if !isLoggedIn() { | ||
login(accountNumber: hasTimeAccountNumber) | ||
} | ||
|
||
if TunnelControlPage(app).connectionIsSecured { | ||
TunnelControlPage(app) | ||
.tapDisconnectButton() | ||
} | ||
} | ||
|
||
func testTakeScreenshotOfSecuredConnection() throws { | ||
TunnelControlPage(app) | ||
.tapSelectLocationButton() | ||
|
||
SelectLocationPage(app) | ||
.tapLocationCell(withName: "Sweden") | ||
|
||
TunnelControlPage(app) | ||
.waitForSecureConnectionLabel() | ||
|
||
snapshot("ConnectionSecured") | ||
} | ||
|
||
func testTakeScreenshotOfQuantumSecuredConnection() throws { | ||
addTeardownBlock { | ||
HeaderBar(self.app) | ||
.tapSettingsButton() | ||
|
||
SettingsPage(self.app) | ||
.tapVPNSettingsCell() | ||
|
||
VPNSettingsPage(self.app) | ||
.tapQuantumResistantTunnelExpandButton() | ||
.tapQuantumResistantTunnelOnCell() | ||
} | ||
|
||
HeaderBar(app) | ||
.tapSettingsButton() | ||
|
||
SettingsPage(app) | ||
.tapVPNSettingsCell() | ||
|
||
VPNSettingsPage(app) | ||
.tapQuantumResistantTunnelExpandButton() | ||
.tapQuantumResistantTunnelOnCell() | ||
.tapBackButton() | ||
|
||
SettingsPage(app) | ||
.tapDoneButton() | ||
|
||
TunnelControlPage(app) | ||
.tapSelectLocationButton() | ||
|
||
SelectLocationPage(app) | ||
.tapLocationCell(withName: "Sweden") | ||
|
||
TunnelControlPage(app) | ||
.waitForSecureConnectionLabel() | ||
|
||
snapshot("QuantumConnectionSecured") | ||
} | ||
|
||
func testTakeScreenshotOfCustomListSelected() throws { | ||
TunnelControlPage(app) | ||
.tapSelectLocationButton() | ||
|
||
SelectLocationPage(app) | ||
.tapWhereStatusBarShouldBeToScrollToTopMostPosition() | ||
.tapCustomListEllipsisButton() | ||
.tapAddNewCustomList() | ||
|
||
CustomListPage(app) | ||
.renameCustomList(name: "Low latency locations") | ||
.addOrEditLocations() | ||
|
||
EditCustomListLocationsPage(app) | ||
.scrollToLocationWith(identifier: "se") | ||
.unfoldLocationwith(identifier: "se") | ||
.unfoldLocationwith(identifier: "se-got") | ||
.toggleLocationCheckmarkWith(identifier: "se-got-wg-101") | ||
.scrollToLocationWith(identifier: "de") | ||
.unfoldLocationwith(identifier: "de") | ||
.toggleLocationCheckmarkWith(identifier: "de-ber") | ||
.scrollToLocationWith(identifier: "fi") | ||
.toggleLocationCheckmarkWith(identifier: "fi") | ||
.tapBackButton(action: .add) | ||
|
||
CustomListPage(app) | ||
.tapCreateListButton() | ||
|
||
SelectLocationPage(app) | ||
.tapLocationCell(withName: "Low latency locations") | ||
|
||
TunnelControlPage(app) | ||
.tapSelectLocationButton() | ||
|
||
SelectLocationPage(app) | ||
.tapLocationCellExpandButton(withName: "Low latency locations") | ||
|
||
snapshot("CustomListSelected") | ||
} | ||
|
||
func testTakeScreenshotOfRelayFilter() throws { | ||
TunnelControlPage(app) | ||
.tapSelectLocationButton() | ||
|
||
SelectLocationPage(app) | ||
.tapFilterButton() | ||
|
||
SelectLocationFilterPage(app) | ||
.tapOwnershipCellExpandButton() | ||
.tapProvidersCellExpandButton() | ||
|
||
snapshot("RelayFilter") | ||
} | ||
|
||
func testTakeScreenshotOfVPNSettings() throws { | ||
HeaderBar(app) | ||
.tapSettingsButton() | ||
|
||
SettingsPage(app) | ||
.tapVPNSettingsCell() | ||
|
||
snapshot("VPNSettings") | ||
} | ||
|
||
func testTakeScreenshotOfDNSSettings() throws { | ||
addTeardownBlock { | ||
DNSSettingsPage(self.app) | ||
.tapBlockAdsSwitch() | ||
.tapBlockTrackerSwitch() | ||
.tapBlockMalwareSwitch() | ||
.tapBlockAdultContentSwitch() | ||
.tapBlockGamblingSwitch() | ||
.tapBlockSocialMediaSwitch() | ||
} | ||
|
||
HeaderBar(app) | ||
.tapSettingsButton() | ||
|
||
SettingsPage(app) | ||
.tapVPNSettingsCell() | ||
|
||
VPNSettingsPage(app) | ||
.tapDNSSettingsCell() | ||
|
||
DNSSettingsPage(app) | ||
.tapDNSContentBlockersHeaderExpandButton() | ||
.tapBlockAdsSwitch() | ||
.tapBlockTrackerSwitch() | ||
.tapBlockMalwareSwitch() | ||
.tapBlockAdultContentSwitch() | ||
.tapBlockGamblingSwitch() | ||
.tapBlockSocialMediaSwitch() | ||
|
||
snapshot("DNSSettings") | ||
} | ||
|
||
func testTakeScreenshotOfAccount() throws { | ||
HeaderBar(app) | ||
.tapAccountButton() | ||
|
||
snapshot("Account") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters