Skip to content

Commit

Permalink
feat: adicinado teste para validacao de bloqueio de exclusao de mapea…
Browse files Browse the repository at this point in the history
…mento de hipoteses legais
  • Loading branch information
NinetiesPaul committed Feb 14, 2024
1 parent a95176b commit 4cb16b9
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

class PaginaHipoteseLegalExclusaoBloqueada extends PaginaTeste
{
public function __construct($test)
{
parent::__construct($test);
}

public function navegarMapeamentoHipoteseLegal()
{
$this->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();
}
}
2 changes: 2 additions & 0 deletions tests_super/funcional/tests/CenarioBaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class CenarioBaseTestCase extends Selenium2TestCase
protected $paginaExportarTiposProcesso = null;
protected $paginaTipoProcessoReativar = null;
protected $paginaCadastroOrgaoExterno = null;
protected $paginaHipoteseLegalExclusaoBloqueada = null;

public function setUpPage(): void
{
Expand All @@ -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();
}

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

class PaginaHipoteseLegalExclusaoBloqueadaTest extends CenarioBaseTestCase
{
protected static $remetente;
protected static $destinatario;

function setUp(): void
{
parent::setUp();
}

public function test_pagina_hipotese_legal_envio_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->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
);
}
}
?>

0 comments on commit 4cb16b9

Please sign in to comment.