wix / Detox

Gray box end-to-end testing and automation framework for mobile apps
https://wix.github.io/Detox/
MIT License
11.01k stars 1.9k forks source link

Issue Selecting Images from Gallery During Detox Tests #4471

Open nemanjaNakomcic opened 1 month ago

nemanjaNakomcic commented 1 month ago

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 commented 1 month ago

Hey @nemanjaNakomcic, interacting with system components is indeed a limitation that we're currently working to resolve, see: https://github.com/wix/Detox/issues/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 commented 1 month ago

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