Reuse .pause() in screenshots
This commit is contained in:
parent
7d327b21d7
commit
16a59c6de1
|
@ -54,6 +54,10 @@ extension XCTestCase.ScreenshotDestination {
|
|||
|
||||
@MainActor
|
||||
extension XCUIApplicationProviding where Self: XCTestCase {
|
||||
func pause() async {
|
||||
try? await Task.sleep(for: .seconds(2))
|
||||
}
|
||||
|
||||
func snapshot(
|
||||
_ name: String,
|
||||
destination: ScreenshotDestination = .temporary,
|
||||
|
|
|
@ -38,10 +38,6 @@ final class FlowTests: XCTestCase {
|
|||
app.launch()
|
||||
}
|
||||
|
||||
override func tearDown() async throws {
|
||||
try await Task.sleep(for: .seconds(2))
|
||||
}
|
||||
|
||||
func testConnect() {
|
||||
AppScreen(app: app)
|
||||
.waitForProfiles()
|
||||
|
|
|
@ -54,27 +54,27 @@ final class ScreenshotTests: XCTestCase, XCUIApplicationProviding {
|
|||
.openProfileMenu(at: 2)
|
||||
.editProfile()
|
||||
|
||||
try await Task.sleep(for: .seconds(2))
|
||||
await pause()
|
||||
try snapshot("02_ProfileEditor", target: .sheet)
|
||||
|
||||
profile
|
||||
.enterModule(at: 1)
|
||||
|
||||
try await Task.sleep(for: .seconds(2))
|
||||
await pause()
|
||||
try snapshot("03_OnDemand", target: .sheet)
|
||||
|
||||
profile
|
||||
.leaveModule()
|
||||
.enterModule(at: 2)
|
||||
|
||||
try await Task.sleep(for: .seconds(2))
|
||||
await pause()
|
||||
try snapshot("04_DNS", target: .sheet)
|
||||
|
||||
let app = profile
|
||||
.leaveModule()
|
||||
.closeProfile()
|
||||
|
||||
try await Task.sleep(for: .seconds(2))
|
||||
await pause()
|
||||
try snapshot("01_Connected")
|
||||
|
||||
app
|
||||
|
@ -84,7 +84,7 @@ final class ScreenshotTests: XCTestCase, XCUIApplicationProviding {
|
|||
.discloseCountry(at: 2)
|
||||
#endif
|
||||
|
||||
try await Task.sleep(for: .seconds(2))
|
||||
await pause()
|
||||
try snapshot("05_ProviderServers", target: .sheet)
|
||||
|
||||
print("Saved to: \(ScreenshotDestination.temporary.url)")
|
||||
|
|
|
@ -38,10 +38,6 @@ final class FlowTests: XCTestCase {
|
|||
app.launch()
|
||||
}
|
||||
|
||||
override func tearDown() async throws {
|
||||
try await Task.sleep(for: .seconds(2))
|
||||
}
|
||||
|
||||
func testShow() {
|
||||
AppScreen(app: app)
|
||||
.waitForProfiles()
|
||||
|
|
|
@ -46,19 +46,19 @@ final class ScreenshotTests: XCTestCase, XCUIApplicationProviding {
|
|||
.presentInitialProfiles()
|
||||
.enableProfile(up: 1)
|
||||
|
||||
try await Task.sleep(for: .seconds(2))
|
||||
await pause()
|
||||
try snapshot("01_Connected")
|
||||
|
||||
root
|
||||
.presentProfilesWhileConnected()
|
||||
|
||||
try await Task.sleep(for: .seconds(2))
|
||||
await pause()
|
||||
try snapshot("02_ConnectedWithProfileList")
|
||||
|
||||
root
|
||||
.enableProfile(up: 0)
|
||||
|
||||
try await Task.sleep(for: .seconds(2))
|
||||
await pause()
|
||||
try snapshot("03_OnDemand")
|
||||
|
||||
print("Saved to: \(ScreenshotDestination.temporary.url)")
|
||||
|
|
Loading…
Reference in New Issue