The Cellar - adcade/saucey GitHub Wiki
The following information & step definitions are available by running: vendor/bin/behat -di
or vendor/bin/behat -dl
from the root of the repository.
##Available hooks & definitions
###Web Step Definitions
####Given I wait for (\d+)
seconds
Given I wait for 10 seconds
When I wait for 9 seconds
And I wait for 8 seconds
####Given I set my browser window size to MacBook Standard Given I set my browser window size to MacBook Standard When I set my browser window size to MacBook Standard And I set my browser window size to MacBook Standard
####Given I set my browser window size to MacBook Retina Given I set my browser window size to MacBook Retina When I set my browser window size to MacBook Retina And I set my browser window size to MacBook Retina
####Given I set my browser window size to Windows Standard Given I set my browser window size to Windows Standard When I set my browser window size to Windows Standard And I set my browser window size to Windows Standard
####When I hover over the element "([^"]*)"
When I hover over the element "sign-up-button"
And I hover over the element "sign-up-button"
####When I confirm the popup When I confirm the popup And I confirm the popup
####When I cancel the popup When I cancel the popup And I cancel the popup
####When I should see "([^"]*)"
in popup
And I should see "Bruce Wayne is not Batman" in popup
Then I should see "Bruce Wayne is not Batman" in popup
####When I fill "([^"]*)"
in popup
When I fill "Then why does he hang out with Dick Grayson?" in popup
And I fill "Then why does he hang out with Dick Grayson?" in popup
####When I click on the element with xpath \'([^\']*)\'
When I click on the element with xpath '//*[@id="find-out-who-batman-is"]'
And I click on the element with xpath '//*[@id="find-out-who-batman-is"]'
####Given I click on the element with xpath "([^"]*)"
When I click on the element with xpath '//*[@id="find-out-who-batman-is"]'
And I click on the element with xpath '//*[@id="find-out-who-batman-is"]'
####Given I click "([^"]*)"/
Given I click "css-class"
And I click "css-class"
####Given I scroll to the bottom Given I scroll to the bottom When I scroll to the bottom And I scroll to the bottom
####Given I scroll to the top
Given I scroll to the top
When I scroll to the top
And I scroll to the top
####Given I scroll to the "([^"]*)" (field|link|button)
Scroll to a certain element by label.
Requires an "id" attribute to uniquely identify the element in the document.
Given I scroll to the "Submit" button
Given I scroll to the "My Date" field
####Given I am on a new session Given I am on a new session And I am on a new session
####Given I am on the homepage Opens homepage.
Given I am on the homepage
And I am on the homepage
When I go to the homepage
####Given I am on "(?P<page>[^"]+)"
Opens specified page.
Given I am on "/articles/isBatmanBruceWayne"
And I am on "/articles/isBatmanBruceWayne"
When I go to "/articles/isBatmanBruceWayne"
####When I go to "(?P<page>[^"]+)"
Opens specified page.
Given I am on "/articles/isBatmanBruceWayne"
And I am on "/articles/isBatmanBruceWayne"
When I go to "/articles/isBatmanBruceWayne"
####When I reload the page Reloads current page.
And I reload the page
When I reload the page
####When I move backward one page Moves backward one page in history.
And I move backward one page
When I move backward one page
####When I move forward one page Moves forward one page in history
And I move forward one page
When I move forward one page
####When I press "(?P<button>(?:[^"]|\\")*)"
Presses button with specified id|name|title|alt|value.
And I press "Log In"
When I press "sign-in"
####When I follow "(?P<link>(?:[^"]|\\")*)"
Clicks link with specified id|title|alt|text.
And I follow "Log In"
When I follow "sign-in"
####When I fill in "(?P<field>(?:[^"]|\\")*)"
with "(?P<value>(?:[^"]|\\")*)"
Fills in form field with specified id|name|label|value.
And I fill in "username" with "bruceWayne"
And I fill in "username" with: bruceWayne
And I fill in "bruceWayne" for "username"
When I fill in "username" with "bruceWayne"
When I fill in "username" with: bruceWayne
When I fill in "bruceWayne" for "username"
####When I fill in "(?P<field>(?:[^"]|\\")*)"
with:
Fills in form field with specified id|name|label|value.
And I fill in "username" with "bruceWayne"
And I fill in "username" with: bruceWayne
And I fill in "bruceWayne" for "username"
When I fill in "username" with "bruceWayne"
When I fill in "username" with: bruceWayne
When I fill in "bruceWayne" for "username"
####When I fill in "(?P<value>(?:[^"]|\\")*)"
for "(?P<field>(?:[^"]|\\")*)"
Fills in form field with specified id|name|label|value.
And I fill in "username" with "bruceWayne"
And I fill in "username" with: bruceWayne
And I fill in "bruceWayne" for "username"
When I fill in "username" with "bruceWayne"
When I fill in "username" with: bruceWayne
When I fill in "bruceWayne" for "username"
####When I fill in the following: Fills in form fields with provided table.
And I fill in the following:
| userId | 27 |
| username | bruceWayne |
| password | iLoveBats123 |
When I follow "sign-in"
| userId | 27 |
| username | bruceWayne |
| password | iLoveBats123 |
####When I select "(?P<option>(?:[^"]|\\")*)"
from "(?P<select>(?:[^"]|\\")*)"
Selects option in select field with specified id|name|label|value.
And I select "male" from "gender"
When I select "VISA" from "paymentType"
####When I additionally select "(?P<option>(?:[^"]|\\")*)"
from "(?P<select>(?:[^"]|\\")*)"
Selects additional option in select field with specified id|name|label|value.
And I additionally select "female" from "gender"
When I additionally select "AMEX" from "paymentType"
####When I check "(?P<option>(?:[^"]|\\")*)"
Checks checkbox with specified id|name|label|value.
And I check "Mac OS X" from "os"
When I check "Batman" from "heroes"
####When I uncheck "(?P<option>(?:[^"]|\\")*)"
Unchecks checkbox with specified id|name|label|value.
And I uncheck "Mac OS X" from "os"
When I uncheck "Batman" from "heroes"
####When I attach the file "(?P<path>[^"]*)"
to "(?P<field>(?:[^"]|\\")*)"
Attaches file to field with specified id|name|label|value.
And I check "Mac OS X" from "os"
When I check "Batman" from "heroes"
####Then I should be on "(?P[^"]+)" Checks, that current page PATH is equal to specified.
And I should be on "/heroes/Batman"
Then I should be on "/heroes/Batman"
####Then I should be on the homepage Checks, that current page is the homepage.
And I should be on the homepage
Then I should be on the homepage
####Then the (?i)url(?-i)
should match (?P<pattern>"(?:[^"]|\\")*")
Checks, that current page PATH matches regular expression.
And the url should match "/heroes/\w+"
Then the url should match "/heroes/\w+"
####Then the response status code should be (?P<code>\d+)
Checks, that current page response status is equal to specified.
And the url should match "/heroes/\w+"
Then the url should match "/heroes/\w+"
####Then the response status code should not be (?P<code>\d+)
Checks, that current page response status is not equal to specified.
And the response status code should not be 404
Then the response status code should not be 404
####Then I should see "(?P<text>(?:[^"]|\\")*)"
Checks, that page contains specified text.
And I should see "This just in, Bruce Wayne is not Batman"
Then I should see "This just in, Bruce Wayne is not Batman"
####Then I should not see "(?P<text>(?:[^"]|\\")*)"
Checks, that page doesn't contain specified text.
And I should not see "This just in, Bruce Wayne is Batman"
Then I should not see "This just in, Bruce Wayne is Batman"
####Then I should see text matching (?P<pattern>"(?:[^"]|\\")*")
Checks, that page contains text matching specified pattern.
And I should not see "This just in, Bruce Wayne is Batman"
Then I should not see "This just in, Bruce Wayne is Batman"
####Then I should not see text matching (?P<pattern>"(?:[^"]|\\")*")
Checks, that page doesn't contain text matching specified pattern.
And I should not see text matching "Bruce Wayne is Batman"
Then I should not see text matching "Bruce Wayne is Batman"
####Then the response should contain "(?P<text>(?:[^"]|\\")*)"
Checks, that HTML response contains specified string.
And the response should contain "<noscript>Sorry turn JavaScript on to view full experience</noscript>"
Then the response should contain "<noscript>Sorry turn JavaScript on to view full experience</noscript>"
####Then the response should not contain "(?P<text>(?:[^"]|\\")*)"
Checks, that HTML response doesn't contain specified string.
And the response should not contain "v1.0.1"
Then the response should not contain "v1.0.1"
####Then I should see "(?P<text>(?:[^"]|\\")*)"
in the "(?P<element>[^"]*)"
element
Checks, that element with specified CSS contains specified text.
And I should see "Batman is dead?" in the "headline" element
Then I should see "Batman is dead?" in the "headline" element
####Then I should not see "(?P<text>(?:[^"]|\\")*)"
in the "(?P<element>[^"]*)"
element
Checks, that element with specified CSS doesn't contain specified text.
And I should not see "Batman is alive?" in the "headline" element
Then I should not see "Batman is alive?" in the "headline" element
####Then the "(?P<element>[^"]*)"
element should contain "(?P<value>(?:[^"]|\\")*)"
Checks, that element with specified CSS contains specified HTML.
And the "nav" element should contain "profile"
Then the "nav" element should contain "profile"
####Then the "(?P<element>[^"]*)"
element should not contain "(?P<value>(?:[^"]|\\")*)"
Checks, that element with specified CSS doesn't contain specified HTML.
And the "nav" element should not contain "logged-in"
Then the "nav" element should not contain "logged-in"
####Then I should see an? "(?P<element>[^"]*)"
element
Checks, that element with specified CSS exists on page.
And I should see a "canvas" element
Then I should see an "apples" element
####Then I should not see an? "(?P<element>[^"]*)"
element
Checks, that element with specified CSS doesn't exist on page.
And I should not see a "canvas" element
Then I should not see an "apples" element
####Then the "(?P<field>(?:[^"]|\\")*)"
field should contain "(?P<value>(?:[^"]|\\")*)"
Checks, that form field with specified id|name|label|value has specified value.
And the "name" field should contain "Bruce Wayne"
Then the "name" field should contain "Bruce Wayne"
####Then the "(?P<field>(?:[^"]|\\")*)"
field should not contain "(?P<value>(?:[^"]|\\")*)"
Checks, that form field with specified id|name|label|value doesn't have specified value.
And the "name" field should not contain "Bruce Wayne"
Then the "name" field should not contain "Bruce Wayne"
####Then the "(?P<checkbox>(?:[^"]|\\")*)"
checkbox should be checked
Checks, that checkbox with specified in|name|label|value is checked.
And the "heroes" checkbox should be checked
Then the "heroes" checkbox is checked
####Then the checkbox "(?P<checkbox>(?:[^"]|\\")*)"
is/should be checked
Checks, that checkbox with specified in|name|label|value is checked.
And the "heroes" checkbox should be checked
Then the "heroes" checkbox is checked
####Then the "(?P<checkbox>(?:[^"]|\\")*)"
checkbox should not be checked
Checks, that checkbox with specified in|name|label|value is unchecked.
And the "villains" checkbox should be unchecked
Then the "villains" checkbox is not checked
####Then the checkbox "(?P<checkbox>(?:[^"]|\\")*)"
should be unchecked/not be checked
Checks, that checkbox with specified in|name|label|value is unchecked.
And the "villains" checkbox should be unchecked
Then the "villains" checkbox is not checked
####Then the checkbox "(?P<checkbox>(?:[^"]|\\")*)"
is unchecked/not checked
Checks, that checkbox with specified in|name|label|value is unchecked.
And the "villains" checkbox should be unchecked
Then the "villains" checkbox is not checked
####Then I should see (?P<num>\d+)
"(?P<element>[^"]*)"
element(s)
Checks, that (?P\d+) CSS elements exist on the page
And I should see 5 "div" elements
Then I should see 1 "canvas" element
####Then /^print current URL Prints current URL to console.
Then print current URL
####Then /^print last response Prints last response to console.
Then print last response
####Then /^show last response Opens last response content in browser.
Then show last response
###Shell Step Definitions
####Given I am in :dir
directory
Changes directory to :directory requested.
Given I am in "/Users/bWayne/secretfiles/batman"
And I am in "/Users/bWayne/secretfiles/batman"
####When I run "([^"]*)"
Runs a command line argument.
When I run ".openCaveEntrance"
And I run ".openCaveEntrance"
####Then I should see: Asserts against previously run command line argument.
Then I should see:
"""
Opening cave, master Bruce.
"""
And I should see:
"""
Opening cave, master Bruce.
"""
###API Step Definitions
Adds Basic Authentication header to next request.
And I am authenticating as "bruceWayne" with "iLoveBats123"
Given I am authenticating as "bruceWayne" with "iLoveBats123"
####Given I set header "([^"]*)"
with value "([^"]*)"
Sets a HTTP Header.
And I set header "username" with "notBatman"
Given I set header "username" with "notBatman"
####When I send a ([A-Z]+)
request to "([^"]+)"
Sends HTTP request to specific relative URL.
And I send a GET request to "/heroes/list"
Given I send a GET request to "/heroes/list"
####When I send a ([A-Z]+)
request to "([^"]+)"
with values:
Sends HTTP request to specific URL with field values from Table.
And I send a GET request to "/heroes/list" with values:
| userId | 27 |
| username | bruceWayne |
| password | iLoveBats123 |
When I send a GET request to "/heroes/list" with values:
| userId | 27 |
| username | bruceWayne |
| password | iLoveBats123 |
####When I send a ([A-Z]+)
request to "([^"]+)"
with body:
Sends HTTP request to specific URL with raw body from PyString.
And I send a GET request to "/heroes/list" with body:
"""
[
{
"body": "I am not batman I take serious offense to any claims suggesting such outlandish remarks.",
"id" : 1
}
]
"""
When I send a GET request to "/heroes/list" with body:
"""
[
{
"body": "I am not batman I take serious offense to any claims suggesting such outlandish remarks.",
"id" : 1
}
]
"""
####When I send a ([A-Z]+)
request to "([^"]+)"
with form data:
Sends HTTP request to specific URL with form data from PyString.
And I send a POST request to "/heroes/list" with form data:
"""
[
{
"postId": 1,
"id": 1,
"name": "I know who Batman is",
"email": "[email protected]",
}
]
"""
When I send a POST request to "/heroes/list" with form data:
"""
[
{
"postId": 1,
"id": 1,
"name": "I know who Batman is",
"email": "[email protected]",
}
]
"""
####Then the response code should be (\d+)
Checks that response has specific status code.
And the response code should be 503
Then the response code should be 200
####Then the response should contain "([^"]*)"
Checks that response body contains specific text.
And the response should contain "Bruce Wayne cannot be Batman."
Then the response should contain "Bruce Wayne cannot be Batman."
####Then the response should not contain "([^"]*)"
Checks that response body doesn't contains specific text.
And the response should not contain "Bruce Wayne is Batman."
Then the response should not contain "Bruce Wayne is Batman."
####Then the response should contain json: Checks that response body contains JSON from PyString.
And the response should contain json:
"""
[
{
"postId": 1,
"id": 1,
"name": "I know who Batman is",
"email": "[email protected]",
}
]
"""
Then the response should contain json:
"""
[
{
"postId": 1,
"id": 1,
"name": "I know who Batman is",
"email": "[email protected]",
}
]
"""
####Then print response Prints last response body.
Then print response
####Given I authenticated as "(\S+)"
Calls specified command
When I authenticated as "bruceWayne"
Given I authenticated as "bruceWayne"
####When I authenticate as "(\S+)"
Calls specified command
When I authenticated as "bruceWayne"
Given I authenticated as "bruceWayne"
####Given I called "(\S+)"
Calls specified command
When I called "heroes/list"
Given I called "heroes/list"
####When I call "(\S+)"
Calls specified command
When I called "heroes/list"
Given I called "heroes/list"
####Given I called "(\S+)"
with the following body text:
Calls specified command with text
Given I called "/heroes/list" with the following body text:
"""
[
{
"body": "I am not batman I take serious offense to any claims suggesting such outlandish remarks.",
"id" : 1
}
]
"""
When I called "/heroes/list" with the following body text:
"""
[
{
"body": "I am not batman I take serious offense to any claims suggesting such outlandish remarks.",
"id" : 1
}
]
"""
####When I call "(\S+)"
with the following body text:
Calls specified command with text
Given I called "/heroes/list" with the following body text:
"""
[
{
"body": "I am not batman I take serious offense to any claims suggesting such outlandish remarks.",
"id" : 1
}
]
"""
When I called "/heroes/list" with the following body text:
"""
[
{
"body": "I am not batman I take serious offense to any claims suggesting such outlandish remarks.",
"id" : 1
}
]
"""
####Given I called "(\S+)"
with the following value(s):
Calls specified command with fields
Given I called "/heroes/list" with the following values:
| userId | 27 |
| username | bruceWayne |
| password | iLoveBats123 |
When I called "/heroes/list" with the following values:
| userId | 27 |
| username | bruceWayne |
| password | iLoveBats123 |
####When I call "(\S+)"
with the following value(s):
Calls specified command with fields
Given I called "/heroes/list" with the following values:
| userId | 27 |
| username | bruceWayne |
| password | iLoveBats123 |
When I called "/heroes/list" with the following values:
| userId | 27 |
| username | bruceWayne |
| password | iLoveBats123 |
####Given I called "(\S+)"
with the following value(s) from JSON:
Calls specified command with fields
Given I called "/heroes/list" with the following values from JSON:
"""
[
{
"postId": 1,
"id": 1,
"name": "I know who Batman is",
"email": "[email protected]",
}
]
"""
When I called "/heroes/list" with the following values from JSON:
"""
[
{
"postId": 1,
"id": 1,
"name": "I know who Batman is",
"email": "[email protected]",
}
]
"""
####When I call "(\S+)"
with the following value(s) from JSON:
Calls specified command with fields
Given I called "/heroes/list" with the following values from JSON:
"""
[
{
"postId": 1,
"id": 1,
"name": "I know who Batman is",
"email": "[email protected]",
}
]
"""
When I called "/heroes/list" with the following values from JSON:
"""
[
{
"postId": 1,
"id": 1,
"name": "I know who Batman is",
"email": "[email protected]",
}
]
"""
####Then I get a response with a status code of :code
And I get a response with a status code of 503
Then I get a response with a status code of 503
####Then I get a successful response
And I get successful response
Then I get successful response
####Then I get an unsuccessful response with a status code of :code
And I get unsuccessful response with a status code of 503
Then I get unsuccessful response with a status code of 404
####Then the response contains the following value(s):
Then the response contains the following values:
| userId | 27 |
| username | bruceWayne |
| password | iLoveBats123 |
And the response contains the following value:
| userId | 27 |
####Then the response contains :count
resource(s) with the following data:
Then the response contains 3 resources with the following values:
| userId | 27 |
| username | bruceWayne |
| postId | 2 |
And the response contains 1 resource with the following value:
| userId | 27 |
####Then the response is stored as "(\S+)"
Then the response is stored as "heroes/list/users/batman"
And the response is stored as "heroes/list/users/batman"