Add tests for all of the account actions

This commit is contained in:
Dane Everitt 2018-07-15 15:58:24 -07:00
parent be2c76c24a
commit d9a09e92bd
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
9 changed files with 243 additions and 24 deletions

View file

@ -2,27 +2,11 @@
namespace Pterodactyl\Tests\Browser\Processes\Dashboard;
use Pterodactyl\Tests\Browser\BrowserTestCase;
use Pterodactyl\Tests\Browser\PterodactylBrowser;
use Pterodactyl\Tests\Browser\Pages\Dashboard\AccountPage;
class AccountEmailProcessTest extends BrowserTestCase
class AccountEmailProcessTest extends DashboardTestCase
{
/**
* @var \Pterodactyl\Models\User
*/
private $user;
/**
* Setup tests.
*/
protected function setUp()
{
parent::setUp();
$this->user = $this->user();
}
/**
* Test that an email address can be changed successfully.
*/
@ -43,6 +27,23 @@ class AccountEmailProcessTest extends BrowserTestCase
});
}
/**
* Test that the validation error message shows up when an invalid email is entered.
*/
public function testInvalidEmailShowsErrors()
{
$this->browse(function (PterodactylBrowser $browser) {
$browser->loginAs($this->user)
->visit(new AccountPage)
->assertMissing('@email ~ .input-help.error')
->type('@email', 'admin')
->assertVisible('@email ~ .input-help.error')
->assertSeeIn('@email ~ .input-help.error', 'The email field must be a valid email.')
->type('@email', 'admin@example.com')
->assertMissing('@email ~ .input-help.error');
});
}
/**
* Test that entering the wrong password for an account returns an error.
*/