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

[Bug]: Testing: Unable to find an element in BottomSheetFooter #2142

Closed
LCseniordev opened this issue Jan 30, 2025 · 1 comment
Closed

[Bug]: Testing: Unable to find an element in BottomSheetFooter #2142

LCseniordev opened this issue Jan 30, 2025 · 1 comment
Labels
bug Something isn't working invalid This doesn't seem right

Comments

@LCseniordev
Copy link

Version

v5

Reanimated Version

v3

Gesture Handler Version

v2

Platforms

iOS, Android

What happened?

I'm encountering an issue when trying to locate a View/Button inside BottomSheetFooter using testID in a React Native testing environment. The test consistently fails with the following error:
Error: Unable to find an element with testID: footer-button

It fails as well with the default template - modal body found, but footer - no:
Image

Reproduction steps

  • clone repo
  • run yarn
  • run yarn test

or:

  • Render a BaseBottomSheetModal that includes BottomSheetFooter with a View containing testID="footer-button".
  • Use getByTestId("footer") in a test to locate the element.
    Result: The test fails, stating that the element cannot be found.
    Expected: The test should be able to locate the View inside BottomSheetFooter using testID="footer".

Reproduction sample

https://github.com/LCseniordev/BottomsheetFooterTesting

Relevant log output

Error: Unable to find an element with testID: footer-button

<View>
  <View>
    <View
      accessible={true}
    >
      <Text>
        Open sheet
      </Text>
    </View>
    <RCTScrollView
      testID="scroll-view"
    >
      <View>
        <View>
          <Text>
            Awesome 🎉
          </Text>
          <Text>
            Awesome 🎉
          </Text>
          <Text>
            Awesome 🎉
          </Text>
          <Text>
            Awesome 🎉
          </Text>
          <Text>
            Awesome 🎉
          </Text>
        </View>
      </View>
    </RCTScrollView>
  </View>
</View>
    at Object.getByTestId (/Users/arriadnie/Documents/projects/FDV/testing/MyApp/__tests__/App.test.tsx:32:12)
    at Promise.then.completed (/Users/arriadnie/Documents/projects/FDV/testing/MyApp/node_modules/jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/Users/arriadnie/Documents/projects/FDV/testing/MyApp/node_modules/jest-circus/build/utils.js:231:10)
    at _callCircusTest (/Users/arriadnie/Documents/projects/FDV/testing/MyApp/node_modules/jest-circus/build/run.js:316:40)
    at _runTest (/Users/arriadnie/Documents/projects/FDV/testing/MyApp/node_modules/jest-circus/build/run.js:252:3)
    at _runTestsForDescribeBlock (/Users/arriadnie/Documents/projects/FDV/testing/MyApp/node_modules/jest-circus/build/run.js:126:9)
    at _runTestsForDescribeBlock (/Users/arriadnie/Documents/projects/FDV/testing/MyApp/node_modules/jest-circus/build/run.js:121:9)
    at run (/Users/arriadnie/Documents/projects/FDV/testing/MyApp/node_modules/jest-circus/build/run.js:71:3)
    at runAndTransformResultsToJestFormat (/Users/arriadnie/Documents/projects/FDV/testing/MyApp/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at jestAdapter (/Users/arriadnie/Documents/projects/FDV/testing/MyApp/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at runTestInternal (/Users/arriadnie/Documents/projects/FDV/testing/MyApp/node_modules/jest-runner/build/runTest.js:367:16)
    at runTest (/Users/arriadnie/Documents/projects/FDV/testing/MyApp/node_modules/jest-runner/build/runTest.js:444:34)
    at Object.worker (/Users/arriadnie/Documents/projects/FDV/testing/MyApp/node_modules/jest-runner/build/testWorker.js:106:12)
@LCseniordev LCseniordev added the bug Something isn't working label Jan 30, 2025
Copy link

Hello @LCseniordev 👋, this issue is being automatically closed and locked because it does not follow the issue template.

@github-actions github-actions bot added the invalid This doesn't seem right label Jan 30, 2025
@github-actions github-actions bot locked as spam and limited conversation to collaborators Jan 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

1 participant