X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/3b7d223b0c7f4ebc9f4b9d7ce4efb2f5fa6ef4ed..refs/pull/234/head:/tests/Auth/AuthTest.php diff --git a/tests/Auth/AuthTest.php b/tests/Auth/AuthTest.php index 08d5ef8ad..664ec297a 100644 --- a/tests/Auth/AuthTest.php +++ b/tests/Auth/AuthTest.php @@ -24,7 +24,7 @@ class AuthTest extends TestCase $settings->put('app-public', 'true'); $this->visit('/') ->seePageIs('/') - ->see('Sign In'); + ->see('Log In'); } public function test_registration_showing() @@ -132,7 +132,7 @@ class AuthTest extends TestCase $this->asAdmin() ->visit('/settings/users') - ->click('Add new user') + ->click('Add New User') ->type($user->name, '#name') ->type($user->email, '#email') ->check('roles[admin]') @@ -218,6 +218,37 @@ class AuthTest extends TestCase ->seePageIs('/login'); } + public function test_reset_password_flow() + { + $this->visit('/login')->click('Forgot Password?') + ->seePageIs('/password/email') + ->type('admin@admin.com', 'email') + ->press('Send Reset Link') + ->see('A password reset link has been sent to admin@admin.com'); + + $this->seeInDatabase('password_resets', [ + 'email' => 'admin@admin.com' + ]); + + $reset = DB::table('password_resets')->where('email', '=', 'admin@admin.com')->first(); + $this->visit('/password/reset/' . $reset->token) + ->see('Reset Password') + ->submitForm('Reset Password', [ + 'email' => 'admin@admin.com', + 'password' => 'randompass', + 'password_confirmation' => 'randompass' + ])->seePageIs('/') + ->see('Your password has been successfully reset'); + } + + public function test_reset_password_page_shows_sign_links() + { + $this->setSettings(['registration-enabled' => 'true']); + $this->visit('/password/email') + ->seeLink('Log in') + ->seeLink('Sign up'); + } + /** * Perform a login * @param string $email @@ -229,6 +260,6 @@ class AuthTest extends TestCase return $this->visit('/login') ->type($email, '#email') ->type($password, '#password') - ->press('Sign In'); + ->press('Log In'); } }