Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite screenshot tests to use new syntax #6300

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
207 changes: 32 additions & 175 deletions ios/MullvadVPN.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

This file was deleted.

28 changes: 0 additions & 28 deletions ios/MullvadVPNScreenshots/Info.plist

This file was deleted.

154 changes: 0 additions & 154 deletions ios/MullvadVPNScreenshots/MullvadVPNScreenshots.swift

This file was deleted.

4 changes: 2 additions & 2 deletions ios/MullvadVPNUITests/CustomListsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class CustomListsTests: LoggedInWithTimeUITestCase {
EditCustomListLocationsPage(app)
.scrollToLocationWith(identifier: "se")
.toggleLocationCheckmarkWith(identifier: "se")
.pressBackButton()
.tapBackButton()

CustomListPage(app)
.tapSaveListButton()
Expand Down Expand Up @@ -96,7 +96,7 @@ class CustomListsTests: LoggedInWithTimeUITestCase {
.unfoldLocationwith(identifier: "se")
.unfoldLocationwith(identifier: "se-got")
.toggleLocationCheckmarkWith(identifier: "se-got-wg-001")
.pressBackButton()
.tapBackButton()

CustomListPage(app)
.tapSaveListButton()
Expand Down
16 changes: 16 additions & 0 deletions ios/MullvadVPNUITests/Pages/AddCustomListLocationsPage.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// AddCustomListLocationsPage.swift
// MullvadVPNUITests
//
// Created by Jon Petersson on 2024-06-03.
// Copyright © 2024 Mullvad VPN AB. All rights reserved.
//

import XCTest

class AddCustomListLocationsPage: EditCustomListLocationsPage {
@discardableResult override func tapBackButton() -> Self {
app.navigationBars["Add locations"].buttons.firstMatch.tap()
return self
}
}
8 changes: 6 additions & 2 deletions ios/MullvadVPNUITests/Pages/CustomListPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ class CustomListPage: Page {
editCustomListNameCell.tap()
// Select the entire text with a triple tap
editCustomListNameCell.tap(withNumberOfTaps: 3, numberOfTouches: 1)
// Tap the "delete" key on the on-screen keyboard, the case is sensitive
app.keys["delete"].tap()
// Tap the "delete" key on the on-screen keyboard, the case is sensitive.
// However, on a simulator the keyboard isn't visible by default, so we
// need to take that into consideration.
if app.keys["delete"].isHittable {
app.keys["delete"].tap()
}
editCustomListNameCell.typeText(name)
return self
}
Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadVPNUITests/Pages/DNSSettingsPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class DNSSettingsPage: Page {

@discardableResult func tapDNSContentBlockersHeaderExpandButton() -> Self {
let headerView = app.otherElements[AccessibilityIdentifier.dnsContentBlockersHeaderView]
let expandButton = headerView.buttons[AccessibilityIdentifier.collapseButton]
let expandButton = headerView.buttons[AccessibilityIdentifier.expandButton]
expandButton.tap()

return self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
import XCTest

class EditCustomListLocationsPage: Page {
enum Action {
case add, edit
}

@discardableResult override init(_ app: XCUIApplication) {
super.init(app)

Expand Down Expand Up @@ -46,7 +50,7 @@ class EditCustomListLocationsPage: Page {
return self
}

@discardableResult func pressBackButton() -> Self {
@discardableResult func tapBackButton() -> Self {
app.navigationBars["Edit locations"].buttons.firstMatch.tap()
return self
}
Expand Down
4 changes: 4 additions & 0 deletions ios/MullvadVPNUITests/Pages/TunnelControlPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class TunnelControlPage: Page {
let protocolName: String
}

var connectionIsSecured: Bool {
app.staticTexts[AccessibilityIdentifier.connectionStatusConnectedLabel].exists
}

/// Poll the "in address row" label for its updated values and output an array of ConnectionAttempt objects representing the connection attempts that have been communicated through the UI.
/// - Parameters:
/// - attemptsCount: number of connection attempts to look for
Expand Down
12 changes: 6 additions & 6 deletions ios/MullvadVPNUITests/Pages/VPNSettingsPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ class VPNSettingsPage: Page {
super.init(app)
}

private func cellExpandCollapseButton(_ cellAccessiblityIdentifier: AccessibilityIdentifier) -> XCUIElement {
private func cellExpandButton(_ cellAccessiblityIdentifier: AccessibilityIdentifier) -> XCUIElement {
let table = app.tables[AccessibilityIdentifier.vpnSettingsTableView]
let matchingCells = table.otherElements.containing(.any, identifier: cellAccessiblityIdentifier.rawValue)
let expandButton = matchingCells.buttons[AccessibilityIdentifier.collapseButton]
let expandButton = matchingCells.buttons[AccessibilityIdentifier.expandButton]

return expandButton
}
Expand All @@ -37,18 +37,18 @@ class VPNSettingsPage: Page {
}

@discardableResult func tapWireGuardPortsExpandButton() -> Self {
cellExpandCollapseButton(AccessibilityIdentifier.wireGuardPortsCell).tap()
cellExpandButton(AccessibilityIdentifier.wireGuardPortsCell).tap()
return self
}

@discardableResult func tapWireGuardObfuscationExpandButton() -> Self {
cellExpandCollapseButton(AccessibilityIdentifier.wireGuardObfuscationCell).tap()
cellExpandButton(AccessibilityIdentifier.wireGuardObfuscationCell).tap()

return self
}

@discardableResult func tapUDPOverTCPPortExpandButton() -> Self {
cellExpandCollapseButton(AccessibilityIdentifier.udpOverTCPPortCell).tap()
cellExpandButton(AccessibilityIdentifier.udpOverTCPPortCell).tap()

return self
}
Expand All @@ -72,7 +72,7 @@ class VPNSettingsPage: Page {
}

@discardableResult func tapQuantumResistantTunnelExpandButton() -> Self {
cellExpandCollapseButton(AccessibilityIdentifier.quantumResistantTunnelCell).tap()
cellExpandButton(AccessibilityIdentifier.quantumResistantTunnelCell).tap()

return self
}
Expand Down
Loading
Loading