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

Issue Selecting Images from Gallery During Detox Tests #4471

Open
nemanjaNakomcic opened this issue Apr 25, 2024 · 2 comments
Open

Issue Selecting Images from Gallery During Detox Tests #4471

nemanjaNakomcic opened this issue Apr 25, 2024 · 2 comments

Comments

@nemanjaNakomcic
Copy link

nemanjaNakomcic commented Apr 25, 2024

Description

Hello,

I'm encountering an issue with selecting images from the system gallery during my Detox tests. I understand that Detox may have limitations interacting with system components, but I've managed to at least perform specific clicks within the app. Unfortunately, I'm still unable to choose images as needed for testing. Are there any known workarounds, such as using the camera to take a picture of a black image or something similar? If not, is it feasible to mock this functionality, and if so, how could this be implemented? Any guidance or suggestions would be greatly appreciated.

Here's the specific code snippet I'm working with:

await element(by.type('UIView').withDescendant(by.type('_UISizeTrackingView')))
  .atIndex(5)
  .tap({x: 60, y: 190});

This code is valid and it clicks on a specific part of the screen where the image is located, but the image does not get selected. Solving this issue is crucial for my testing, so any help would be greatly appreciated.

Your environment

Detox version: 20.20.3
React Native version: 0.73.6
Node version: v18.20.2
Device model: iPhone 15 Pro
OS: 17.4
Test-runner (select one): jest

@asafkorem
Copy link
Contributor

Hey @nemanjaNakomcic, interacting with system components is indeed a limitation that we're currently working to resolve, see: #4464
I'll add this functionality to the epic's list.

As a workaround, you can mock the photo selection module using mock extension, see our how-to guide: https://wix.github.io/Detox/docs/next/guide/mocking

@nemanjaNakomcic
Copy link
Author

Thank you for the quick update and for addressing this issue! I'll check out the mocking guide as you suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants