blob: 002a99e976b9f53f9922fe54035bcb9d11f149a0 (
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
55
56
57
58
59
60
61
62
63
|
//
// CustomListPage.swift
// MullvadVPNUITests
//
// Created by Marco Nikic on 2024-04-17.
// Copyright © 2025 Mullvad VPN AB. All rights reserved.
//
import XCTest
class CustomListPage: Page {
@discardableResult override init(_ app: XCUIApplication) {
super.init(app)
self.pageElement = app.otherElements[.newCustomListView]
waitForPageToBeShown()
}
@discardableResult func verifyCreateButtonIs(enabled: Bool) -> Self {
let saveOrCreateButton = app.buttons[.saveCreateCustomListButton]
XCTAssertTrue(saveOrCreateButton.isEnabled == enabled, "Verify state of create button")
return self
}
@discardableResult func tapCreateListButton() -> Self {
let saveOrCreateButton = app.buttons[.saveCreateCustomListButton]
saveOrCreateButton.tap()
return self
}
// It's the same button, the difference is just for semantics
@discardableResult func tapSaveListButton() -> Self {
tapCreateListButton()
}
@discardableResult func renameCustomList(name: String) -> Self {
let editCustomListNameCell = app.cells[.customListEditNameFieldCell]
// Activate the text field
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.
// 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
}
@discardableResult func deleteCustomList(named customListName: String) -> Self {
let deleteCustomListCell = app.cells[.customListEditDeleteListCell]
deleteCustomListCell.tap()
app.buttons[.confirmDeleteCustomListButton].tap()
return self
}
@discardableResult func addOrEditLocations() -> Self {
app.cells[.customListEditAddOrEditLocationCell].tap()
return self
}
}
|