Reputation: 117
Is there a way that I can just enter text in my script by typing
Then I enter "[email protected]"
rather than
Then I enter "[email protected]" into "edit_text_dialog_first_field"?
This is for Calabash Android.
Thanks
Upvotes: 0
Views: 1083
Reputation: 1
Yeap, custom steps helps out much better, if you need some examples, try this link here.
Upvotes: 0
Reputation: 7077
You can write .feature
file in anyway but you have to write step definitions
according to your feature.
This Then I enter "[email protected]
or this Then I enter "[email protected]" into "edit_text_dialog_first_field"?
does not matter.
If you use
Then I enter "[email protected]" into "edit_text_dialog_first_field"?
Your Step Definition will be
Then (/^I enter "(.*?)" into "(.*?)$/") do | arg1, arg2 |
do action...
end
If you use
Then I enter "[email protected]
Your Step Definition will be
Then (/^I enter "(.*?)") do | arg1 |
do action...
end
Upvotes: 1
Reputation: 279
I recommend you create a custom step definition then you can call that step in your scenario. Using the predefined steps are generally poor practice.
It would look something like
Then (/^I enter (.*)$/) do |information|
touch("* id:'Field_id_you_want_to_enter_info_into'")
keyboard_enter_text(information)
end
I recommend you make a more intuitive step name though something along the lines of I enter the (.*) into the username field I have started creating an intro guide on youtube. Please reference https://www.youtube.com/playlist?list=PLInoIpH9dfLyvdaOjozON9QnQP1pK30y-
Upvotes: 4