react-nativeappiumreact-native-iosappium-ios

Cannot recognize modal by appium


I have an application created by react-native which contains a modal raise from bottom. Now I'm tring to use appium to automate the application and in android it works fine. While in iOS, when I try to use appium inspector on the modal, it just get penetrated and return control below.

        <Modal style={styles.bottomModal} isVisible={btmModal} backdropOpacity={0.3} onBackdropPress={this._closeBtmModal}>
          <View style={styles.ways}>
            <TouchableOpacity accessibilityLabel={IDS.MANUAL_NAV_CAMERA} testID={IDS.MANUAL_NAV_CAMERA} style={styles.line} onPress={() => this._navCamera()}>
              <Image style={styles.scan} source={require('../../../resources/images/scan.png')} /><Text style={styles.lineTxt}>扫码绑定</Text>
            </TouchableOpacity>
            <TouchableOpacity accessible={true} accessibilityLabel={IDS.MANUAL_ADD_TEXT} testid={IDS.MANUAL_ADD_TEXT} style={styles.line} onPress={this._navManualBindMfa}>
              <Text style={styles.lineTxt}>手动输入</Text>
            </TouchableOpacity>
            <TouchableOpacity accessible={true} accessibilityLabel={IDS.MANUAL_ADD_MODAL_CANCEL} testId={IDS.MANUAL_ADD_MODAL_CANCEL} style={[styles.line, styles.cancelline]} onPress={this._closeBtmModal}>
              <Text style={styles.cancelTxt}>取消</Text>
            </TouchableOpacity>
          </View>
        </Modal>

Try to get appium inspector working against this modal. Thanks for any suggestion in advance.


Solution

  • Possible strategies to try:

    1. "setting accessible={false} on outer most layer makes child views accessible."

    See https://github.com/appium/appium/issues/6517#issuecomment-298037046

    1. If your modal has a transparent background the components behind may will still be marked as visible. I use an environment variable set in the build for testing with appium which removes the transparency option. This does mean that the build being tested is not identical to the normal build