artisan('db:seed'); $this->setSettings([ 'reg_enabled' => true, 'registration.captcha.enabled' => false, 'tos' => false, 'approval.enabled' => false, 'reg_email_confirmation' => false, ]); }); it('renders the registration form', function () { visit('/register') ->assertNoJavaScriptErrors() ->assertSee('Register') ->assertPresent('#email') ->assertPresent('#username') ->assertPresent('#password'); }); it('registers a new user', function () { visit('/register') ->fill('#email', 'newcomer@vanguard.test') ->fill('#username', 'newcomer') ->fill('#password', 'sup3r-secret') ->fill('#password_confirmation', 'sup3r-secret') // The page heading is also "Register", and a text locator would match it // instead of the button. ->click('button[type="submit"]') // assertSee waits for the page to settle; assertPathIs does not, so a // content assertion has to come first after any navigation. ->assertSee('Dashboard') ->assertPathIs('/'); expect(User::where('email', 'newcomer@vanguard.test')->exists())->toBeTrue(); }); it('opens the terms of service dialog', function () { $this->setSettings(['tos' => true]); visit('/register') ->assertSee('I accept') ->click('Terms of Service') ->assertSee('Close'); }); it('returns a 404 when registration is disabled', function () { $this->setSettings(['reg_enabled' => false]); visit('/register')->assertSee('404'); });