Compare commits
3 commits
9054c25d0e
...
a84296ae29
| Author | SHA1 | Date | |
|---|---|---|---|
| a84296ae29 | |||
| 7b14aa240c | |||
| b048aca93b |
1 changed files with 49 additions and 0 deletions
49
tests/Browser/Auth/RegisterTest.php
Normal file
49
tests/Browser/Auth/RegisterTest.php
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
it('registers successfully', function () {
|
||||||
|
visit('/register')
|
||||||
|
->type('input[id="name"]', 'Test User')
|
||||||
|
->type('input[id="email"]', 'new@example.com')
|
||||||
|
->type('input[id="password"]', 'password123')
|
||||||
|
->type('input[id="password_confirmation"]', 'password123')
|
||||||
|
->press('Register')
|
||||||
|
->assertPathIs('/dashboard')
|
||||||
|
->assertSee('Test User');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('requires all registration fields', function () {
|
||||||
|
visit('/register')
|
||||||
|
->assertScript("document.querySelector('input[id=\"name\"]').required")
|
||||||
|
->assertScript("document.querySelector('input[id=\"email\"]').required")
|
||||||
|
->assertScript("document.querySelector('input[id=\"password\"]').required")
|
||||||
|
->assertScript("document.querySelector('input[id=\"password_confirmation\"]').required")
|
||||||
|
->assertAttribute('input[id="email"]', 'type', 'email')
|
||||||
|
->assertAttribute('input[id="password"]', 'type', 'password')
|
||||||
|
->assertAttribute('input[id="password_confirmation"]', 'type', 'password')
|
||||||
|
->press('Register')
|
||||||
|
->assertPathIs('/register');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('rejects a mismatched password confirmation', function () {
|
||||||
|
visit('/register')
|
||||||
|
->type('input[id="name"]', 'Test User')
|
||||||
|
->type('input[id="email"]', 'new@example.com')
|
||||||
|
->type('input[id="password"]', 'password123')
|
||||||
|
->type('input[id="password_confirmation"]', 'different123')
|
||||||
|
->press('Register')
|
||||||
|
->assertPathIs('/register')
|
||||||
|
->assertSee('confirmation does not match');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('rejects a duplicate email', function () {
|
||||||
|
createPlanner('taken@example.com');
|
||||||
|
|
||||||
|
visit('/register')
|
||||||
|
->type('input[id="name"]', 'Test User')
|
||||||
|
->type('input[id="email"]', 'taken@example.com')
|
||||||
|
->type('input[id="password"]', 'password123')
|
||||||
|
->type('input[id="password_confirmation"]', 'password123')
|
||||||
|
->press('Register')
|
||||||
|
->assertPathIs('/register')
|
||||||
|
->assertSee('has already been taken');
|
||||||
|
});
|
||||||
Loading…
Reference in a new issue