trait InteractsWithPages (View source)
protected Crawler | $crawler | The DomCrawler instance. | |
protected array | $subCrawlers | Nested crawler instances used by the "within" method. | |
protected array | $inputs | All of the stored inputs for the current page. | |
protected array | $uploads | All of the stored uploads for the current page. |
$this | visit(string $uri) Visit the given URI with a GET request. | |
$this | visitRoute(string $route, array $parameters = []) Visit the given named route with a GET request. | |
$this | makeRequest(string $method, string $uri, array $parameters = [], array $cookies = [], array $files = []) Make a request to the application and create a Crawler instance. | |
$this | resetPageContext() Clean the crawler and the subcrawlers values to reset the page context. | |
$this | makeRequestUsingForm(Form $form, array $uploads = []) Make a request to the application using the given form. | |
array | extractParametersFromForm(Form $form) Extract the parameters from the given form. | |
$this | followRedirects() Follow redirects from the last response. | |
$this | clearInputs() Clear the inputs for the current page. | |
$this | seePageIs(string $uri) Assert that the current page matches a given URI. | |
$this | seeRouteIs(string $route, array $parameters = []) Assert that the current page matches a given named route. | |
$this | assertPageLoaded(string $uri, string|null $message = null) Assert that a given page successfully loaded. | |
$this | within(string $element, Closure $callback) Narrow the test content to a specific area of the page. | |
Crawler | crawler() Get the current crawler according to the test context. | |
$this | assertInPage(PageConstraint $constraint, bool $reverse = false, string $message = '') Assert the given constraint. | |
$this | see(string $text, bool $negate = false) Assert that a given string is seen on the current HTML. | |
$this | dontSee(string $text) Assert that a given string is not seen on the current HTML. | |
$this | seeElement(string $selector, array $attributes = [], bool $negate = false) Assert that an element is present on the page. | |
$this | dontSeeElement(string $selector, array $attributes = []) Assert that an element is not present on the page. | |
$this | seeText(string $text, bool $negate = false) Assert that a given string is seen on the current text. | |
$this | dontSeeText(string $text) Assert that a given string is not seen on the current text. | |
$this | seeInElement(string $element, string $text, bool $negate = false) Assert that a given string is seen inside an element. | |
$this | dontSeeInElement(string $element, string $text) Assert that a given string is not seen inside an element. | |
$this | seeLink(string $text, string|null $url = null, bool $negate = false) Assert that a given link is seen on the page. | |
$this | dontSeeLink(string $text, string|null $url = null) Assert that a given link is not seen on the page. | |
$this | seeInField(string $selector, string $expected, bool $negate = false) Assert that an input field contains the given value. | |
$this | dontSeeInField(string $selector, string $value) Assert that an input field does not contain the given value. | |
$this | seeIsSelected(string $selector, string $value, bool $negate = false) Assert that the expected value is selected. | |
$this | dontSeeIsSelected(string $selector, string $value) Assert that the given value is not selected. | |
$this | seeIsChecked(string $selector, bool $negate = false) Assert that the given checkbox is selected. | |
$this | dontSeeIsChecked(string $selector) Assert that the given checkbox is not selected. | |
$this | click(string $name) Click a link with the given body, name, or ID attribute. | |
$this | type(string $text, string $element) Fill an input field with the given text. | |
$this | check(string $element) Check a checkbox on the page. | |
$this | uncheck(string $element) Uncheck a checkbox on the page. | |
$this | select(string $option, string $element) Select an option from a drop-down. | |
$this | attach(string $absolutePath, string $element) Attach a file to a form field on the page. | |
$this | press(string $buttonText) Submit a form using the button with the given text value. | |
$this | submitForm(string $buttonText, array $inputs = [], array $uploads = []) Submit a form on the page with the given input. | |
Form | fillForm(string $buttonText, array $inputs = []) Fill the form with the given data. | |
Form | getForm(string|null $buttonText = null) Get the form from the page with the given submit button text. | |
$this | storeInput(string $element, string $text) Store a form input in the local array. | |
$this | assertFilterProducesResults(string $filter) Assert that a filtered Crawler returns nodes. | |
Crawler | filterByNameOrId(string $name, array|string $elements = '*') Filter elements according to the given name or ID attribute. | |
array | convertUploadsForTesting(Form $form, array $uploads) Convert the given uploads to UploadedFile instances. | |
prepareArrayBasedFileInput(array $uploads, string $key, mixed $file) Store an array based file upload with the proper nested array structure. | ||
UploadedFile | getUploadedFileForTesting(array $file, array $uploads, string $name) Create an UploadedFile instance for testing. |
Visit the given URI with a GET request.
Visit the given named route with a GET request.
Make a request to the application and create a Crawler instance.
Clean the crawler and the subcrawlers values to reset the page context.
Make a request to the application using the given form.
Extract the parameters from the given form.
Follow redirects from the last response.
Clear the inputs for the current page.
Assert that the current page matches a given URI.
Assert that the current page matches a given named route.
Assert that a given page successfully loaded.
Narrow the test content to a specific area of the page.
Get the current crawler according to the test context.
Assert the given constraint.
Assert that a given string is seen on the current HTML.
Assert that a given string is not seen on the current HTML.
Assert that an element is present on the page.
Assert that an element is not present on the page.
Assert that a given string is seen on the current text.
Assert that a given string is not seen on the current text.
Assert that a given string is seen inside an element.
Assert that a given string is not seen inside an element.
Assert that a given link is seen on the page.
Assert that a given link is not seen on the page.
Assert that an input field contains the given value.
Assert that an input field does not contain the given value.
Assert that the expected value is selected.
Assert that the given value is not selected.
Assert that the given checkbox is selected.
Assert that the given checkbox is not selected.
Click a link with the given body, name, or ID attribute.
Fill an input field with the given text.
Check a checkbox on the page.
Uncheck a checkbox on the page.
Select an option from a drop-down.
Attach a file to a form field on the page.
Submit a form using the button with the given text value.
Submit a form on the page with the given input.
Fill the form with the given data.
Get the form from the page with the given submit button text.
Store a form input in the local array.
Assert that a filtered Crawler returns nodes.
Filter elements according to the given name or ID attribute.
Convert the given uploads to UploadedFile instances.
Store an array based file upload with the proper nested array structure.
Create an UploadedFile instance for testing.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.5/Illuminate/Foundation/Testing/Concerns/InteractsWithPages.html