Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | CRAP |
<?php | |
namespace Codeception\Util; | |
/** | |
* Interface for all Framework connectors. | |
* PhpBrowser acts similarly, as universal connector thus implements it too. | |
* | |
*/ | |
interface FrameworkInterface extends WebInterface | |
{ | |
/** | |
* 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. | |
* | |
* Examples: | |
* | |
* ``` php | |
* <?php | |
* $I->submitForm('#login', array('login' => 'davert', 'password' => '123456')); | |
* | |
* ``` | |
* | |
* For sample Sign Up form: | |
* | |
* ``` html | |
* <form action="/sign_up"> | |
* Login: <input type="text" name="user[login]" /><br/> | |
* Password: <input type="password" name="user[password]" /><br/> | |
* Do you agree to out terms? <input type="checkbox" name="user[agree]" /><br/> | |
* Select pricing plan <select name="plan"><option value="1">Free</option><option value="2" selected="selected">Paid</option></select> | |
* <input type="submit" value="Submit" /> | |
* </form> | |
* ``` | |
* I can write this: | |
* | |
* ``` php | |
* <?php | |
* $I->submitForm('#userForm', array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true))); | |
* | |
* ``` | |
* Note, that pricing plan will be set to Paid, as it's selected on page. | |
* | |
* @param $selector | |
* @param $params | |
*/ | |
public function submitForm($selector, $params); | |
/** | |
* 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. | |
* | |
* ``` php | |
* <?php | |
* $I->sendAjaxPostRequest('/updateSettings', array('notifications' => true); // POST | |
* $I->sendAjaxGetRequest('/updateSettings', array('notifications' => true); // GET | |
* | |
* ``` | |
* | |
* @param $uri | |
* @param $params | |
*/ | |
public function sendAjaxPostRequest($uri, $params = array()); | |
/** | |
* 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. | |
* | |
* @param $uri | |
* @param $params | |
*/ | |
public function sendAjaxGetRequest($uri, $params = array()); | |
/** | |
* Asserts that current page has 404 response status code. | |
*/ | |
public function seePageNotFound(); | |
/** | |
* Checks that response code is equal to value provided. | |
* | |
* @param $code | |
* @return mixed | |
*/ | |
public function seeResponseCodeIs($code); | |
/** | |
* Adds HTTP authentication via username/password. | |
* | |
* @param $username | |
* @param $password | |
*/ | |
public function amHttpAuthenticated($username, $password); | |
} |