summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadVPNUITests/Pages/HeaderBar.swift
blob: 1390536bee00088c942cf752aec259c382c8a5e9 (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
//
//  HeaderBar.swift
//  MullvadVPNUITests
//
//  Created by Niklas Berglund on 2024-01-23.
//  Copyright © 2025 Mullvad VPN AB. All rights reserved.
//

import Foundation
import XCTest

class HeaderBar: Page {
    lazy var accountButton = app.buttons[AccessibilityIdentifier.accountButton]
    lazy var settingsButton = app.buttons[AccessibilityIdentifier.settingsButton]

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

        self.pageElement = app.otherElements[.headerBarView]
        waitForPageToBeShown()
    }

    @discardableResult func tapAccountButton() -> Self {
        accountButton.tap()
        return self
    }

    @discardableResult func tapSettingsButton() -> Self {
        settingsButton.tap()
        return self
    }

    @discardableResult public func verifyDeviceLabelShown() -> Self {
        XCTAssertTrue(
            app.staticTexts[AccessibilityIdentifier.headerDeviceNameLabel]
                .waitForExistence(timeout: BaseUITestCase.defaultTimeout), "Device name displayed in header"
        )

        return self
    }
}