Skip to content

Commit

Permalink
560 refatoracao de testes (#578)
Browse files Browse the repository at this point in the history
* feat: refatorado testes no ambiente sei4

* feat: refatorado testes no ambiente sei41

* feat: refatorado testes no ambiente super

---------

Co-authored-by: Paul Richard Pereira Martins dos Anjos <[email protected]>
  • Loading branch information
NinetiesPaul and Paul Richard Pereira Martins dos Anjos authored Aug 27, 2024
1 parent 8811192 commit 0e7f0a7
Show file tree
Hide file tree
Showing 24 changed files with 150 additions and 169 deletions.
17 changes: 16 additions & 1 deletion tests_sei4/funcional/tests/FixtureCenarioBaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ protected function cadastrarProcessoFixture(&$dadosProcesso)

$objProtocoloAssuntoFixture = new RelProtocoloAssuntoFixture();
$objProtocoloAssuntoFixture->carregar([
'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo()
'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(),
'IdAssunto' => 377
]);

$objAtributoAndamentoFixture = new AtributoAndamentoFixture();
Expand Down Expand Up @@ -100,6 +101,20 @@ protected function cadastrarDocumentoExternoFixture($dadosDocumentoExterno, $idP
'IdProtocolo' => $objDocumentoDTO->getDblIdDocumento(),
'Nome' => basename($dadosDocumentoExterno['ARQUIVO']),
]);

$objAtividadeFixture = new AtividadeFixture();
$objAtividadeDTO = $objAtividadeFixture->carregar([
'IdProtocolo' => $idProtocolo,
'Conclusao' => \InfraData::getStrDataHoraAtual(),
'IdTarefa' => \TarefaRN::$TI_ARQUIVO_ANEXADO,
'IdUsuarioConclusao' => 100000001
]);

$objAtributoAndamentoFixture = new AtributoAndamentoFixture();
$objAtributoAndamentoFixture->carregar([
'IdAtividade' => $objAtividadeDTO->getNumIdAtividade(),
'Nome' => 'ANEXO'
]);

return $objDocumentoDTO;
}
Expand Down
23 changes: 5 additions & 18 deletions tests_sei4/funcional/tests/TramiteProcessoComCancelamentoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Execution Groups
* @group execute_without_receiving
*/
class TramiteProcessoComCancelamentoTest extends CenarioBaseTestCase
class TramiteProcessoComCancelamentoTest extends FixtureCenarioBaseTestCase
{
public static $remetente;
public static $destinatario;
Expand All @@ -32,15 +32,8 @@ public function test_cancelamento_tramite_contendo_documento_interno()
self::$processoTeste = $this->gerarDadosProcessoTeste(self::$remetente);
self::$documentoTeste = $this->gerarDadosDocumentoInternoTeste(self::$remetente);

$this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']);
self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste);
$this->cadastrarDocumentoInterno(self::$documentoTeste);
$this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']);

$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"];

$this->paginaProcesso->cancelarTramitacaoExterna();
$mensagemAlerta = $this->paginaTramitar->alertTextAndClose(true);
Expand Down Expand Up @@ -95,14 +88,8 @@ public function test_cancelamento_tramite_contendo_documento_externo()
self::$processoTeste = $this->gerarDadosProcessoTeste(self::$remetente);
self::$documentoTeste = $this->gerarDadosDocumentoExternoTeste(self::$remetente, 'arquivo_001.pdf');

$this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']);
self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste);
$this->cadastrarDocumentoExterno(self::$documentoTeste);

$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"];

$this->paginaProcesso->cancelarTramitacaoExterna();
$mensagemAlerta = $this->paginaTramitar->alertTextAndClose(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Execution Groups
* @group execute_alone_group3
*/
class TramiteProcessoComDevolucaoAlteracaoURLTest extends CenarioBaseTestCase
class TramiteProcessoComDevolucaoAlteracaoURLTest extends FixtureCenarioBaseTestCase
{
public static $remetente;
public static $destinatario;
Expand Down Expand Up @@ -58,7 +58,7 @@ public function test_tramitar_processo_da_origem()
self::$documentoTeste1 = $this->gerarDadosDocumentoInternoTeste(self::$remetente);

$documentos = array(self::$documentoTeste1);
$this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
$this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
self::$protocoloTeste = self::$processoTeste["PROTOCOLO"];
}

Expand Down Expand Up @@ -98,7 +98,8 @@ public function test_devolucao_processo_para_origem()
self::$documentoTeste3 = $this->gerarDadosDocumentoInternoTeste(self::$remetente);

$documentos = array(self::$documentoTeste3);
$this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
putenv("DATABASE_HOST=org2-database");
$this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
}


Expand Down Expand Up @@ -136,6 +137,7 @@ public function test_tramitar_processo_da_origem_novo_url()
self::$remetente = $this->definirContextoTeste(CONTEXTO_ORGAO_A);
self::$destinatario = $this->definirContextoTeste(CONTEXTO_ORGAO_B);
self::$documentoTeste5 = $this->gerarDadosDocumentoInternoTeste(self::$remetente);
putenv("DATABASE_HOST=org1-database");

$bancoOrgaoA = new DatabaseUtils(CONTEXTO_ORGAO_A);
$result=$bancoOrgaoA->query("SELECT texto FROM tarja_assinatura where sta_tarja_assinatura=? and sin_ativo=?", array("V","S"));
Expand All @@ -154,7 +156,7 @@ public function test_tramitar_processo_da_origem_novo_url()
$bancoOrgaoA->execute("update tarja_assinatura set texto=? where sta_tarja_assinatura=? and sin_ativo=?", array($strTarja,"V","S"));

$documentos = array(self::$documentoTeste5);
$this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
$this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
self::$protocoloTeste = self::$processoTeste["PROTOCOLO"];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Execution Groups
* @group execute_alone_group6
*/
class TramiteProcessoComDevolucaoTest extends CenarioBaseTestCase
class TramiteProcessoComDevolucaoTest extends FixtureCenarioBaseTestCase
{
public static $remetente;
public static $destinatario;
Expand Down Expand Up @@ -36,7 +36,7 @@ public function test_tramitar_processo_da_origem()
self::$documentoTeste2 = $this->gerarDadosDocumentoExternoTeste(self::$remetente);

$documentos = array(self::$documentoTeste1, self::$documentoTeste2);
$this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
$this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
self::$protocoloTeste = self::$processoTeste["PROTOCOLO"];
}

Expand Down Expand Up @@ -77,7 +77,8 @@ public function test_devolucao_processo_para_origem()
self::$documentoTeste4 = $this->gerarDadosDocumentoExternoTeste(self::$remetente);

$documentos = array(self::$documentoTeste3, self::$documentoTeste4);
$this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
putenv("DATABASE_HOST=org2-database");
$this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Execution Groups
* @group execute_alone_group3
*/
class TramiteProcessoComDevolucaoUnidadeDiferenteTest extends CenarioBaseTestCase
class TramiteProcessoComDevolucaoUnidadeDiferenteTest extends FixtureCenarioBaseTestCase
{
public static $remetente;
public static $destinatario;
Expand Down Expand Up @@ -36,7 +36,7 @@ public function test_tramitar_processo_da_origem()
self::$documentoTeste2 = $this->gerarDadosDocumentoExternoTeste(self::$remetente);

$documentos = array(self::$documentoTeste1, self::$documentoTeste2);
$this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
$this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
self::$protocoloTeste = self::$processoTeste["PROTOCOLO"];
}

Expand Down Expand Up @@ -82,7 +82,8 @@ public function test_devolucao_processo_para_origem()
self::$documentoTeste4 = $this->gerarDadosDocumentoExternoTeste(self::$remetente);

$documentos = array(self::$documentoTeste3, self::$documentoTeste4);
$this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
putenv("DATABASE_HOST=org2-database");
$this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Execution Groups
* @group execute_alone_group2
*/
class TramiteProcessoComDocumentoRestritoHipotesePadraoTest extends CenarioBaseTestCase
class TramiteProcessoComDocumentoRestritoHipotesePadraoTest extends FixtureCenarioBaseTestCase
{
public static $remetente;
public static $destinatario;
Expand All @@ -30,26 +30,12 @@ public function test_tramitar_processo_com_documento_restrito_hipotese_nao_mapea
self::$processoTeste = $this->gerarDadosProcessoTeste(self::$remetente);
self::$documentoTeste = $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']);

// Cadastrar novo processo de teste
self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste);

// Configuração de documento restrito
self::$documentoTeste["RESTRICAO"] = PaginaIncluirDocumento::STA_NIVEL_ACESSO_RESTRITO;
self::$documentoTeste["HIPOTESE_LEGAL"] = self::$remetente["HIPOTESE_RESTRICAO_NAO_MAPEADO"];

// Incluir Documentos no Processo
$this->cadastrarDocumentoInterno(self::$documentoTeste);

// Assinar documento interno criado anteriormente
$this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']);

// 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 @@ -4,7 +4,7 @@
* Execution Groups
* @group execute_parallel_group3
*/
class TramiteProcessoComHistoricoTest extends CenarioBaseTestCase
class TramiteProcessoComHistoricoTest extends FixtureCenarioBaseTestCase
{
public static $remetente;
public static $destinatario;
Expand Down Expand Up @@ -32,7 +32,7 @@ public function test_tramitar_processo_da_origem()
self::$documentoTeste2 = $this->gerarDadosDocumentoExternoTeste(self::$remetente);

$documentos = array(self::$documentoTeste1, self::$documentoTeste2);
$this->realizarTramiteExternoComValidacaoNoRemetente(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
$this->realizarTramiteExternoComValidacaoNoRemetenteFixture(self::$processoTeste, $documentos, self::$remetente, self::$destinatario);
self::$protocoloTeste = self::$processoTeste["PROTOCOLO"];

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Execution Groups
* @group execute_parallel_group1
*/
class TramiteProcessoContendoDocumentoCanceladoSemTamanhoTest extends CenarioBaseTestCase
class TramiteProcessoContendoDocumentoCanceladoSemTamanhoTest extends FixtureCenarioBaseTestCase
{
public static $remetente;
public static $destinatario;
Expand Down Expand Up @@ -37,16 +37,18 @@ public function test_tramitar_processo_contendo_documento_cancelado()

self::$documentoTeste1 = $this->gerarDadosDocumentoExternoTeste(self::$remetente);

$objProtocoloPrincipalDTO = $this->cadastrarProcessoFixture(self::$processoTeste);

$this->cadastrarDocumentoExternoFixture(self::$documentoTeste1, $objProtocoloPrincipalDTO->getDblIdProtocolo());
self::$protocoloTeste = $objProtocoloPrincipalDTO->getStrProtocoloFormatado();

// Acessar sistema do this->REMETENTE do processo
$this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']);

// Cadastrar novo processo de teste e incluir documentos relacionados
$this->paginaBase->navegarParaControleProcesso();
self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste);
$this->cadastrarDocumentoExterno(self::$documentoTeste1);
$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(0);
$this->paginaCancelarDocumento->cancelar("Motivo de teste");
Expand Down
17 changes: 16 additions & 1 deletion tests_sei41/funcional/tests/FixtureCenarioBaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ protected function cadastrarProcessoFixture(&$dadosProcesso)

$objProtocoloAssuntoFixture = new RelProtocoloAssuntoFixture();
$objProtocoloAssuntoFixture->carregar([
'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo()
'IdProtocolo' => $objProtocoloDTO->getDblIdProtocolo(),
'IdAssunto' => 377
]);

$objAtributoAndamentoFixture = new AtributoAndamentoFixture();
Expand Down Expand Up @@ -100,6 +101,20 @@ protected function cadastrarDocumentoExternoFixture($dadosDocumentoExterno, $idP
'IdProtocolo' => $objDocumentoDTO->getDblIdDocumento(),
'Nome' => basename($dadosDocumentoExterno['ARQUIVO']),
]);

$objAtividadeFixture = new AtividadeFixture();
$objAtividadeDTO = $objAtividadeFixture->carregar([
'IdProtocolo' => $idProtocolo,
'Conclusao' => \InfraData::getStrDataHoraAtual(),
'IdTarefa' => \TarefaRN::$TI_ARQUIVO_ANEXADO,
'IdUsuarioConclusao' => 100000001
]);

$objAtributoAndamentoFixture = new AtributoAndamentoFixture();
$objAtributoAndamentoFixture->carregar([
'IdAtividade' => $objAtividadeDTO->getNumIdAtividade(),
'Nome' => 'ANEXO'
]);

return $objDocumentoDTO;
}
Expand Down
23 changes: 5 additions & 18 deletions tests_sei41/funcional/tests/TramiteProcessoComCancelamentoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Execution Groups
* @group execute_without_receiving
*/
class TramiteProcessoComCancelamentoTest extends CenarioBaseTestCase
class TramiteProcessoComCancelamentoTest extends FixtureCenarioBaseTestCase
{
public static $remetente;
public static $destinatario;
Expand All @@ -32,15 +32,8 @@ public function test_cancelamento_tramite_contendo_documento_interno()
self::$processoTeste = $this->gerarDadosProcessoTeste(self::$remetente);
self::$documentoTeste = $this->gerarDadosDocumentoInternoTeste(self::$remetente);

$this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']);
self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste);
$this->cadastrarDocumentoInterno(self::$documentoTeste);
$this->assinarDocumento(self::$remetente['ORGAO'], self::$remetente['CARGO_ASSINATURA'], self::$remetente['SENHA']);

$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"];

$this->paginaProcesso->cancelarTramitacaoExterna();
$mensagemAlerta = $this->paginaTramitar->alertTextAndClose(true);
Expand Down Expand Up @@ -95,14 +88,8 @@ public function test_cancelamento_tramite_contendo_documento_externo()
self::$processoTeste = $this->gerarDadosProcessoTeste(self::$remetente);
self::$documentoTeste = $this->gerarDadosDocumentoExternoTeste(self::$remetente, 'arquivo_001.pdf');

$this->acessarSistema(self::$remetente['URL'], self::$remetente['SIGLA_UNIDADE'], self::$remetente['LOGIN'], self::$remetente['SENHA']);
self::$protocoloTeste = $this->cadastrarProcesso(self::$processoTeste);
$this->cadastrarDocumentoExterno(self::$documentoTeste);

$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"];

$this->paginaProcesso->cancelarTramitacaoExterna();
$mensagemAlerta = $this->paginaTramitar->alertTextAndClose(true);
Expand Down
Loading

0 comments on commit 0e7f0a7

Please sign in to comment.