From 43c3a3ff29fd2a1ff5fa42fbaeb0aec2d5a13ec2 Mon Sep 17 00:00:00 2001 From: Paul Richard Pereira Martins dos Anjos Date: Tue, 30 Jul 2024 11:39:03 -0300 Subject: [PATCH] feat: adicionado refatoracao de testes das issues 490 e 525 no sei41 --- .../TramiteBlocoExternoLimiteAnexoTest.php | 32 ++++++++++++------- .../tests/TramiteBlocoExternoLimiteTest.php | 28 ++++++++++------ ...soComDevolucaoContendoOutroAnexadoTest.php | 6 ---- ...ProcessoContendoDocumentoCanceladoTest.php | 32 +++++++++++-------- ...teProcessoContendoDocumentoExternoTest.php | 21 +++--------- ...TramiteRecebimentoDocumentoAnexadoTest.php | 10 ++---- 6 files changed, 63 insertions(+), 66 deletions(-) diff --git a/tests_sei41/funcional/tests/TramiteBlocoExternoLimiteAnexoTest.php b/tests_sei41/funcional/tests/TramiteBlocoExternoLimiteAnexoTest.php index 1001a4a8a..cef74e083 100644 --- a/tests_sei41/funcional/tests/TramiteBlocoExternoLimiteAnexoTest.php +++ b/tests_sei41/funcional/tests/TramiteBlocoExternoLimiteAnexoTest.php @@ -150,23 +150,31 @@ function ($testCase) { public function test_verificar_envio_processo() { - $this->markTestIncomplete( - 'Tela de confirmação de envio suprimida. Aguardando refatorção da funcionalidade do bloco para refatorar este teste.' - ); - $orgaosDiferentes = self::$remetente['URL'] != self::$destinatario['URL']; $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - $this->visualizarProcessoTramitadosEmLote($this); - $this->navegarProcessoEmLote(0); + + $this->paginaCadastrarProcessoEmBloco->navegarListagemBlocoDeTramite(); + $this->paginaCadastrarProcessoEmBloco->bntVisualizarProcessos(); $this->waitUntil(function ($testCase) use (&$orgaosDiferentes) { sleep(5); $testCase->refresh(); - $paginaTramitarProcessoEmLote = new PaginaTramitarProcessoEmLote($testCase); - $testCase->assertStringContainsString(utf8_encode("Nenhum registro encontrado."), $paginaTramitarProcessoEmLote->informacaoLote()); + $linhasDaTabela = $testCase->elements($testCase->using('xpath')->value('//table[@id="tblBlocos"]/tbody/tr')); + + $totalConcluidos = 0; + foreach ($linhasDaTabela as $linha) { + $statusTd = $linha->byXPath('./td[7]'); + if (self::$tramitar == true) { + $statusImg = $statusTd->byXPath(utf8_encode("(//img[@title='Concluído'])")); + } else { + $statusImg = $statusTd->byXPath(utf8_encode("(//img[@title='Em aberto'])")); + } + $totalConcluidos++; + } + $this->assertEquals($totalConcluidos, self::$numQtyProcessos); return true; - }, PEN_WAIT_TIMEOUT_PROCESSAMENTO_EM_LOTE); + }, PEN_WAIT_TIMEOUT); sleep(5); } @@ -183,10 +191,10 @@ public function test_verificar_envio_tramite_em_bloco() $novoStatus = $this->paginaCadastrarProcessoEmBloco->retornarTextoColunaDaTabelaDeBlocos(); if (self::$tramitar == true) { - $this->assertNotEquals('Aberto', $novoStatus); + $this->assertEquals(utf8_encode("Concluído"), $novoStatus); } else { - $this->assertEquals('Aberto', $novoStatus); - } + $this->assertEquals(utf8_encode("Aberto"), $novoStatus); + } $this->sairSistema(); } diff --git a/tests_sei41/funcional/tests/TramiteBlocoExternoLimiteTest.php b/tests_sei41/funcional/tests/TramiteBlocoExternoLimiteTest.php index fea698afa..a6db7ee1b 100644 --- a/tests_sei41/funcional/tests/TramiteBlocoExternoLimiteTest.php +++ b/tests_sei41/funcional/tests/TramiteBlocoExternoLimiteTest.php @@ -131,21 +131,29 @@ function ($testCase) { */ public function test_verificar_envio_processo() { - $this->markTestIncomplete( - 'Tela de confirmação de envio suprimida. Aguardando refatoração da funcionalidade do bloco para refatorar este teste.' - ); - $orgaosDiferentes = self::$remetente['URL'] != self::$destinatario['URL']; $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - $this->visualizarProcessoTramitadosEmLote($this); - $this->navegarProcessoEmLote(0); + + $this->paginaCadastrarProcessoEmBloco->navegarListagemBlocoDeTramite(); + $this->paginaCadastrarProcessoEmBloco->bntVisualizarProcessos(); $this->waitUntil(function ($testCase) use (&$orgaosDiferentes) { sleep(5); $testCase->refresh(); - $paginaTramitarProcessoEmLote = new PaginaTramitarProcessoEmLote($testCase); - $testCase->assertStringContainsString(utf8_encode("Nenhum registro encontrado."), $paginaTramitarProcessoEmLote->informacaoLote()); + $linhasDaTabela = $testCase->elements($testCase->using('xpath')->value('//table[@id="tblBlocos"]/tbody/tr')); + + $totalConcluidos = 0; + foreach ($linhasDaTabela as $linha) { + $statusTd = $linha->byXPath('./td[7]'); + if (self::$tramitar == true) { + $statusImg = $statusTd->byXPath(utf8_encode("(//img[@title='Concluído'])")); + } else { + $statusImg = $statusTd->byXPath(utf8_encode("(//img[@title='Em aberto'])")); + } + $totalConcluidos++; + } + $this->assertEquals($totalConcluidos, self::$numQtyProcessos); return true; }, PEN_WAIT_TIMEOUT_PROCESSAMENTO_EM_LOTE); @@ -176,9 +184,9 @@ public function test_verificar_envio_tramite_em_bloco() $novoStatus = $this->paginaCadastrarProcessoEmBloco->retornarTextoColunaDaTabelaDeBlocos(); if (self::$tramitar == true) { - $this->assertNotEquals('Aberto', $novoStatus); + $this->assertEquals(utf8_encode("Concluído"), $novoStatus); } else { - $this->assertEquals('Aberto', $novoStatus); + $this->assertEquals(utf8_encode("Aberto"), $novoStatus); } $this->sairSistema(); diff --git a/tests_sei41/funcional/tests/TramiteProcessoComDevolucaoContendoOutroAnexadoTest.php b/tests_sei41/funcional/tests/TramiteProcessoComDevolucaoContendoOutroAnexadoTest.php index 3c98266ff..bcdf62d9c 100755 --- a/tests_sei41/funcional/tests/TramiteProcessoComDevolucaoContendoOutroAnexadoTest.php +++ b/tests_sei41/funcional/tests/TramiteProcessoComDevolucaoContendoOutroAnexadoTest.php @@ -36,12 +36,6 @@ class TramiteProcessoComDevolucaoContendoOutroAnexadoTest extends CenarioBaseTes */ public function test_tramitar_processo_da_origem() { - if(ENVIO_PARCIAL){ - $this->markTestIncomplete( - 'Teste com erro. Será refatorado em momento oportuno.' - ); - } - self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_A); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_B); diff --git a/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoCanceladoTest.php b/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoCanceladoTest.php index 69cbcb045..b4cfaabae 100755 --- a/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoCanceladoTest.php +++ b/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoCanceladoTest.php @@ -1,5 +1,7 @@ gerarDadosDocumentoInternoTeste(self::$remetente); // Acessar sistema do this->REMETENTE do processo - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + $objProtocoloTesteDTO = $this->cadastrarProcessoFixture(self::$processoTeste); + self::$protocoloTeste = $objProtocoloTesteDTO->getStrProtocoloFormatado(); + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste1, $objProtocoloTesteDTO->getDblIdProtocolo()); + $this->cadastrarDocumentoInternoFixture(self::$documentoTeste2, $objProtocoloTesteDTO->getDblIdProtocolo()); - // Cadastrar novo processo de teste e incluir documentos relacionados - $this->paginaBase->navegarParaControleProcesso(); - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); - $this->cadastrarDocumentoExterno(self::$documentoTeste1); + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - // Realiza o cancelamento de um documento interno do processo - $this->cadastrarDocumentoInterno(self::$documentoTeste2); - $this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']); + $this->abrirProcesso(self::$protocoloTeste); //Tramitar internamento para liberação da funcionalidade de cancelar - $this->tramitarProcessoInternamenteParaCancelamento(self::$remetente['SIGLA_UNIDADE'], self::$remetente['SIGLA_UNIDADE_SECUNDARIA'], self::$processoTeste); + $this->tramitarProcessoInternamenteParaCancelamento(self::$remetente['SIGLA_UNIDADE'], self::$remetente['SIGLA_UNIDADE_SECUNDARIA'], [ 'PROTOCOLO' => self::$protocoloTeste ]); $this->navegarParaCancelarDocumento(1); $this->paginaCancelarDocumento->cancelar("Motivo de teste"); @@ -154,17 +154,21 @@ public function test_devolucao_processo_para_origem() { self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + putenv("DATABASE_HOST=org2-database"); // Definição de dados de teste do processo principal self::$documentoTeste3 = $this->gerarDadosDocumentoExternoTeste(self::$remetente); // Acessar sistema do this->REMETENTE do processo - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); + $parametros = [ + 'ProtocoloFormatado' => self::$protocoloTeste, + ]; + $objProtocoloFixture = new ProtocoloFixture(); + $objProtocoloTesteDTO = $objProtocoloFixture->buscar($parametros)[0]; + $this->cadastrarDocumentoExternoFixture(self::$documentoTeste3, $objProtocoloTesteDTO->getDblIdProtocolo()); - // Incluir novos documentos relacionados + $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); $this->abrirProcesso(self::$protocoloTeste); - $this->cadastrarDocumentoExterno(self::$documentoTeste3); - // Trâmitar Externamento processo para órgão/unidade destinatária $this->tramitarProcessoExternamente( self::$protocoloTeste, diff --git a/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoExternoTest.php b/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoExternoTest.php index aa9e8a006..74c8a3900 100755 --- a/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoExternoTest.php +++ b/tests_sei41/funcional/tests/TramiteProcessoContendoDocumentoExternoTest.php @@ -5,7 +5,7 @@ * Execution Groups * @group execute_parallel_group1 */ -class TramiteProcessoContendoDocumentoExternoTest extends CenarioBaseTestCase +class TramiteProcessoContendoDocumentoExternoTest extends FixtureCenarioBaseTestCase { public static $remetente; public static $destinatario; @@ -26,24 +26,13 @@ class TramiteProcessoContendoDocumentoExternoTest extends CenarioBaseTestCase public function test_tramitar_processo_contendo_documento_externo() { // Configuração do dados para teste do cenário - self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); - self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_A); + self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_B); self::$processoTeste = $this->gerarDadosProcessoTeste(self::$remetente); self::$documentoTeste = $this->gerarDadosDocumentoExternoTeste(self::$remetente); - // 1 - Acessar sistema do this->REMETENTE do processo - $this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']); - - // 2 - Cadastrar novo processo de teste - self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste); - - // 3 - Incluir Documentos no Processo - $this->cadastrarDocumentoExterno(self::$documentoTeste); - - // 5 - Trâmitar Externamento processo para órgão/unidade destinatária - $this->tramitarProcessoExternamente( - self::$protocoloTeste, self::$destinatario['REP_ESTRUTURAS'], self::$destinatario['NOME_UNIDADE'], - self::$destinatario['SIGLA_UNIDADE_HIERARQUIA'], false); + $this->realizarTramiteExternoSemvalidacaoNoRemetenteFixture(self::$processoTeste, self::$documentoTeste, self::$remetente, self::$destinatario); + self::$protocoloTeste = self::$processoTeste["PROTOCOLO"]; } diff --git a/tests_sei41/funcional/tests/TramiteRecebimentoDocumentoAnexadoTest.php b/tests_sei41/funcional/tests/TramiteRecebimentoDocumentoAnexadoTest.php index 3509ed510..123ab9965 100755 --- a/tests_sei41/funcional/tests/TramiteRecebimentoDocumentoAnexadoTest.php +++ b/tests_sei41/funcional/tests/TramiteRecebimentoDocumentoAnexadoTest.php @@ -6,7 +6,7 @@ * Execution Groups * @group execute_parallel_group3 */ -class TramiteRecebimentoDocumentoAnexadoTest extends CenarioBaseTestCase +class TramiteRecebimentoDocumentoAnexadoTest extends FixtureCenarioBaseTestCase { const ALGORITMO_HASH_DOCUMENTO = 'SHA256'; const ALGORITMO_HASH_ASSINATURA = 'SHA256withRSA'; @@ -39,12 +39,6 @@ class TramiteRecebimentoDocumentoAnexadoTest extends CenarioBaseTestCase */ public function test_envio_processo_com_documento_anexado() { - if(ENVIO_PARCIAL){ - $this->markTestIncomplete( - 'Teste com erro. Será refatorado em momento oportuno.' - ); - } - // Carregar contexto de testes e dados sobre certificado digital $ordemDocumentoReferenciado = 1; self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_B); @@ -94,7 +88,7 @@ public function test_devolucao_processo_com_documento_anexado_para_origem() self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_B); $arrDocumentosSegundoEnvio = array(self::$documentoTeste4, self::$documentoTeste5); - $this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTeste, $arrDocumentosSegundoEnvio, self::$remetente, self::$destinatario); + $this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTeste, $arrDocumentosSegundoEnvio, self::$remetente, self::$destinatario); } /**