mobile-dev-inc / maestro

Painless Mobile UI Automation
https://maestro.mobile.dev/
Apache License 2.0
5.68k stars 260 forks source link

Maestro is unable to identify the testIDs for title and subtitle elements of a row thats part of flatlist #2051

Open smehr123 opened 5 days ago

smehr123 commented 5 days ago

Is there an existing issue for this?

Steps to reproduce

Hi, We have a FlatList where each row has a unique test ID, and within each row, the title and subtitle elements also have their own test IDs. While I can access the test ID of the row, I'm unable to access the test IDs of the title and subtitle within that row during verification. Additionally, in Maestro Studio, only the row's test ID is visible, but the test IDs for the title and subtitle are not appearing.

<PressableOpacity
  onPress={onPress}
  style={styles(theme).container}
  testID={containerTestID}>
  <View>
    {isShareActivity ? (
      <Fragment>
        <View
          style={[
            styles(theme).image,
            styles(theme).linkImageContainer,
          ]}>
          <Link stroke={theme.icon} />
        </View>

        {item.logoUrl && (
          <FastImage
            source={{ uri: item.logoUrl }}
            style={[
              styles(theme).logo,
              { backgroundColor: item.teamColor || theme.accentBackground },
            ]}
          />
        )}
      </Fragment>
    ) : imageSource?.uri ? (
      <Fragment>
        <FastImage style={styles(theme).image} source={imageSource} />
        {item.logoUrl && (
          <FastImage
            source={{ uri: item.logoUrl }}
            style={[
              styles(theme).overlayLogo,
              { backgroundColor: item.teamColor || theme.accentBackground },
            ]}
          />
        )}
      </Fragment>
    ) : wrappedImage ? (
      <Fragment>{wrappedImage}</Fragment>
    ) : null}
  </View>
  <View style={styles(theme).contentContainer}>
    <Text
      numberOfLines={1}
      style={styles(theme).title}
      testID={titleTestID}>
      {getTitle(item)}
    </Text>
    {item.type === ActivityType.loadShare ||
    item.type === ActivityType.ReactShareUpload ? (
      uploadShareSubtitle(item)
    ) : getSubtitle(item) ? (
      <Text
        numberOfLines={1}
        style={styles(theme).subtitle}
        testID={subTitleTestID}>
        {getSubtitle(item)}
      </Text>
    ) : null}
  </View>

Actual results

The maestro studio view hierarchy is unable to identify the title and subtitle testIDs

Expected results

The maestro studio view hierarchy should be able to identify the title and subtitle testIDs

About app

iOS 17.5 iPhone 15 React Native App

About environment

MacOS 14.6.1- Sonoma

Logs

Logs ``` ```

Maestro version

1.37.9

How did you install Maestro?

install script (https://get.maestro.mobile.dev)

Anything else?

No response

smehr123 commented 5 days ago

Test snippet where i am using it

smehr123 commented 1 day ago

Hi, can someone please help me here?

smehr123 commented 4 hours ago

Hi, are there any updates on this? How can i fix it?