【问题标题】:Detox/Appium tap, multiTap, and longPress not working on elementDetox/Appium tap、multiTap 和 longPress 在元素上不起作用
【发布时间】:2018-07-19 19:28:17
【问题描述】:

在 React Native 项目中使用 detox。这是组件:

<TouchableWithoutFeedback
  testID={'rss_list_' + this.props.index}
  onPress={this.selectItem}
>
  <View testID={'rss_list_text_' + this.props.index}>
    <Text style={styles.itemText}>
      {this.props.item.title ? this.props.item.title.trim() : "no title"}
    </Text>
  </View>
</TouchableWithoutFeedback>

实际测试:

  it('should have an Rss List', async () => {
    await expect(element(by.id('RssList'))).toExist();
  });

  it('should have a Header', async () => {
    await expect(element(by.id('main_header'))).toExist();
  });

  it('should have a populated rss list', async () => {
    await expect(element(by.id('rss_list_populated'))).toExist();
  });

  it('should have an rss item', async () => {
    await expect(element(by.id('rss_list_2'))).toBeVisible();
  });

  it('should tap on the rss item', async () => {
    await element(by.id('rss_list_2')).tap();
  });

  it('should see the item view', async () => {
    await waitFor(element(by.id('item_view'))).toBeVisible().withTimeout(10000);
  });

问题:

应该有一个 rss 项目成功并找到该项目。 但是,尝试点击 TouchableWithoutFeedback、View 或 Text 元素会成功,但下面的函数不会触发。测试没有失败 Detox 表示 Tap 发生了,但是从 Tap 产生的 item_view 从未出现。标题中的所有方法我都试过了:tap、multiTap、longPress。我也试过在测试过程中手动敲击,它也不起作用。排毒中只有一些元素类型可以点击吗?

更新:我今天在 Appium 中尝试过,它也无法点击该元素。看起来问题出在 TouchableWithoutFeedback

【问题讨论】:

    标签: react-native appium detox


    【解决方案1】:

    TouchableWithoutFeedback 不支持 testID 属性,View 也不支持直接在下面。

    【讨论】:

      猜你喜欢
      • 2018-06-19
      • 1970-01-01
      • 1970-01-01
      • 2013-06-07
      • 2016-07-05
      • 1970-01-01
      • 1970-01-01
      • 2020-12-17
      • 2018-09-21
      相关资源
      最近更新 更多