-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
febad32
commit 25d2282
Showing
11 changed files
with
207 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,34 +3,36 @@ describe('Teste de navegação e validação da página de Selos', () => { | |
cy.visit('/'); | ||
|
||
cy.contains('Entrar').click(); | ||
|
||
cy.url().should('include', '/login'); | ||
|
||
cy.login('[email protected]', 'Aurora@2024'); | ||
|
||
cy.url().should('include', '/'); | ||
|
||
cy.contains('Sara Jenifer Camilo').should('be.visible'); | ||
|
||
cy.contains('Sara Jenifer Camilo').click(); | ||
cy.contains('Minhas Oportunidades', { timeout: 10000 }).should('be.visible').click(); | ||
cy.contains('Minhas Oportunidades', { timeout: 10000 }) | ||
.should('be.visible') | ||
.click(); | ||
cy.url({ timeout: 10000 }).should('include', '/painel/oportunidades'); | ||
cy.scrollTo('bottom'); | ||
cy.contains('Selos', { timeout: 10000 }).should('be.visible').click(); | ||
cy.contains('Selos', { timeout: 10000 }) | ||
.should('be.visible') | ||
.click(); | ||
cy.url({ timeout: 10000 }).should('include', '/painel/selos/'); | ||
cy.get('table', { timeout: 10000 }).should('be.visible'); | ||
cy.contains('Criar', { timeout: 10000 }).should('be.visible').click(); | ||
|
||
cy.contains('Criar', { timeout: 10000 }) | ||
.should('be.visible') | ||
.click(); | ||
cy.url({ timeout: 10000 }).should('include', '/painel/selos/adicionar'); | ||
|
||
// Garante que a validação existe | ||
cy.get('button').contains('Salvar').should('be.visible').click(); | ||
cy.get('input:invalid').should('have.length', 1); | ||
cy.get('textarea:invalid').should('have.length', 1); | ||
|
||
// Garante que a criação funciona | ||
cy.get('input[name="name"]').type('Selo de qualidade'); | ||
cy.get('textarea[name="description"]').type('Descrição do selo'); | ||
cy.get('button').contains('Salvar').should('be.visible').click(); | ||
|
||
cy.url({ timeout: 10000 }).should('include', '/painel/selos/'); | ||
cy.contains('Selo de qualidade').should('be.visible'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
describe('Teste de navegação, validação e edição da página de Selos', () => { | ||
beforeEach(() => { | ||
cy.visit('/'); | ||
cy.contains('Entrar').click(); | ||
cy.url().should('include', '/login'); | ||
cy.login('[email protected]', 'Aurora@2024'); | ||
cy.url().should('include', '/'); | ||
cy.contains('Sara Jenifer Camilo').should('be.visible').click(); | ||
cy.contains('Minhas Oportunidades').should('be.visible').click(); | ||
cy.url().should('include', '/painel/oportunidades'); | ||
cy.scrollTo('bottom'); | ||
cy.contains('Selos').should('be.visible').click(); | ||
cy.url().should('include', '/painel/selos/'); | ||
cy.contains('Editar').first().click(); | ||
cy.url().should('include', '/editar'); | ||
|
||
cy.get('form').invoke('attr', 'novalidate', true); | ||
}); | ||
|
||
it('Verifica e edita os campos do formulário de selos', () => { | ||
cy.get('input[name="active"]') | ||
.should('exist') | ||
.should('have.attr', 'type', 'checkbox') | ||
.should('be.checked'); | ||
|
||
cy.get('input[name="name"]').clear().type('Selo Teste Atualizado'); | ||
|
||
cy.get('textarea[name="description"]') | ||
.clear() | ||
.type('Selo que destaca eventos com impacto em comunidades locais.'); | ||
|
||
cy.contains('Salvar').click(); | ||
cy.url().should('include', '/painel/selos/'); | ||
cy.contains('Selo Teste Atualizado').should('be.visible'); | ||
cy.contains('Selo Teste Atualizado').parent().contains('Editar').click(); | ||
cy.get('input[name="name"]').should('have.value', 'Selo Teste Atualizado'); | ||
cy.get('textarea[name="description"]').should( | ||
'have.value', | ||
'Selo que destaca eventos com impacto em comunidades locais.' | ||
); | ||
cy.get('input[name="active"]').should('be.checked'); | ||
}); | ||
|
||
it('Verifica os botões Salvar e Cancelar', () => { | ||
cy.contains('Salvar') | ||
.should('exist') | ||
.should('have.attr', 'type', 'submit') | ||
|
||
cy.contains('Cancelar') | ||
.should('exist') | ||
.should('have.attr', 'href', '/painel/selos/') | ||
.should('be.visible'); | ||
|
||
cy.contains('Cancelar').click(); | ||
cy.url().should('include', '/painel/selos/'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{% extends "_layouts/blank.html.twig" %} | ||
|
||
{% block title %}{{ 'edit_seals' | trans }}{% endblock %} | ||
|
||
{% block content %} | ||
<section class="d-flex"> | ||
{% include "_components/side-bar.html.twig" %} | ||
<div class="management-content w-100 p-4"> | ||
<div class="row"> | ||
<div class="col-md-8 offset-md-2"> | ||
<div class="card card-body"> | ||
<h2>{{ 'edit_seals' | trans }}</h2> | ||
<form method="POST"> | ||
<div class="mb-3"> | ||
<label for="name" class="form-label">{{ 'seals_name' | trans }}</label> | ||
<input | ||
type="text" | ||
id="name" | ||
name="name" | ||
class="form-control" | ||
value="{{ seal.name }}" | ||
required | ||
> | ||
</div> | ||
<div class="mb-3 form-check"> | ||
<input | ||
type="checkbox" | ||
id="active" | ||
name="active" | ||
class="form-check-input" | ||
{{ seal.active ? 'checked' : '' }} | ||
> | ||
<label for="active" class="form-check-label">Ativo</label> | ||
</div> | ||
<div class="mb-3"> | ||
<label for="description" class="form-label">{{ 'seals_description' | trans }}</label> | ||
<textarea | ||
id="description" | ||
name="description" | ||
class="form-control" | ||
rows="3" | ||
maxlength="500" | ||
required | ||
>{{ seal.description }}</textarea> | ||
</div> | ||
<button type="submit" class="btn btn-primary"> | ||
{{ 'save' | trans }} | ||
</button> | ||
<a href="{{ path('admin_seal_list') }}" class="btn btn-secondary"> | ||
{{ 'cancel' | trans }} | ||
</a> | ||
</form> | ||
{% if errors is defined and errors|length > 0 %} | ||
<div class="alert alert-danger mt-3"> | ||
<ul> | ||
{% for error in errors %} | ||
<li>{{ error.message }}</li> | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
{% endif %} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.