I'm following through a video series on Laracasts to help me understand how to run tests in Laravel.
The test described is:
$this->visit('/')
->type('some query', '#term')
->press('Search')
->see('Search results for "some query"')
->onPage('search-results');
However Laravel complains that onPage
is not a valid method. I've looked through the docs but can't seem to find a change which best describes what alternative method to use.
I tried to do:
$this->visit('/')
->type('some query', '#term')
->press('Search')
->visit('/search-results')
->see('Search results for "some query"');
But it seems that the behaviour of that is to redirect to /search-results
before the form submits, meaning the output message is not the same and the assertion fails.
You can use seePageIs
method.
Assert that the current page matches a given URI.
You can see more tips at the docs.