From 4cb16b9ca5789b3c705bc1839bce414318fc9218 Mon Sep 17 00:00:00 2001 From: Paul Richard Date: Wed, 14 Feb 2024 09:46:51 -0300 Subject: [PATCH] feat: adicinado teste para validacao de bloqueio de exclusao de mapeamento de hipoteses legais --- .../PaginaHipoteseLegalExclusaoBloqueada.php | 49 +++++++++++++++ .../funcional/tests/CenarioBaseTestCase.php | 2 + ...ginaHipoteseLegalExclusaoBloqueadaTest.php | 63 +++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100755 tests_super/funcional/src/paginas/PaginaHipoteseLegalExclusaoBloqueada.php create mode 100644 tests_super/funcional/tests/PaginaHipoteseLegalExclusaoBloqueadaTest.php diff --git a/tests_super/funcional/src/paginas/PaginaHipoteseLegalExclusaoBloqueada.php b/tests_super/funcional/src/paginas/PaginaHipoteseLegalExclusaoBloqueada.php new file mode 100755 index 000000000..e8c7335ff --- /dev/null +++ b/tests_super/funcional/src/paginas/PaginaHipoteseLegalExclusaoBloqueada.php @@ -0,0 +1,49 @@ +test->byId("txtInfraPesquisarMenu")->value(utf8_encode('Mapeamento de Hipoteses Legais')); + $this->test->byXPath("//a[@href='#submenu92']")->click(); + $this->test->byXPath("//a[@link='pen_map_hipotese_legal_envio_cadastrar']")->click(); + } + + public function selecionarHipoteseSEI($value) + { + $this->test->byXPath("//select[@name='id_hipotese_legal']")->click(); + $this->test->byXPath("//option[@value='" . $value . "']")->click(); + } + + public function selecionarHipotesePEN($value) + { + $this->test->byXPath("//select[@name='id_barramento']")->click(); + $this->test->byXPath("//option[@value='" . $value . "']")->click(); + } + + public function salvarMapeamento() + { + $this->test->byXPath("//button[@id='btnSalvar']")->click(); + } + + public function excluirMapemaentoDeHipoteseLegalParaEnvio() + { + $this->test->byXPath("//label[@class='infraCheckboxLabel']")->click(); + $this->test->byXPath("//button[@value='Excluir']")->click(); + $this->test->acceptAlert(); + sleep(5); + return $this->test->byId("divInfraMsg0")->text(); + } + + public function navegarMapeamentoHipoteseLegalRecebimento() + { + $this->test->byId("txtInfraPesquisarMenu")->value(utf8_encode('Mapeamento de Hipoteses Legais')); + $this->test->byXPath("//a[@href='#submenu95']")->click(); + $this->test->byXPath("//a[@link='pen_map_hipotese_legal_recebimento_cadastrar']")->click(); + } +} diff --git a/tests_super/funcional/tests/CenarioBaseTestCase.php b/tests_super/funcional/tests/CenarioBaseTestCase.php index 580060e64..da25fd553 100755 --- a/tests_super/funcional/tests/CenarioBaseTestCase.php +++ b/tests_super/funcional/tests/CenarioBaseTestCase.php @@ -44,6 +44,7 @@ class CenarioBaseTestCase extends Selenium2TestCase protected $paginaExportarTiposProcesso = null; protected $paginaTipoProcessoReativar = null; protected $paginaCadastroOrgaoExterno = null; + protected $paginaHipoteseLegalExclusaoBloqueada = null; public function setUpPage(): void { @@ -67,6 +68,7 @@ public function setUpPage(): void $this->paginaExportarTiposProcesso = new PaginaExportarTiposProcesso($this); $this->paginaTipoProcessoReativar = new PaginaTipoProcessoReativar($this); $this->paginaCadastroOrgaoExterno = new PaginaCadastroOrgaoExterno($this); + $this->paginaHipoteseLegalExclusaoBloqueada = new PaginaHipoteseLegalExclusaoBloqueada($this); $this->currentWindow()->maximize(); } diff --git a/tests_super/funcional/tests/PaginaHipoteseLegalExclusaoBloqueadaTest.php b/tests_super/funcional/tests/PaginaHipoteseLegalExclusaoBloqueadaTest.php new file mode 100644 index 000000000..989d8ea8a --- /dev/null +++ b/tests_super/funcional/tests/PaginaHipoteseLegalExclusaoBloqueadaTest.php @@ -0,0 +1,63 @@ +definirContextoTeste(CONTEXTO_ORGAO_A); + self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_B); + $this->acessarSistema( + self::$remetente['URL'], + self::$remetente['SIGLA_UNIDADE'], + self::$remetente['LOGIN'], + self::$remetente['SENHA'] + ); + + $this->paginaHipoteseLegalExclusaoBloqueada->navegarMapeamentoHipoteseLegal(); + $this->paginaHipoteseLegalExclusaoBloqueada->selecionarHipotesePEN(29); + $this->paginaHipoteseLegalExclusaoBloqueada->selecionarHipoteseSEI(23); + $this->paginaHipoteseLegalExclusaoBloqueada->salvarMapeamento(); + $value = $this->paginaHipoteseLegalExclusaoBloqueada->excluirMapemaentoDeHipoteseLegalParaEnvio(); + + $value = trim(explode("X", $value)[1]); + + $this->assertStringContainsString( + utf8_encode("Não é permitido excluir ou desativar essa hipotese legal"), + $value + ); + } + + public function test_pagina_hipotese_legal_recebimento_exclusao_bloqueada() + { + self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_B); + $this->acessarSistema( + self::$remetente['URL'], + self::$remetente['SIGLA_UNIDADE'], + self::$remetente['LOGIN'], + self::$remetente['SENHA'] + ); + + $this->paginaHipoteseLegalExclusaoBloqueada->navegarMapeamentoHipoteseLegalRecebimento(); + $this->paginaHipoteseLegalExclusaoBloqueada->selecionarHipotesePEN(4); + $this->paginaHipoteseLegalExclusaoBloqueada->selecionarHipoteseSEI(3); + $this->paginaHipoteseLegalExclusaoBloqueada->salvarMapeamento(); + $value = $this->paginaHipoteseLegalExclusaoBloqueada->excluirMapemaentoDeHipoteseLegalParaEnvio(); + + $value = trim(explode("X", $value)[1]); + + $this->assertStringContainsString( + utf8_encode("Não é permitido excluir ou desativar essa hipotese legal"), + $value + ); + } +} +?>