feat: change order of Dusk tests
for login, image upload, and entry creation in admin panel
This commit is contained in:
parent
56ce59fc22
commit
22393b5954
3 changed files with 0 additions and 0 deletions
60
tests/Browser/001_LoginDashAdminTest.php
Normal file
60
tests/Browser/001_LoginDashAdminTest.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Browser;
|
||||
|
||||
use Illuminate\Foundation\Testing\DatabaseTruncation;
|
||||
use Laravel\Dusk\Browser;
|
||||
use Tests\Browser\Concerns\AuthenticatesUsers;
|
||||
use Tests\DuskTestCase;
|
||||
|
||||
class LoginTest extends DuskTestCase
|
||||
{
|
||||
use DatabaseTruncation;
|
||||
use AuthenticatesUsers;
|
||||
|
||||
public function test_login(): void
|
||||
{
|
||||
$user = $this->createTestUser("login-test@example.com");
|
||||
|
||||
$this->browse(function (Browser $browser) use ($user) {
|
||||
$this->loginUser($browser, $user);
|
||||
$this->assertWithDebugPause($browser, fn($b) =>
|
||||
$b->assertPathIs('/dashboard'),
|
||||
1000 // Custom pause time for this test
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
public function test_invalid_login(): void
|
||||
{
|
||||
$user = $this->createTestUser("invalid-email@example.com");
|
||||
|
||||
$this->browse(function (Browser $browser) use ($user) {
|
||||
$this->loginUser($browser, $user);
|
||||
$this->assertWithDebugPause($browser, fn($b) =>
|
||||
$b->visit('/admin')
|
||||
->waitForLocation('/admin')
|
||||
->assertPathIs('/admin')
|
||||
->assertSee('FORBIDDEN'),
|
||||
1000 // Custom pause time for this test
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
public function test_access_admin_panel(): void
|
||||
{
|
||||
$user = $this->createTestUser("login-test@example.com");
|
||||
|
||||
$this->browse(function (Browser $browser) use ($user) {
|
||||
$this->loginUser($browser, $user);
|
||||
$this->assertWithDebugPause($browser, fn($b) =>
|
||||
$b->visit('/admin')
|
||||
->waitForLocation('/admin')
|
||||
->assertPathIs('/admin')
|
||||
->assertTitleContains('Dashboard')
|
||||
->assertDontSee('FORBIDDEN'),
|
||||
1000 // Custom pause time for this test
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue