Skip to content
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

Not finding Elements when a View is wrapped with NavigationStack #207

Closed
domfz opened this issue Oct 19, 2022 · 3 comments
Closed

Not finding Elements when a View is wrapped with NavigationStack #207

domfz opened this issue Oct 19, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@domfz
Copy link

domfz commented Oct 19, 2022

I have a view which has a NavigationStack around it.

var body: some View {
return NavigationStack {
            VStack {
                Text("Hello")
                ..........
            }

Now when trying to find the text "Hello" via (I use quick and nimble for testing, but XCTest gives the same result)

                expect(try homeView.inspect()
                    .find(text: "Hello")
                ).toNot(beNil())

it gives me a failed test. When removing the NavigationStack the test succeeds.
Also when adding a tag to the NavigationStack as .tag property and print the output of

expect(try homeView.inspect()
                    .find(viewWithTag: "NavigationStack")

(this test also succeeds)

it gives me the whole hierarchy which clearly shows (SwiftUI.Text(storage: SwiftUI.Text.Storage.anyTextStorage(<LocalizedTextStorage: 0x00006000010656d0>: "Hello") at some point inside of it.

Am I missing something or is there a bug when traversing through Views wrapped in a NavigationStack via ViewInspector?

@ian0cordova
Copy link

Same issue here with NavigationSplitView under the new ios 16 Navigation setup

@ian0cordova
Copy link

Same issue here with NavigationSplitView under the new ios 16 Navigation setup

Things I've tried

  • Updating to ViewInspector 0.9.2 by switching from Pods to SPM
  • extending NavigationSplitView and NavigationStack to conform to inspectable

Still getting

testView(): failed: caught error: "Search did not find a match. Possible blockers: InternalBody"

@nalexn nalexn added the bug Something isn't working label Dec 4, 2022
nalexn added a commit that referenced this issue Jan 7, 2023
nalexn added a commit that referenced this issue Jan 7, 2023
@nalexn nalexn added the pending release A fixed issue that'll be released in an upcoming update label Jan 7, 2023
@nalexn
Copy link
Owner

nalexn commented Jan 14, 2023

Fixed released with v0.9.4

@nalexn nalexn closed this as completed Jan 14, 2023
@nalexn nalexn removed the pending release A fixed issue that'll be released in an upcoming update label Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants