forked from pterodactyl/panel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForgotPasswordProcessTest.php
More file actions
50 lines (46 loc) · 1.99 KB
/
ForgotPasswordProcessTest.php
File metadata and controls
50 lines (46 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace Pterodactyl\Tests\Browser\Processes\Authentication;
use Pterodactyl\Tests\Browser\BrowserTestCase;
use Pterodactyl\Tests\Browser\Pages\LoginPage;
use Pterodactyl\Tests\Browser\PterodactylBrowser;
class ForgotPasswordProcessTest extends BrowserTestCase
{
/**
* Test that the password reset page works as expected and displays the expected
* success messages to the client when submitted.
*/
public function testResetPasswordWithInvalidAccount()
{
$this->browse(function (PterodactylBrowser $browser) {
$browser->visit(new LoginPage)
->assertSee(trans('auth.forgot_password.label'))
->click('@forgotPassword')
->waitForLocation('/auth/password')
->assertFocused('@email')
->assertSeeIn('.input-open > p.text-xs', trans('auth.forgot_password.label_help'))
->assertSeeIn('@submitButton', trans('auth.forgot_password.button'))
->type('@email', 'unassociated@example.com')
->assertSeeIn('@goToLogin', trans('auth.go_to_login'))
->press('@submitButton')
->waitForLocation('/auth/login')
->assertSeeIn('div[role="alert"].success > span.message', 'We have e-mailed your password reset link!')
->assertFocused('@username')
->assertValue('@username', 'unassociated@example.com');
});
}
/**
* Test that you can type in your email address and then click forgot password and have
* the email maintained on the new page.
*/
public function testEmailCarryover()
{
$this->browse(function (PterodactylBrowser $browser) {
$browser->visit(new LoginPage)
->type('@username', 'dane@example.com')
->click('@forgotPassword')
->waitForLocation('/auth/password')
->assertFocused('@email')
->assertValue('@email', 'dane@example.com');
});
}
}