Add a test that wont work due to auth issues currently
This commit is contained in:
parent
a44b4c4426
commit
aba1b297c8
|
@ -11,6 +11,8 @@ abstract class BasePage extends Page
|
||||||
*/
|
*/
|
||||||
public static function siteElements()
|
public static function siteElements()
|
||||||
{
|
{
|
||||||
return [];
|
return [
|
||||||
|
'@@success' => '.alert.success[role="alert"]',
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Pterodactyl\Tests\Browser\Pages\Dashboard;
|
||||||
|
|
||||||
|
use Pterodactyl\Tests\Browser\Pages\BasePage;
|
||||||
|
|
||||||
|
class AccountPage extends BasePage
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function url()
|
||||||
|
{
|
||||||
|
return '/account';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function elements()
|
||||||
|
{
|
||||||
|
return array_merge(parent::elements(), [
|
||||||
|
'@email' => '#update-email-container #grid-email',
|
||||||
|
'@password' => '#update-email-container #grid-password',
|
||||||
|
'@submit' => '#update-email-container button[type="submit"]',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Pterodactyl\Tests\Browser\Processes\Dashboard;
|
||||||
|
|
||||||
|
use Pterodactyl\Models\User;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Pterodactyl\Tests\Browser\BrowserTestCase;
|
||||||
|
use Pterodactyl\Tests\Browser\PterodactylBrowser;
|
||||||
|
use Pterodactyl\Tests\Browser\Pages\Dashboard\AccountPage;
|
||||||
|
|
||||||
|
class AccountEmailProcessTest extends BrowserTestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var \Pterodactyl\Models\User
|
||||||
|
*/
|
||||||
|
private $user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup a user for the test process to use.
|
||||||
|
*/
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->user = factory(User::class)->create([
|
||||||
|
'password' => Hash::make('Password123'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testEmailCanBeChanged()
|
||||||
|
{
|
||||||
|
$this->browse(function (PterodactylBrowser $browser) {
|
||||||
|
$browser->loginAs($this->user)
|
||||||
|
->visit(new AccountPage)
|
||||||
|
->assertValue('@email', $this->user->email)
|
||||||
|
->type('@email', 'new.email@example.com')
|
||||||
|
->type('@password', 'Password123')
|
||||||
|
->click('@submit')
|
||||||
|
->waitFor('@@success')
|
||||||
|
->assertSeeIn('@@success', trans('dashboard/account.email.updated'))
|
||||||
|
->assertValue('@email', 'new.email@example.com');
|
||||||
|
|
||||||
|
$this->assertDatabaseHas('users', ['id' => $this->user->id, 'email' => 'new.email@example.com']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue