Cucumber Cheat Sheet

Below is a listing of all the predefined Cucumber steps that ship with Awetest.  We are constantly adding and updating this library and you can always find more details at http://awetest.zendesk.com

Opening a browser:
These are standard commands for launching a browser. You can specify a browser or you can simply say “new browser” which will launch the browser you selected at run time in Awetest.

 
1
2
3
4
5
6
7
8
9
When /^I open a browser$/i
When /^I open a new browser$/i
Given /^I open a F?f?irefox B?b?rowser$/i
Given /^I open Firefox$/
Given /^I open a C?c?hrome B?b?rowser$/i
Given /^I open Chrome$/
When /^I open an IE B?b?rowser$/i
Given /^I open an I?i?nternet E?e?xplorer B?b?rowser$/i
Given /^I open Internet Explorer$/i

Defining Library:
Awetest supports both, Classic Watir and Watir WebDriver and you can choose the library you want to use directly in the script.

 
1
2
3
4
Given /^I run with Watir$/
Given /^I run with Classic Watir$/
Open a browser with watir-webdriver
Given /^I run with Watir-webdriver$/i

Navigation:
This is standard navigation to a specific URL. You can also specify environments in Awetest directly which will be used by the scripts at Run time.

 
1
2
3
Then /^I navigate to the environment url$/
Then /^I go to the url "(.*?)"$/
Then /^I go to the (URL|url)$/

Clicking on an image/text:

 
1
Then /^I click "(.*?)"$/

Interacting with button/radio/check box:

 
1
2
Then /^I click the button "(.*?)"$/
Then /^I click the "?(.*?)"? with "(.*?)" "(.*?)"$/

Inputting data into text field:

 
1
2
And /^I enter "(.*?)" in text field with "?(.*?)"? "(.*?)"$/
And /^I enter the value for "(.*?)" in text field with "?(.*?)"? "(.*?)"$/

Selecting from the target list:

 
1
2
3
And /^I select the value "(.*?)" in select list with "?(.*?)"? "(.*?)"$/
And /^I select the option "(.*?)" in select list with "?(.*?)"? "(.*?)"$/
And /^I select the value for "(.*?)" in select list with "?(.*?)"? "(.*?)"$/

Checking the value in a text box:

 
1
2
Then /^I check that the "?(.*?)"? with "?(.*?)"? "(.*?)" contains "(.*?)"$/
Then /^I check that the text field with "?(.*?)"? "(.*?)" contains the value for "(.*?)"$/

Text validation:

 
1
2
Then /^I should see "(.*?)"$/
Then /^I should not see "(.*?)"$/

Filling in a text box:

 
1
Then /^I fill in "(.*?)" with "(.*?)"$/

Using Binding.pry to debug:

 
1
Then /^let me debug$|^pry$|^execute binding.pry$/ do

Implicit & Explicit Waits:

 
1
2
When /^I wait (\d+) seconds?$/
When /^I wait until "?(.*?)"? with "?(.*?)"? "(.*?)" is ready$/

Interacting with browser alert:

 
1
And /^I click "(.*?)" in the browser alert$/

Closing the browser:

 
1
And /^I close the browser$/

Special Cases:

 
1
2
3
4
5
When(/^I should see "([^"]*)" but proceed if not present$/)
Given /^I load data spreadsheet "(.*?)" for "(.*?)"$/
Then /^I load @login from spreadsheet$/
Then /^I load @var from spreadsheet$/
And /^I take a screenshot$/

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk