Skip to content

Commit

Permalink
feat: adicionado refatoracao de testes das issues 490 e 525 no sei41
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Richard Pereira Martins dos Anjos committed Jul 30, 2024
1 parent ece9140 commit 43c3a3f
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 66 deletions.
32 changes: 20 additions & 12 deletions tests_sei41/funcional/tests/TramiteBlocoExternoLimiteAnexoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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();
}
Expand Down
28 changes: 18 additions & 10 deletions tests_sei41/funcional/tests/TramiteBlocoExternoLimiteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use Tests\Funcional\Sei\Fixtures\ProtocoloFixture;

/**
* Testes de trâmite de processos contendo um documento cancelado
*
Expand All @@ -9,7 +11,7 @@
* Execution Groups
* @group execute_parallel_with_two_group1
*/
class TramiteProcessoContendoDocumentoCanceladoTest extends CenarioBaseTestCase
class TramiteProcessoContendoDocumentoCanceladoTest extends FixtureCenarioBaseTestCase
{
public static $remetente;
public static $destinatario;
Expand Down Expand Up @@ -40,19 +42,17 @@ public function test_tramitar_processo_contendo_documento_cancelado()
self::$documentoTeste2 = $this->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");
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Execution Groups
* @group execute_parallel_group1
*/
class TramiteProcessoContendoDocumentoExternoTest extends CenarioBaseTestCase
class TramiteProcessoContendoDocumentoExternoTest extends FixtureCenarioBaseTestCase
{
public static $remetente;
public static $destinatario;
Expand All @@ -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"];
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 43c3a3f

Please sign in to comment.