Reuse some iOS code in tvOS UI tests
This commit is contained in:
parent
d8447ddb38
commit
7d327b21d7
|
@ -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 {
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue