-
Notifications
You must be signed in to change notification settings - Fork 916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does KIF work with SwiftUI? #1199
Comments
Can confirm it works, and I've also tried some interesting thing, using SwiftUI previews in tests:
Here is the log:
|
Wow. That’s great to learn. You might want to indicate this on the read me for others wondering the same.
Thank you very much!
Raul Silva
… On Dec 12, 2020, at 10:25 AM, kenji21 ***@***.***> wrote:
Can confirm it works, and I've also tried some interesting thing, using SwiftUI previews in tests:
func testContentViewPreviews() {
// Given
let contentViewPreviews = ContentView_Previews.previews
// When
solo.showViewControllerInCleanWindow(UIHostingController(rootView: contentViewPreviews))
let shouldFindVersion = solo.waitFor(textWithPrefix: "Version")
// Expect
XCTAssertTrue(shouldFindVersion)
attachScreenshot(name: "contentViewPreviews")
solo.window?.printHierarchy()
}
Here is the log:
UIWindow
| UITransitionView
| | UIDropShadowView
| | | _TtGC7SwiftUI14_UIHostingViewGVS_15ModifiedContentV7myteepi11ContentViewGVS_30_EnvironmentKeyWritingModifierGSqCS2_8AppState____
| | | SwiftUI.AccessibilityNode, label: (null), traits: image
| | | SwiftUI.AccessibilityNode, label: Version BETA 0.0.1, traits: static text
| | | SwiftUI.AccessibilityNode, label: Copyright © myapp, traits: static text
| | | | UIView
| | | | _TtCOCV7SwiftUI11DisplayList11ViewUpdater8Platform13CGDrawingView
| | | | _TtCOCV7SwiftUI11DisplayList11ViewUpdater8Platform13CGDrawingView
| | | | _TtC7SwiftUIP33_A34643117F00277B93DEBAB70EC0697122_UIShapeHitTestingView
| | | | _TtC7SwiftUIP33_A34643117F00277B93DEBAB70EC0697122_UIShapeHitTestingView
| | | | UIView
Test Case '-[MyAppTests.ContentViewTests testContentViewPreviews]'
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#1199 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAQ5VLJVR6QBQLKCCWANZULSUOKQXANCNFSM4UXF3HIA>.
|
Yes, this works for me. All I had to do is to use |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, we are looking for UI testing options and KIF has come up. I have not been able to find out about SwiftUI compatibility.
Any information would be appreciated.
Thanks
The text was updated successfully, but these errors were encountered: