Laravel - Browser Tests - Waiting On The Page Location

When making a path assertion such as $browser->assertPathIs('/home'), the assertion can fail if window.location.pathname is being updated asynchronously. You may use the waitForLocation method to wait for the location to be a given value:

    
    $browser->waitForLocation('/secret');
	

The waitForLocation method can also be used to wait for the current window location to be a fully qualified URL:

    
    $browser->waitForLocation('https://example.com/path');
	

You may also wait for a named route's location:

    
    $browser->waitForRoute($routeName, $parameters);