From 707ff433db21771483d08d59ee16e95beacb7ac5 Mon Sep 17 00:00:00 2001 From: Alan Neves Date: Thu, 20 Aug 2026 13:05:17 -0300 Subject: [PATCH 1/6] teste do dusk sem callback automatico --- .env.example | 2 +- tests/Browser/LoginLogoutTest.php | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 tests/Browser/LoginLogoutTest.php diff --git a/.env.example b/.env.example index bfa2805..984f2d0 100644 --- a/.env.example +++ b/.env.example @@ -66,7 +66,7 @@ REPLICADO_FAKE=1 SENHAUNICA_KEY=faker SENHAUNICA_SECRET=faker SENHAUNICA_CALLBACK_ID=1 -SENHAUNICA_ADMINS=111111 +SENHAUNICA_ADMINS=1111 SENHAUNICA_DEV="http://auth.local:3141/wsusuario/oauth" # URL do servidor oauth no ambiente de dev (default: no) diff --git a/tests/Browser/LoginLogoutTest.php b/tests/Browser/LoginLogoutTest.php new file mode 100644 index 0000000..33bb219 --- /dev/null +++ b/tests/Browser/LoginLogoutTest.php @@ -0,0 +1,25 @@ +browse(function (Browser $browser) { + // Login como admin + $browser->visit('/login') + ->type('#callback', 'http://rede/callback') + ->type('#loginUsuario', '1111') + ->press('Login') + ->assertSee('Sistema rede'); + }); + } +} From c131f520a36cc376b8f65b06bc534c9c22d620a4 Mon Sep 17 00:00:00 2001 From: Thiago Gomes Verissimo Date: Fri, 21 Aug 2026 20:48:58 -0300 Subject: [PATCH 2/6] Update SENHAUNICA_ADMINS value in .env.example --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 984f2d0..c273775 100644 --- a/.env.example +++ b/.env.example @@ -66,7 +66,7 @@ REPLICADO_FAKE=1 SENHAUNICA_KEY=faker SENHAUNICA_SECRET=faker SENHAUNICA_CALLBACK_ID=1 -SENHAUNICA_ADMINS=1111 +SENHAUNICA_ADMINS=110011 SENHAUNICA_DEV="http://auth.local:3141/wsusuario/oauth" # URL do servidor oauth no ambiente de dev (default: no) From 24392643780b8a2659de88fdc66d0039267bf3e3 Mon Sep 17 00:00:00 2001 From: Thiago Gomes Verissimo Date: Fri, 21 Aug 2026 20:52:05 -0300 Subject: [PATCH 3/6] Rename test class and method for clarity --- tests/Browser/LoginLogoutTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Browser/LoginLogoutTest.php b/tests/Browser/LoginLogoutTest.php index 33bb219..a2245e1 100644 --- a/tests/Browser/LoginLogoutTest.php +++ b/tests/Browser/LoginLogoutTest.php @@ -6,12 +6,12 @@ use Laravel\Dusk\Browser; use Tests\DuskTestCase; -class LoginLogoutTest extends DuskTestCase +class LoginTest extends DuskTestCase { /** * A Dusk test example. */ - public function test_example(): void + public function test_login(): void { $this->browse(function (Browser $browser) { // Login como admin @@ -19,7 +19,7 @@ public function test_example(): void ->type('#callback', 'http://rede/callback') ->type('#loginUsuario', '1111') ->press('Login') - ->assertSee('Sistema rede'); + ->assertSee('Sair'); }); } } From 2e82f592909e06a10f7fba80fafdd1adb0a2d160 Mon Sep 17 00:00:00 2001 From: Thiago Gomes Verissimo Date: Fri, 21 Aug 2026 20:54:22 -0300 Subject: [PATCH 4/6] Rename LoginLogoutTest.php to LoginTest.php --- tests/Browser/{LoginLogoutTest.php => LoginTest.php} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/Browser/{LoginLogoutTest.php => LoginTest.php} (100%) diff --git a/tests/Browser/LoginLogoutTest.php b/tests/Browser/LoginTest.php similarity index 100% rename from tests/Browser/LoginLogoutTest.php rename to tests/Browser/LoginTest.php From 2d1909ce682c4bc9e3b12ab02562c3c1258a168d Mon Sep 17 00:00:00 2001 From: Thiago Gomes Verissimo Date: Fri, 21 Aug 2026 21:00:37 -0300 Subject: [PATCH 5/6] Add waitFor assertion in login test --- tests/Browser/LoginTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Browser/LoginTest.php b/tests/Browser/LoginTest.php index a2245e1..0b2e746 100644 --- a/tests/Browser/LoginTest.php +++ b/tests/Browser/LoginTest.php @@ -19,6 +19,7 @@ public function test_login(): void ->type('#callback', 'http://rede/callback') ->type('#loginUsuario', '1111') ->press('Login') + ->waitFor('Sistema rede') ->assertSee('Sair'); }); } From c6f3959e4c7b4b82cc18817bc3c2bba54671e7a2 Mon Sep 17 00:00:00 2001 From: Thiago Gomes Verissimo Date: Fri, 21 Aug 2026 21:04:05 -0300 Subject: [PATCH 6/6] Change waitFor to waitForText in LoginTest --- tests/Browser/LoginTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Browser/LoginTest.php b/tests/Browser/LoginTest.php index 0b2e746..e3d3efc 100644 --- a/tests/Browser/LoginTest.php +++ b/tests/Browser/LoginTest.php @@ -19,7 +19,7 @@ public function test_login(): void ->type('#callback', 'http://rede/callback') ->type('#loginUsuario', '1111') ->press('Login') - ->waitFor('Sistema rede') + ->waitForText('Sistema rede') ->assertSee('Sair'); }); }