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 {
#if os(iOS)
#if os(iOS) || os(tvOS)
app.windows.firstMatch
#else
switch target {

View File

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