Laravel - Browser Tests - Navigating To Pages

Once a page has been defined, you may navigate to it using the visit method:

    
    use Tests\Browser\Pages\Login;
    
    $browser->visit(new Login);
	

Sometimes you may already be on a given page and need to "load" the page's selectors and methods into the current test context. This is common when pressing a button and being redirected to a given page without explicitly navigating to it. In this situation, you may use the on method to load the page:

    
    use Tests\Browser\Pages\CreatePlaylist;
    
    $browser->visit('/dashboard')
            ->clickLink('Create Playlist')
            ->on(new CreatePlaylist)
            ->assertSee('@create');