Stud.IP
4.2 Revision
|
Public Member Functions | |||||
setHeader ($header, $value) | |||||
amHttpAuthenticated ($username, $password) | |||||
amOnUrl ($url) | |||||
amOnSubdomain ($subdomain) | |||||
executeInGuzzle ($function) | |||||
amOnPage ($page) | |||||
click ($link, $context=null) | |||||
canSee ($text, $selector=null) | |||||
see ($text, $selector=null) | |||||
cantSee ($text, $selector=null) | |||||
dontSee ($text, $selector=null) | |||||
canSeeLink ($text, $url=null) | |||||
seeLink ($text, $url=null) | |||||
cantSeeLink ($text, $url=null) | |||||
dontSeeLink ($text, $url=null) | |||||
canSeeInCurrentUrl ($uri) | |||||
seeInCurrentUrl ($uri) | |||||
cantSeeInCurrentUrl ($uri) | |||||
dontSeeInCurrentUrl ($uri) | |||||
canSeeCurrentUrlEquals ($uri) | |||||
seeCurrentUrlEquals ($uri) | |||||
cantSeeCurrentUrlEquals ($uri) | |||||
dontSeeCurrentUrlEquals ($uri) | |||||
canSeeCurrentUrlMatches ($uri) | |||||
seeCurrentUrlMatches ($uri) | |||||
cantSeeCurrentUrlMatches ($uri) | |||||
dontSeeCurrentUrlMatches ($uri) | |||||
grabFromCurrentUrl ($uri=null) | |||||
=agree]'); | |||||
[!] Method is generated. Documentation taken from corresponding module. Assert if the specified checkbox is checked. Use css selector or xpath to match. Example: <?php $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form. $I->seeCheckboxIsChecked('//form/input[@type=checkbox and ?>
| |||||
canSeeCheckboxIsChecked ($checkbox) | |||||
seeCheckboxIsChecked ($checkbox) | |||||
cantSeeCheckboxIsChecked ($checkbox) | |||||
dontSeeCheckboxIsChecked ($checkbox) | |||||
=search]','Search'); | |||||
[!] Method is generated. Documentation taken from corresponding module. Checks that an input field or textarea doesn't contain value. Field is matched either by label or CSS or Xpath Example:
| |||||
canSeeInField ($field, $value) | |||||
seeInField ($field, $value) | |||||
cantSeeInField ($field, $value) | |||||
dontSeeInField ($field, $value) | |||||
submitForm ($selector, $params, $button=null) | |||||
fillField ($field, $value) | |||||
=account]', 'Monthly'); | |||||
[!] Method is generated. Documentation taken from corresponding module. Selects an option in select tag or in radio button group. Example: Can select multiple options if second argument is array:
| |||||
selectOption ($select, $option) | |||||
checkOption ($option) | |||||
uncheckOption ($option) | |||||
attachFile ($field, $filename) | |||||
sendAjaxGetRequest ($uri, $params=null) | |||||
sendAjaxPostRequest ($uri, $params=null) | |||||
sendAjaxRequest ($method, $uri, $params=null) | |||||
grabTextFrom ($cssOrXPathOrRegex) | |||||
grabAttributeFrom ($cssOrXpath, $attribute) | |||||
grabValueFrom ($field) | |||||
setCookie ($name, $val) | |||||
grabCookie ($name) | |||||
canSeeCookie ($name) | |||||
seeCookie ($name) | |||||
cantSeeCookie ($name) | |||||
dontSeeCookie ($name) | |||||
resetCookie ($name) | |||||
canSeeElement ($selector, $attributes=null) | |||||
seeElement ($selector, $attributes=null) | |||||
cantSeeElement ($selector, $attributes=null) | |||||
dontSeeElement ($selector, $attributes=null) | |||||
canSeeNumberOfElements ($selector, $expected) | |||||
seeNumberOfElements ($selector, $expected) | |||||
canSeeOptionIsSelected ($select, $optionText) | |||||
seeOptionIsSelected ($select, $optionText) | |||||
cantSeeOptionIsSelected ($select, $optionText) | |||||
dontSeeOptionIsSelected ($select, $optionText) | |||||
canSeePageNotFound () | |||||
seePageNotFound () | |||||
canSeeResponseCodeIs ($code) | |||||
seeResponseCodeIs ($code) | |||||
canSeeInTitle ($title) | |||||
seeInTitle ($title) | |||||
cantSeeInTitle ($title) | |||||
dontSeeInTitle ($title) | |||||
Inherited Methods void wantToTest($text) void wantTo($text) void execute($callable) void expectTo($prediction) void expect($prediction) void amGoingTo($argumentation) void am($role) void lookForwardTo($achieveValue) void comment($description) void haveFriend($name, $actorClass = null)
amHttpAuthenticated | ( | $username, | |
$password | |||
) |
[!] Method is generated. Documentation taken from corresponding module.
Authenticates user for HTTP_AUTH
$username | |
$password |
amOnPage | ( | $page | ) |
amOnSubdomain | ( | $subdomain | ) |
[!] Method is generated. Documentation taken from corresponding module.
Sets 'url' configuration parameter to hosts subdomain. It does not open a page on subdomain. Use amOnPage
for that
$subdomain |
amOnUrl | ( | $url | ) |
[!] Method is generated. Documentation taken from corresponding module.
Open web page at absolute URL. Base url will be reconfigured to use the host of provided Url.
attachFile | ( | $field, | |
$filename | |||
) |
[!] Method is generated. Documentation taken from corresponding module.
Attaches file from Codeception data directory to upload field.
Example:
$field | |
$filename |
canSee | ( | $text, | |
$selector = null |
|||
) |
[!] Method is generated. Documentation taken from corresponding module.
Check if current page contains the text specified. Specify the css selector to match only specific region.
Examples:
$text | ||
null | $selector | Conditional Assertion: Test won't be stopped on fail |
canSeeCheckboxIsChecked | ( | $checkbox | ) |
canSeeCookie | ( | $name | ) |
[!] Method is generated. Documentation taken from corresponding module.
Checks that cookie is set.
$cookie |
canSeeCurrentUrlEquals | ( | $uri | ) |
[!] Method is generated. Documentation taken from corresponding module.
Checks that current url is equal to value. Unlike seeInCurrentUrl
performs a strict check.
$uri | Conditional Assertion: Test won't be stopped on fail |
canSeeCurrentUrlMatches | ( | $uri | ) |
canSeeElement | ( | $selector, | |
$attributes = null |
|||
) |
[!] Method is generated. Documentation taken from corresponding module.
Checks if element exists on a page, matching it by CSS or XPath. You can also specify expected attributes of this element.
$selector | ||
array | $attributes |
canSeeInCurrentUrl | ( | $uri | ) |
[!] Method is generated. Documentation taken from corresponding module.
Checks that current uri contains a value
$uri | Conditional Assertion: Test won't be stopped on fail |
canSeeInField | ( | $field, | |
$value | |||
) |
canSeeInTitle | ( | $title | ) |
canSeeLink | ( | $text, | |
$url = null |
|||
) |
[!] Method is generated. Documentation taken from corresponding module.
Checks if there is a link with text specified. Specify url to match link with exact this url.
Examples:
$text | ||
null | $url | Conditional Assertion: Test won't be stopped on fail |
canSeeNumberOfElements | ( | $selector, | |
$expected | |||
) |
[!] Method is generated. Documentation taken from corresponding module.
Tests number of $elements on page
$selector | ||
mixed | $expected, |
|
canSeeOptionIsSelected | ( | $select, | |
$optionText | |||
) |
[!] Method is generated. Documentation taken from corresponding module.
Checks if option is selected in select field.
$selector | |
$optionText |
canSeePageNotFound | ( | ) |
[!] Method is generated. Documentation taken from corresponding module.
Asserts that current page has 404 response status code. Conditional Assertion: Test won't be stopped on fail
canSeeResponseCodeIs | ( | $code | ) |
[!] Method is generated. Documentation taken from corresponding module.
Checks that response code is equal to value provided.
$code |
cantSee | ( | $text, | |
$selector = null |
|||
) |
[!] Method is generated. Documentation taken from corresponding module.
Check if current page doesn't contain the text specified. Specify the css selector to match only specific region.
Examples:
$text | ||
null | $selector | Conditional Assertion: Test won't be stopped on fail |
cantSeeCheckboxIsChecked | ( | $checkbox | ) |
[!] Method is generated. Documentation taken from corresponding module.
Assert if the specified checkbox is unchecked. Use css selector or xpath to match.
Example:
$checkbox | Conditional Assertion: Test won't be stopped on fail |
cantSeeCookie | ( | $name | ) |
[!] Method is generated. Documentation taken from corresponding module.
Checks that cookie doesn't exist
$cookie |
cantSeeCurrentUrlEquals | ( | $uri | ) |
[!] Method is generated. Documentation taken from corresponding module.
Checks that current url is not equal to value. Unlike dontSeeInCurrentUrl
performs a strict check.
$uri | Conditional Assertion: Test won't be stopped on fail |
cantSeeCurrentUrlMatches | ( | $uri | ) |
[!] Method is generated. Documentation taken from corresponding module.
Checks that current url does not match a RegEx value
$uri | Conditional Assertion: Test won't be stopped on fail |
cantSeeElement | ( | $selector, | |
$attributes = null |
|||
) |
[!] Method is generated. Documentation taken from corresponding module.
Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath You can also specify expected attributes of this element.
Example:
$selector | Conditional Assertion: Test won't be stopped on fail |
cantSeeInCurrentUrl | ( | $uri | ) |
cantSeeInField | ( | $field, | |
$value | |||
) |
cantSeeInTitle | ( | $title | ) |
[!] Method is generated. Documentation taken from corresponding module.
Checks that page title does not contain text.
$title |
cantSeeLink | ( | $text, | |
$url = null |
|||
) |
[!] Method is generated. Documentation taken from corresponding module.
Checks if page doesn't contain the link with text specified. Specify url to narrow the results.
Examples:
$text | ||
null | $url | Conditional Assertion: Test won't be stopped on fail |
cantSeeOptionIsSelected | ( | $select, | |
$optionText | |||
) |
[!] Method is generated. Documentation taken from corresponding module.
Checks if option is not selected in select field.
$selector | |
$optionText |
checkOption | ( | $option | ) |
[!] Method is generated. Documentation taken from corresponding module.
Ticks a checkbox. For radio buttons use selectOption
method.
Example:
$option |
click | ( | $link, | |
$context = null |
|||
) |
[!] Method is generated. Documentation taken from corresponding module.
Perform a click on link or button. Link or button are found by their names or CSS selector. Submits a form if button is a submit type.
If link is an image it's found by alt attribute value of image. If button is image button is found by it's value If link or button can't be found by name they are searched by CSS selector.
The second parameter is a context: CSS or XPath locator to narrow the search.
Examples:
$link | |
$context |
dontSee | ( | $text, | |
$selector = null |
|||
) |
[!] Method is generated. Documentation taken from corresponding module.
Check if current page doesn't contain the text specified. Specify the css selector to match only specific region.
Examples:
$text | ||
null | $selector |
dontSeeCheckboxIsChecked | ( | $checkbox | ) |
[!] Method is generated. Documentation taken from corresponding module.
Assert if the specified checkbox is unchecked. Use css selector or xpath to match.
Example:
$checkbox |
dontSeeCookie | ( | $name | ) |
[!] Method is generated. Documentation taken from corresponding module.
Checks that cookie doesn't exist
$cookie |
dontSeeCurrentUrlEquals | ( | $uri | ) |
[!] Method is generated. Documentation taken from corresponding module.
Checks that current url is not equal to value. Unlike dontSeeInCurrentUrl
performs a strict check.
$uri |
dontSeeCurrentUrlMatches | ( | $uri | ) |
[!] Method is generated. Documentation taken from corresponding module.
Checks that current url does not match a RegEx value
$uri |
dontSeeElement | ( | $selector, | |
$attributes = null |
|||
) |
[!] Method is generated. Documentation taken from corresponding module.
Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath You can also specify expected attributes of this element.
Example:
$selector |
dontSeeInCurrentUrl | ( | $uri | ) |
[!] Method is generated. Documentation taken from corresponding module.
Checks that current uri does not contain a value
$uri |
dontSeeInField | ( | $field, | |
$value | |||
) |
dontSeeInTitle | ( | $title | ) |
[!] Method is generated. Documentation taken from corresponding module.
Checks that page title does not contain text.
$title |
dontSeeLink | ( | $text, | |
$url = null |
|||
) |
[!] Method is generated. Documentation taken from corresponding module.
Checks if page doesn't contain the link with text specified. Specify url to narrow the results.
Examples:
$text | ||
null | $url |
dontSeeOptionIsSelected | ( | $select, | |
$optionText | |||
) |
[!] Method is generated. Documentation taken from corresponding module.
Checks if option is not selected in select field.
$selector | |
$optionText |
executeInGuzzle | ( | $function | ) |
[!] Method is generated. Documentation taken from corresponding module.
Low-level API method. If Codeception commands are not enough, use Guzzle HTTP Client methods directly
Example:
It is not recommended to use this command on a regular basis. If Codeception lacks important Guzzle Client methods, implement them and submit patches.
callable | $function |
fillField | ( | $field, | |
$value | |||
) |
grabAttributeFrom | ( | $cssOrXpath, | |
$attribute | |||
) |
[!] Method is generated. Documentation taken from corresponding module.
Grabs attribute value from an element. Fails if element is not found.
$cssOrXpath | |
$attribute |
grabCookie | ( | $name | ) |
[!] Method is generated. Documentation taken from corresponding module.
Grabs a cookie value.
$cookie |
grabFromCurrentUrl | ( | $uri = null | ) |
grabTextFrom | ( | $cssOrXPathOrRegex | ) |
[!] Method is generated. Documentation taken from corresponding module.
Finds and returns text contents of element. Element is searched by CSS selector, XPath or matcher by regex.
Example:
$cssOrXPathOrRegex |
grabValueFrom | ( | $field | ) |
[!] Method is generated. Documentation taken from corresponding module.
$field |
resetCookie | ( | $name | ) |
[!] Method is generated. Documentation taken from corresponding module.
Unsets cookie
$cookie |
see | ( | $text, | |
$selector = null |
|||
) |
[!] Method is generated. Documentation taken from corresponding module.
Check if current page contains the text specified. Specify the css selector to match only specific region.
Examples:
$text | ||
null | $selector |
seeCheckboxIsChecked | ( | $checkbox | ) |
seeCookie | ( | $name | ) |
[!] Method is generated. Documentation taken from corresponding module.
Checks that cookie is set.
$cookie |
seeCurrentUrlEquals | ( | $uri | ) |
[!] Method is generated. Documentation taken from corresponding module.
Checks that current url is equal to value. Unlike seeInCurrentUrl
performs a strict check.
$uri |
seeCurrentUrlMatches | ( | $uri | ) |
[!] Method is generated. Documentation taken from corresponding module.
Checks that current url is matches a RegEx value
$uri |
seeElement | ( | $selector, | |
$attributes = null |
|||
) |
[!] Method is generated. Documentation taken from corresponding module.
Checks if element exists on a page, matching it by CSS or XPath. You can also specify expected attributes of this element.
$selector | ||
array | $attributes |
seeInCurrentUrl | ( | $uri | ) |
seeInField | ( | $field, | |
$value | |||
) |
seeInTitle | ( | $title | ) |
[!] Method is generated. Documentation taken from corresponding module.
Checks that page title contains text.
$title |
seeLink | ( | $text, | |
$url = null |
|||
) |
[!] Method is generated. Documentation taken from corresponding module.
Checks if there is a link with text specified. Specify url to match link with exact this url.
Examples:
$text | ||
null | $url |
seeNumberOfElements | ( | $selector, | |
$expected | |||
) |
[!] Method is generated. Documentation taken from corresponding module.
Tests number of $elements on page
$selector | ||
mixed | $expected, |
|
seeOptionIsSelected | ( | $select, | |
$optionText | |||
) |
[!] Method is generated. Documentation taken from corresponding module.
Checks if option is selected in select field.
$selector | |
$optionText |
seePageNotFound | ( | ) |
[!] Method is generated. Documentation taken from corresponding module.
Asserts that current page has 404 response status code.
seeResponseCodeIs | ( | $code | ) |
[!] Method is generated. Documentation taken from corresponding module.
Checks that response code is equal to value provided.
$code |
selectOption | ( | $select, | |
$option | |||
) |
sendAjaxGetRequest | ( | $uri, | |
$params = null |
|||
) |
[!] Method is generated. Documentation taken from corresponding module.
If your page triggers an ajax request, you can perform it manually. This action sends a GET ajax request with specified params.
See ->sendAjaxPostRequest for examples.
$uri | |
$params |
sendAjaxPostRequest | ( | $uri, | |
$params = null |
|||
) |
[!] Method is generated. Documentation taken from corresponding module.
If your page triggers an ajax request, you can perform it manually. This action sends a POST ajax request with specified params. Additional params can be passed as array.
Example:
Imagine that by clicking checkbox you trigger ajax request which updates user settings. We emulate that click by running this ajax request manually.
$uri | |
$params |
sendAjaxRequest | ( | $method, | |
$uri, | |||
$params = null |
|||
) |
[!] Method is generated. Documentation taken from corresponding module.
If your page triggers an ajax request, you can perform it manually. This action sends an ajax request with specified method and params.
Example:
You need to perform an ajax request specifying the HTTP method.
$method | |
$uri | |
$params |
setCookie | ( | $name, | |
$val | |||
) |
[!] Method is generated. Documentation taken from corresponding module.
Sets a cookie.
$cookie | |
$value |
setHeader | ( | $header, | |
$value | |||
) |
[!] Method is generated. Documentation taken from corresponding module.
submitForm | ( | $selector, | |
$params, | |||
$button = null |
|||
) |
[!] Method is generated. Documentation taken from corresponding module.
Submits a form located on page. Specify the form by it's css or xpath selector. Fill the form fields values as array.
Skipped fields will be filled by their values from page. You don't need to click the 'Submit' button afterwards. This command itself triggers the request to form's action.
You can optionally specify what button's value to include in the request with the last parameter as an alternative to explicitly setting its value in the second parameter, as button values are not otherwise included in the request.
Examples:
For a sample Sign Up form:
You could write the following to submit it:
Note that "2" will be the submitted value for the "plan" field, as it is the selected option.
You can also emulate a JavaScript submission by not specifying any buttons in the third parameter to submitForm.
$selector | |
$params | |
$button |
uncheckOption | ( | $option | ) |
[!] Method is generated. Documentation taken from corresponding module.
Unticks a checkbox.
Example:
$option |