diff --git a/tests/Browser/LoginDashAdminTest.php b/tests/Browser/LoginDashAdminTest.php new file mode 100644 index 0000000..b5d2bc3 --- /dev/null +++ b/tests/Browser/LoginDashAdminTest.php @@ -0,0 +1,60 @@ +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 + ); + }); + } +} \ No newline at end of file