Detox icon indicating copy to clipboard operation
Detox copied to clipboard

atIndex() has no effect over getAttributes()

Open d4vidi opened this issue 1 year ago • 2 comments

What happened?

The idiomatic way of getting the attributes of a specific element (e.g. at index 1) from a matching list is:

const matches = await element(by.type('android.widget.TextView')).getAttributes());
const element = matches[1];

But the following technique is also valid, technically:

const element = await element(by.type('android.widget.TextView')).atIndex(1).getAttributes();

Seems the latter works on Android, but not iOS. Instead, atIndex() is ignored and the entire list of elements is returned.

What was the expected behaviour?

The API on iOS should behave the same way as on Android.

Was it tested on latest Detox?

  • [X] I have tested this issue on the latest Detox release and it still reproduces.

Did your test throw out a timeout?

Help us reproduce this issue!

No response

In what environment did this happen?

Detox version: React Native version: Has Fabric (React Native's new rendering system) enabled: (yes/no) Node version: Device model: iOS version: macOS version: Xcode version: Test-runner (select one): jest / other

Detox logs

N/A

Device logs

N/A

More data, please!

No response

d4vidi avatar Nov 13 '24 12:11 d4vidi

Hello! We appreciate you bringing this issue to our attention. It looks like this could be a valuable addition or fix to our project. We believe that this feature would benefit greatly from contributions from the community, even from first-time contributors.

If you're interested in contributing to this feature, please take a look at our contribution guide. It has all the information you need to know about how to submit a pull request and contribute to our project.

You're also welcome to join our Discord server and discuss this feature with the collaborators or other contributors under the channel 'contributions'.

Please feel free to reach out to us if you have any questions, or need help with anything. We appreciate your feedback and look forward to working with you!

github-actions[bot] avatar Nov 13 '24 12:11 github-actions[bot]

The longPressAndDrag also appears to be incompatible with atIndex : await element(by.id(testIDs.userStats.itemG)) .atIndex(1) .longPressAndDrag(5 * 1000, 0.5, 0.5, element(by.id(testIDs.userStats.itemG)).atIndex(4), 0.5, 0.5, 'slow', 1000); is fine with android, but raise an error on iOS

Image

JB712 avatar Feb 03 '25 18:02 JB712