I'm currently writing test scripts for my Android application using calabash-android. One problem I'm facing is that I don't always know the route the application should go down.
For example, if I open a job that job could throw a warning to confirm you want to open the job before the next "job" activity is shown, however other jobs might not show this warning.
What I need is a way to analyse a particular view with an if/else statement in my cucumber code. Has anyone managed to achieve this previously?
Below is an example of what I'm after:
Scenario: As a valid user I can log into my app and view my jobs list
When I see "Log In"
Then I enter text "JoeBloggs" into field with id "txtUsername"
Then I enter text "Password123" into field with id "txtPassword"
Then I press "Log In"
And I wait
Then I see "Welcome To The Your Application"
Then I press "Jobs"
And I wait
Then I see "Back"
Then I see "Job Number"
Then I press list item number 2
And I wait
Then I see "Amey Reference"
Then I press view with id "btnStartJob"
And I wait
If I see "Warning" then press "Okay" else I should see "Job Detail"
I've just had a proper think about this and realised I could just do a "Given" here. Below is an example:
And in my calabash steps I have defined this step: