Reuse some iOS code in tvOS UI tests

This commit is contained in:
Davide 2024-12-10 18:51:51 +01:00
parent d8447ddb38
commit 7d327b21d7
No known key found for this signature in database
GPG Key ID: A48836171C759F5E
2 changed files with 3 additions and 10 deletions

View File

@ -88,7 +88,7 @@ extension XCUIApplicationProviding where Self: XCTestCase {
} }
private func container(for target: ScreenshotTarget) -> XCUIElement { private func container(for target: ScreenshotTarget) -> XCUIElement {
#if os(iOS) #if os(iOS) || os(tvOS)
app.windows.firstMatch app.windows.firstMatch
#else #else
switch target { switch target {

View File

@ -42,14 +42,14 @@ extension XCUIElement {
private extension XCUIElement { private extension XCUIElement {
func query(for elementType: AccessibilityInfo.ElementType) -> XCUIElementQuery { func query(for elementType: AccessibilityInfo.ElementType) -> XCUIElementQuery {
#if os(iOS) #if os(iOS) || os(tvOS)
switch elementType { switch elementType {
case .button, .link, .menu, .menuItem: case .button, .link, .menu, .menuItem:
return buttons return buttons
case .text: case .text:
return staticTexts return staticTexts
} }
#elseif os(macOS) #else
switch elementType { switch elementType {
case .button, .link: case .button, .link:
return buttons return buttons
@ -60,13 +60,6 @@ private extension XCUIElement {
case .text: case .text:
return staticTexts return staticTexts
} }
#else
switch elementType {
case .button, .link, .menu, .menuItem:
return buttons
case .text:
return staticTexts
}
#endif #endif
} }
} }