create([ 'email' => 'jane@example.com', 'password' => bcrypt('super-secret-password'), ]); $this->browse(function (Browser $browser) { $browser->visit('/login') ->type('email', 'jane@example.com') ->type('password', 'super-secret-password') ->press('Log in') ->assertPathIs('/backstage/concerts'); }); } /** @test */ public function logging_in_with_invalid_credentials() { $user = factory(User::class)->create([ 'email' => 'jane@example.com', 'password' => bcrypt('super-secret-password'), ]); $this->browse(function (Browser $browser) { $browser->visit('/login') ->type('email', 'jane@example.com') ->type('password', 'wrong-password') ->press('Log in') ->assertPathIs('/login') ->assertInputValue('email', 'jane@example.com') ->assertSee('credentials do not match'); }); } }