lundi 22 mai 2017

How to Check a Checkbox using Calabash on iOS?

I'm creating automated tests in Calabash for an iOS app. I'm trying to check a checkbox in order to "accept the terms and conditions" to successfully register a user.

<Form.Layout style={[styles.row, styles.termsRow]}>
      <Form.Field name="tandc" style={[styles.field, styles.termsField]}>
        <Form.CheckBox
          {...testProps('termsAndConditions')}
          renderLabel={() => (
            <LinkButton
              containerStyle={styles.termsLink}
              textStyle={styles.termsLinkText}
              title={t('form.acceptTermsAndConditions')}
              onPress={this.onPressTAndC} />
          )}
          turnedOn={!!tandc} />
      </Form.Field>

My test calabash code looks like this:

When (/^I check the terms and conditions checkbox$/) do
sleep(5)
touch("* marked: 'termsAndConditions'")
end

Instead of checking the checkbox, it opens up the terms and conditions link, which fails the test.

The {...testProps('')} is used throughout the app to give buttons, etc an accessibility label for Calabash to find in order to know what to click.

Any ideas how I can get to to check the checkbox?

Aucun commentaire:

Enregistrer un commentaire