From 42ae183db4cbbacd9964ed591cf2d0dbc1c24499 Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 23 Mar 2026 13:07:10 -0300 Subject: [PATCH 1/3] =?UTF-8?q?primeiro=20teste=20com=20reservas=20m=C3=BA?= =?UTF-8?q?ltiplas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/Browser/ReservaMultiplaTest.php | 74 +++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 tests/Browser/ReservaMultiplaTest.php diff --git a/tests/Browser/ReservaMultiplaTest.php b/tests/Browser/ReservaMultiplaTest.php new file mode 100644 index 0000000..f80ed9b --- /dev/null +++ b/tests/Browser/ReservaMultiplaTest.php @@ -0,0 +1,74 @@ +setupAdminAndUser(); // cria usuários $this->commonUser e $this->adminUser + } + public function test_example(): void + { + $this->browse(function (Browser $browser) { + $browser->visit('/loginlocal') + ->typeSlowly('email', $this->adminUser->email, 30) + ->typeSlowly('password', 'password', 30) + ->press('Entrar') + ->pause(1000) + ->click('#navbarDropdowniclassfafausercogariahiddentrueiAdministrao') //menu + ->pause(1250) + ->click('a[href="categorias/create"]') + ->pause(1250) + ->typeSlowly('nome','Prédio da Letras', 100) + ->pause(2000) + ->press('Enviar') + ->pause(2000); + + $categoria_id = \App\Models\Categoria::select('id')->latest()->first(); + + $browser->click('#navbarDropdowniclassfafausercogariahiddentrueiAdministrao') //menu + ->pause(1850) + ->click('a[href="salas/create"]') + ->pause(1250) + ->typeSlowly('nome','Sala 171', 100) + ->typeSlowly('capacidade','123', 150) + ->select('categoria_id', $categoria_id->id) //Selecionando o ID da cat. criada + ->pause(3300) + ->press('Enviar') + ->pause(2300); + + $sala_id = \App\Models\Sala::select('id')->latest()->first(); + $primeiro_dia_do_semestre = Carbon::create(now()->format('Y'), 3)->firstOfMonth(Carbon::MONDAY); + + //3. Por fim, cria-se uma reserva inserindo a sala que desejamos. + $browser->click('a[href="/reservas/create"]') + //->pause(1500) + ->type('nome','Introdução aos estudos Clássicos I') + ->type('data',$primeiro_dia_do_semestre->format('d/m/Y')) + ->typeSlowly('horario_inicio','8:00', 50) + ->typeSlowly('horario_fim','10:00', 50) + ->pause(1000) + ->select('sala_id',$sala_id->id) + ->clickAtXPath('//body') //clica fora do "calendário" + ->radio('rep_bool','Sim') + ->check('repeat_days[1]') + ->check('repeat_days[3]') + ->typeSlowly('repeat_until', $primeiro_dia_do_semestre->addDays(180)->format('d/m/Y')) + ->pause(3000) + ->press('Enviar') + ->pause(6000); + }); + } +} From 2ceb361766fcb28f9b6f83b6e3f041dbcd020c91 Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 23 Mar 2026 14:20:17 -0300 Subject: [PATCH 2/3] ajustando data inicial e final da reserva --- tests/Browser/ReservaMultiplaTest.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/Browser/ReservaMultiplaTest.php b/tests/Browser/ReservaMultiplaTest.php index f80ed9b..ffef186 100644 --- a/tests/Browser/ReservaMultiplaTest.php +++ b/tests/Browser/ReservaMultiplaTest.php @@ -50,12 +50,13 @@ public function test_example(): void ->pause(2300); $sala_id = \App\Models\Sala::select('id')->latest()->first(); + $primeiro_dia_do_semestre = Carbon::create(now()->format('Y'), 3)->firstOfMonth(Carbon::MONDAY); - + $ultimo_dia_do_semestre = Carbon::create(now()->format('Y'), 6)->lastOfMonth(Carbon::FRIDAY); + //3. Por fim, cria-se uma reserva inserindo a sala que desejamos. $browser->click('a[href="/reservas/create"]') - //->pause(1500) - ->type('nome','Introdução aos estudos Clássicos I') + ->typeSlowly('nome','Introdução aos estudos Clássicos I') ->type('data',$primeiro_dia_do_semestre->format('d/m/Y')) ->typeSlowly('horario_inicio','8:00', 50) ->typeSlowly('horario_fim','10:00', 50) @@ -65,8 +66,8 @@ public function test_example(): void ->radio('rep_bool','Sim') ->check('repeat_days[1]') ->check('repeat_days[3]') - ->typeSlowly('repeat_until', $primeiro_dia_do_semestre->addDays(180)->format('d/m/Y')) - ->pause(3000) + ->typeSlowly('repeat_until', $ultimo_dia_do_semestre->format('d/m/Y')) + ->pause(6000) ->press('Enviar') ->pause(6000); }); From 3fadff9867b3ac5628279018c2427754df225cc1 Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 1 Apr 2026 10:55:42 -0300 Subject: [PATCH 3/3] =?UTF-8?q?deixando=20teste=20mais=20semelhante=20?= =?UTF-8?q?=C3=A0=20experi=C3=AAncia/fluxo=20do=20usu=C3=A1rio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/Browser/LoginLogoutTest.php | 4 ++-- tests/Browser/ReservaBasicaTest.php | 10 +++++----- tests/Browser/ReservaMultiplaTest.php | 16 ++++++++-------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/Browser/LoginLogoutTest.php b/tests/Browser/LoginLogoutTest.php index b809b28..7b5f927 100644 --- a/tests/Browser/LoginLogoutTest.php +++ b/tests/Browser/LoginLogoutTest.php @@ -37,7 +37,7 @@ public function testLoginLogout() ->press('Entrar') ->pause(2000) ->assertDontSee('Administração') - ->click('.login_logout_link') + ->clickLink('Sair') //1. usar texto "sair" ao inves da classe ->pause(2000); // Login com usuário admin @@ -47,7 +47,7 @@ public function testLoginLogout() ->press('Entrar') ->pause(2000) ->assertSee('Administração') - ->click('.login_logout_link') + ->clickLink('Sair') ->pause(2000); }); } diff --git a/tests/Browser/ReservaBasicaTest.php b/tests/Browser/ReservaBasicaTest.php index 7885f3b..3f2f623 100644 --- a/tests/Browser/ReservaBasicaTest.php +++ b/tests/Browser/ReservaBasicaTest.php @@ -34,9 +34,9 @@ public function testReservaBasica(): void ->typeSlowly('password', 'password', 30) ->press('Entrar') ->pause(1000) - ->click('#navbarDropdowniclassfafausercogariahiddentrueiAdministrao') //menu + ->clickLink('Administração') ->pause(1250) - ->click('a[href="categorias/create"]') + ->clickLink('Cadastrar Categoria') ->pause(1250) ->typeSlowly('nome','Prédio da Administração', 100) ->pause(2000) @@ -47,9 +47,9 @@ public function testReservaBasica(): void $categoria_id = \App\Models\Categoria::select('id')->latest()->first(); //2. Após a criação da categoria, cria-se uma sala com ela. - $browser->click('#navbarDropdowniclassfafausercogariahiddentrueiAdministrao') //menu + $browser->clickLink('Administração') ->pause(1850) - ->click('a[href="salas/create"]') + ->clickLink('Cadastrar Sala') ->pause(1250) ->typeSlowly('nome','Sala de Informática Teste', 100) ->typeSlowly('capacidade','123', 150) @@ -61,7 +61,7 @@ public function testReservaBasica(): void $sala_id = \App\Models\Sala::select('id')->latest()->first(); //3. Por fim, cria-se uma reserva inserindo a sala que desejamos. - $browser->click('a[href="/reservas/create"]') + $browser->clickLink('Nova reserva') ->pause(1500) ->typeSlowly('nome','Reunião DUSK STI', 100) ->typeSlowly('data',now()->format('d/m/Y'), 50) diff --git a/tests/Browser/ReservaMultiplaTest.php b/tests/Browser/ReservaMultiplaTest.php index ffef186..fbd44ea 100644 --- a/tests/Browser/ReservaMultiplaTest.php +++ b/tests/Browser/ReservaMultiplaTest.php @@ -19,17 +19,17 @@ protected function setUp(): void parent::setUp(); $this->setupAdminAndUser(); // cria usuários $this->commonUser e $this->adminUser } - public function test_example(): void + public function testReservaMultipla(): void { $this->browse(function (Browser $browser) { $browser->visit('/loginlocal') - ->typeSlowly('email', $this->adminUser->email, 30) - ->typeSlowly('password', 'password', 30) + ->type('email', $this->adminUser->email) + ->type('password', 'password') ->press('Entrar') ->pause(1000) - ->click('#navbarDropdowniclassfafausercogariahiddentrueiAdministrao') //menu + ->clickLink('Administração') ->pause(1250) - ->click('a[href="categorias/create"]') + ->clickLink('Cadastrar Categoria') ->pause(1250) ->typeSlowly('nome','Prédio da Letras', 100) ->pause(2000) @@ -38,9 +38,9 @@ public function test_example(): void $categoria_id = \App\Models\Categoria::select('id')->latest()->first(); - $browser->click('#navbarDropdowniclassfafausercogariahiddentrueiAdministrao') //menu + $browser->clickLink('Administração') ->pause(1850) - ->click('a[href="salas/create"]') + ->clickLink('Cadastrar Sala') ->pause(1250) ->typeSlowly('nome','Sala 171', 100) ->typeSlowly('capacidade','123', 150) @@ -55,7 +55,7 @@ public function test_example(): void $ultimo_dia_do_semestre = Carbon::create(now()->format('Y'), 6)->lastOfMonth(Carbon::FRIDAY); //3. Por fim, cria-se uma reserva inserindo a sala que desejamos. - $browser->click('a[href="/reservas/create"]') + $browser->clickLink('Nova reserva') ->typeSlowly('nome','Introdução aos estudos Clássicos I') ->type('data',$primeiro_dia_do_semestre->format('d/m/Y')) ->typeSlowly('horario_inicio','8:00', 50)