From 42ae183db4cbbacd9964ed591cf2d0dbc1c24499 Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 23 Mar 2026 13:07:10 -0300 Subject: [PATCH 1/2] =?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/2] 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); });