blob: 93aad69c1769f9d38dc2005f4c6d6f67c11b9a53 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
//
// EditAccessMethodPage.swift
// MullvadVPNUITests
//
// Created by Niklas Berglund on 2024-04-10.
// Copyright © 2024 Mullvad VPN AB. All rights reserved.
//
import Foundation
import XCTest
class EditAccessMethodPage: Page {
override init(_ app: XCUIApplication) {
super.init(app)
self.pageElement = app.tables[.editAccessMethodView]
waitForPageToBeShown()
}
@discardableResult func tapEnableMethodSwitch() -> Self {
app.switches[AccessibilityIdentifier.accessMethodEnableSwitch].tap()
return self
}
@discardableResult func tapEnableMethodSwitchIfOff() -> Self {
let enableMethodSwitch = app.switches[AccessibilityIdentifier.accessMethodEnableSwitch]
if enableMethodSwitch.value as? String == "0" {
tapEnableMethodSwitch()
}
return self
}
@discardableResult func tapBackButton() -> Self {
// Workaround due to the way automatically managed back buttons work. Back button needs to be nil for the automatic back button behaviour in iOS, and since its nil we cannot set accessibilityIdentifier for it
let backButton = app.navigationBars.firstMatch.buttons.firstMatch
backButton.tap()
return self
}
}
|