blob: 78d04094b9637f106d6c369f0aacdc00caaa2885 (
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
//
// ShadowsocksObfuscationSettingsPage.swift
// MullvadVPN
//
// Created by Andrew Bulhak on 2024-12-18.
// Copyright © 2025 Mullvad VPN AB. All rights reserved.
//
import Foundation
import XCTest
class ShadowsocksObfuscationSettingsPage: Page {
@discardableResult override init(_ app: XCUIApplication) {
super.init(app)
}
private var table: XCUIElement {
app.collectionViews[AccessibilityIdentifier.wireGuardObfuscationShadowsocksTable]
}
private func portCell(_ index: Int) -> XCUIElement {
table.cells.element(boundBy: index)
}
private var customCell: XCUIElement {
// assumption: the last cell is the legend
table.cells.allElementsBoundByIndex.dropLast().last!
}
private var customTextField: XCUIElement {
customCell.textFields.firstMatch
}
@discardableResult func tapAutomaticPortCell() -> Self {
portCell(0).tap()
return self
}
@discardableResult func tapCustomCell() -> Self {
customCell.tap()
return self
}
@discardableResult func typeTextIntoCustomField(_ text: String) -> Self {
customTextField.typeText(text)
return self
}
@discardableResult func tapBackButton() -> Self {
// Workaround for setting accessibility identifier on navigation bar button being non-trivial
app.navigationBars.buttons.element(boundBy: 0).tap()
return self
}
}
|