Fix a few things about screenshots

- Postpone "Connected" screenshot
- Disable "Only favorites" to avoid iOS failure
- Prefix screenshot filename with device name and "0"
This commit is contained in:
Davide 2024-12-10 18:20:12 +01:00
parent f441a2eed0
commit d8447ddb38
No known key found for this signature in database
GPG Key ID: A48836171C759F5E
5 changed files with 20 additions and 13 deletions

View File

@ -27,6 +27,7 @@ import Combine
import CommonLibrary
import Foundation
import PassepartoutKit
import UIAccessibility
extension VPNFiltersView {
@ -65,7 +66,9 @@ extension VPNFiltersView {
onlyShowsFavorites = false
subscriptions = []
observeObjects()
if !AppCommandLine.contains(.uiTesting) {
observeObjects()
}
}
func load(options: VPNFilterOptions, initialFilters: VPNFilters?) {

View File

@ -84,7 +84,7 @@ extension XCUIApplicationProviding where Self: XCTestCase {
#elseif os(tvOS)
let device = "AppleTV"
#endif
return "\(name)_\(device).png"
return "\(device)_\(name).png"
}
private func container(for target: ScreenshotTarget) -> XCUIElement {

View File

@ -31,10 +31,12 @@ import XCTest
struct VPNServersScreen {
let app: XCUIApplication
#if os(iOS)
@discardableResult
func discloseCountry(at index: Int) -> Self {
let group = app.get(.VPNServers.countryGroup, at: index)
group.tap()
return self
}
#endif
}

View File

@ -50,32 +50,34 @@ final class ScreenshotTests: XCTestCase, XCUIApplicationProviding {
.waitForProfiles()
.enableProfile(at: 0)
try await Task.sleep(for: .seconds(2))
try snapshot("1_Connected")
let profile = root
.openProfileMenu(at: 2)
.editProfile()
try await Task.sleep(for: .seconds(2))
try snapshot("2_ProfileEditor", target: .sheet)
try snapshot("02_ProfileEditor", target: .sheet)
profile
.enterModule(at: 1)
try await Task.sleep(for: .seconds(2))
try snapshot("3_OnDemand", target: .sheet)
try snapshot("03_OnDemand", target: .sheet)
profile
.leaveModule()
.enterModule(at: 2)
try await Task.sleep(for: .seconds(2))
try snapshot("4_DNS", target: .sheet)
try snapshot("04_DNS", target: .sheet)
profile
let app = profile
.leaveModule()
.closeProfile()
try await Task.sleep(for: .seconds(2))
try snapshot("01_Connected")
app
.openProfileMenu(at: 2)
.connectToProfile()
#if os(iOS)
@ -83,7 +85,7 @@ final class ScreenshotTests: XCTestCase, XCUIApplicationProviding {
#endif
try await Task.sleep(for: .seconds(2))
try snapshot("5_ProviderServers", target: .sheet)
try snapshot("05_ProviderServers", target: .sheet)
print("Saved to: \(ScreenshotDestination.temporary.url)")
}

View File

@ -47,19 +47,19 @@ final class ScreenshotTests: XCTestCase, XCUIApplicationProviding {
.enableProfile(up: 1)
try await Task.sleep(for: .seconds(2))
try snapshot("1_Connected")
try snapshot("01_Connected")
root
.presentProfilesWhileConnected()
try await Task.sleep(for: .seconds(2))
try snapshot("2_ConnectedWithProfileList")
try snapshot("02_ConnectedWithProfileList")
root
.enableProfile(up: 0)
try await Task.sleep(for: .seconds(2))
try snapshot("3_OnDemand")
try snapshot("03_OnDemand")
print("Saved to: \(ScreenshotDestination.temporary.url)")
}