Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create modal to show timeline details #499

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress/e2e/admin/agents/agent-timeline.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Painel de Controle - Página de timeline de Agentes', () => {
cy.get('tbody > tr > :nth-child(2)').contains(/\d{2}\/\d{2}\/\d{4}/).should('be.visible');
cy.get('tbody > tr > :nth-child(3)').contains('unknown').should('be.visible');
cy.get(':nth-child(5) > .btn').contains('Detalhes').should('be.visible')

cy.get(':nth-child(1) > :nth-child(5) > .btn').click();
cy.get('.modal-body > .table > thead > tr > :nth-child(2)').contains('De');
cy.get('.modal-body > .table > thead > tr > :nth-child(3)').contains('Para');
Expand Down
14 changes: 10 additions & 4 deletions cypress/e2e/admin/space/space-timeline.cy.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
describe('Painel de Controle - Página de timeline dos Espaços', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('alessandrofeitoza@example.com', 'Aurora@2024');
cy.visit('/painel/espacos/69461af3-52f2-4c6b-ad30-ce92e478e9bd/timeline');
cy.login('henriquelopeslima@example.com', 'Aurora@2024');
cy.visit('painel/espacos/608756eb-4830-49f2-ae14-1160ca5252f4/timeline');
});

it('Garante que a página de timeline dos espaços existe', () => {
cy.get('h2').contains('Espaços - SECULT - Timeline').should('be.visible');
it('Garante que a página de timeline dos espaços existe e que exibe os detalhes corretamente', () => {
cy.get('h2').contains('Espaços - Galeria Caatinga - Timeline').should('be.visible');
cy.get('.d-flex > div > .btn').contains('Voltar').should('be.visible');

cy.get('tr > :nth-child(1) > a').contains('The resource was created').should('be.visible');
cy.get('tbody > tr > :nth-child(2)').contains(/\d{2}\/\d{2}\/\d{4}/).should('be.visible');
cy.get('tbody > tr > :nth-child(3)').contains('unknown').should('be.visible');
cy.get(':nth-child(5) > .btn').contains('Detalhes').should('be.visible')

cy.get(':nth-child(1) > :nth-child(5) > .btn').click();
cy.get('.modal-body > .table > thead > tr > :nth-child(2)').contains('De');
cy.get('.modal-body > .table > thead > tr > :nth-child(3)').contains('Para');
cy.get('#modal-timeline-table-body > :nth-child(2) > :nth-child(2)').contains('N/A');
cy.get('#modal-timeline-table-body > :nth-child(2) > :nth-child(3)').contains('Galeria Caatinga');
});
});
12 changes: 11 additions & 1 deletion templates/_admin/space/timeline.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

{% block content %}
{% include '_components/modal-confirm-remove.html.twig' %}
{% include "_components/modal-timeline.html.twig" %}

<section class="d-flex">
{% include "_components/side-bar.html.twig" %}
Expand Down Expand Up @@ -41,7 +42,12 @@
<td>{{ item.device }}</td>
<td></td>
<td>
<a href="{{ path('admin_space_timeline', {id: space.id}) }}" class="btn btn-outline-dark btn-sm">{{ 'details'|trans }}</a>
<button type="button" class="btn btn-outline-dark btn-sm"
data-bs-toggle="modal"
data-bs-target="#modal-timeline"
onclick="openModal({{ item.from | json_encode() }}, {{ item.to | json_encode() }})">
{{ 'details' | trans }}
</button>
</td>
</tr>
{% endfor %}
Expand All @@ -53,3 +59,7 @@
</div>
</section>
{% endblock %}
{% block extra_javascripts %}
{{ parent() }}
<script src="{{ asset('js/modal-timeline.js') }}"></script>
{% endblock %}
Loading