Skip to content

atIndex() has no effect over getAttributes() #4633

@d4vidi

Description

@d4vidi

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?

  • 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions