summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadVPNUITests/Pages/AppLogsPage.swift
blob: 35d12dab7637dbc2f329c90c77f2bc65f42d27ab (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
//
//  AppLogsPage.swift
//  MullvadVPNUITests
//
//  Created by Niklas Berglund on 2024-04-26.
//  Copyright © 2025 Mullvad VPN AB. All rights reserved.
//

import XCTest

class AppLogsPage: Page {
    override init(_ app: XCUIApplication) {
        super.init(app)
        self.pageElement = app.otherElements[.appLogsView]
        waitForPageToBeShown()
    }

    @discardableResult func tapShareButton() -> Self {
        app.buttons[.appLogsShareButton].tap()
        return self
    }

    @discardableResult func tapDoneButton() -> Self {
        app.buttons[.appLogsDoneButton].tap()
        return self
    }

    func getAppLogText() -> String {
        guard let logText = app.textViews[.problemReportAppLogsTextView].value as? String else {
            XCTFail("Failed to extract app log text")
            return String()
        }

        return logText
    }
}