blob: 72847d7e4279382878e46d1e5789013a6ce82f9a (
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
|
//
// LoggedInUITestCase.swift
// MullvadVPNUITests
//
// Created by Niklas Berglund on 2024-01-22.
// Copyright © 2025 Mullvad VPN AB. All rights reserved.
//
import Foundation
import XCTest
/// Base class for tests that should start from a state of being logged on to an account with time left
class LoggedInWithTimeUITestCase: BaseUITestCase {
var hasTimeAccountNumber: String?
override func setUp() async throws {
try await super.setUp()
agreeToTermsOfServiceIfShown()
// Make sure that if a previous test ended up in a state where the app got stuck connecting to a relay
// does not affect the next test running
logoutIfLoggedIn()
hasTimeAccountNumber = getAccountWithTime()
guard let hasTimeAccountNumber = self.hasTimeAccountNumber else {
XCTFail("hasTimeAccountNumber unexpectedly not set")
return
}
login(accountNumber: hasTimeAccountNumber)
// Relaunch app so that tests start from a deterministic state
app.terminate()
app.launch()
}
override func tearDown() async throws {
try await super.tearDown()
guard let hasTimeAccountNumber = self.hasTimeAccountNumber else {
XCTFail("hasTimeAccountNumber unexpectedly not set")
return
}
self.deleteTemporaryAccountWithTime(accountNumber: hasTimeAccountNumber)
}
}
|