-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreport-api.html
More file actions
233 lines (214 loc) · 10.9 KB
/
report-api.html
File metadata and controls
233 lines (214 loc) · 10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Relatório</title>
<link rel="stylesheet" href="bulma.min.css">
<link rel="stylesheet" href="bulma-timeline.min.css">
<link rel="stylesheet" href="modal-fx.min.css">
<link rel="stylesheet" href="style.css">
<style>
.image-zoom {
max-width: 90%;
max-height: 90%;
transition: transform 0.2s;
}
.image-zoom:hover {
transform: scale(1.1);
}
</style>
</head>
<body>
<div id="report-api">
<div class="container">
<nav class="level my-5">
<!-- Left side -->
<div class="level-left">
<div class="level-item">
<p class="subtitle is-5"><strong>Relatório</strong></p>
</div>
</div>
<!-- Right side -->
<div class="level-right">
<p class="level-item">
<button class="button is-success" @click="openReportModal"
:disabled="!lastTest || !lastTest.tests || lastTest.tests.length === 0">Exportar</button>
</p>
</div>
</nav>
<div v-if="!lastTest || !lastTest.tests || lastTest.tests.length === 0" class="notification my-5">
Nenhum relatório encontrado.
</div>
<!-- Timeline começa aqui -->
<div class="timeline my-5" v-if="lastTest.tests && lastTest.tests.length">
<p class="has-text-grey mb-4">Data do teste: {{ new Date(lastTest.date).toLocaleString('pt-BR') }}</p>
<header class="timeline-header">
<span class="tag is-medium is-link is-light">Início</span>
</header>
<div v-for="(result, index) in lastTest.tests" :key="index">
<div class="timeline-item">
<div class="timeline-marker is-link is-icon">
<span class="icon">
<i class="material-icons">{{ result.error ? 'close' : 'check' }}</i>
</span>
</div>
<div class="timeline-content">
<p class="heading" :class="{
'has-text-danger': result.error,
'has-text-success': !result.error,
}">
{{ result.description }}
<span>
<i class="material-icons">{{ result.error ? 'close' : 'check' }}</i>
</span>
</p>
<p v-html="formatBreakLines(result.error ? ((result.success || '') + '\n' + result.error) : (result.success || ''))"
:class="{
'has-text-danger': result.error,
'has-text-success': !result.error,
}"></p>
</div>
<div class="timeline-content" v-if="result.screenshot">
<figure class="image is-128x128">
<img :src="result.screenshot" alt="Screenshot" class="is-clickable"
style="object-fit: contain; width: 128px; height: 128px;"
@click="changeScreenshot(result.screenshot)" />
</figure>
</div>
</div>
<header class="timeline-header" v-if="result.duration">
<span class="tag is-info">{{ formatExecutionTime(result.duration) }}</span>
</header>
</div>
<header class="timeline-header">
<span class="tag is-warning">{{ totalDuration }}</span>
</header>
<!-- Última screenshot geral -->
<div class="timeline-item" v-if="lastTest.lastScreenshot">
<div class="timeline-marker is-link is-icon">
<span class="icon">
<i class="material-icons">photo</i>
</span>
</div>
<div class="timeline-content">
<p class="heading">Última captura de tela</p>
<figure class="image is-128x128">
<img :src="lastTest.lastScreenshot" alt="Última Screenshot" class="is-clickable"
style="object-fit: contain; width: 128px; height: 128px;"
@click="changeScreenshot(lastTest.lastScreenshot)" />
</figure>
</div>
</div>
<header class="timeline-header">
<span class="tag is-medium is-link is-light">Fim</span>
</header>
</div>
<!-- Timeline termina aqui -->
</div>
<!-- MODAL de Imagem em tela cheia -->
<div class="modal modal-fx-superScaled" :class="{ 'is-active': showModal }">
<div class="modal-background" @click="closeModal"></div>
<div class="modal-content is-huge is-image is-relative" style="width: 90vw; height: 90vh;">
<div class="buttons" style="position: absolute; z-index: 1000; top: 10px; right: 10px;">
<button @click="zoomIn" class="button">Aumentar Zoom</button>
<button @click="zoomOut" class="button">Diminuir Zoom</button>
<button @click="resetZoom" class="button">Resetar Zoom</button>
</div>
<div style="overflow: auto; height: calc(90vh - 0px);">
<img :src="selectedScreenshot" alt="Screenshot grande" class="image-zoom"
:style="{ transform: `scale(${currentZoom})` }">
</div>
</div>
<button class="modal-close is-large" aria-label="close" @click="closeModal"></button>
</div>
<!-- FIM DA MODAL -->
<!-- MODAL de exportar -->
<div class="modal" :class="{ 'is-active': showExportModal }">
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<p class="modal-card-title">Exportar</p>
<button class="delete" aria-label="close" @click="closeExportModal"></button>
</header>
<section class="modal-card-body">
<div class="buttons">
<button class="button is-link" @click="exportPDF">Exportar como PDF</button>
<button class="button is-link" @click="exportCSV">Exportar como CSV</button>
<button class="button is-link" @click="exportXLS">Exportar como XLS</button>
</div>
<div v-if="showSuccessNotification" class="notification is-success mt-3">
Relatório exportado com sucesso!
</div>
</section>
<footer class="modal-card-foot">
<div class="buttons">
<button class="button" @click="closeExportModal">Fechar</button>
</div>
</footer>
</div>
</div>
<!-- FIM DA MODAL -->
<!-- Conteúdo oculto para gerar o PDF -->
<div id="report-pdf" ref="pdfContent" style="display: none;" class="content">
<h1 class="title is-4 has-text-dark">TestTask</h1>
<div class="has-text-grey mb-4">
Data do teste: {{ new Date(lastTest.date).toLocaleString('pt-BR') }}
</div>
<div class="has-text-grey">
Relatório gerado em {{ new Date().toLocaleString('pt-BR') }}
</div>
<!-- Resumo de status dos testes -->
<div style="margin: 1rem 0;" v-if="lastTest.tests">
<p :class="{
'has-text-success': testsPassed === lastTest.tests.length,
'has-text-danger': testsPassed !== lastTest.tests.length
}" style="font-size: 1.2rem;">
<template v-if="testsPassed === lastTest.tests.length">
Testes passaram: {{ testsPassed }} de {{ lastTest.tests.length }}
<i class="material-icons" style="vertical-align: middle;">check</i>
</template>
<template v-else>
Testes: {{ testsPassed }} de {{ lastTest.tests.length }} (falharam {{ lastTest.tests.length -
testsPassed }})
<i class="material-icons" style="vertical-align: middle;">close</i>
</template>
</p>
</div>
<p class="has-text-grey-dark my-5">O teste durou: {{ totalDuration }}</p>
<table class="table is-bordered is-fullwidth is-striped">
<thead>
<tr>
<th>Descrição</th>
<th>Status</th>
<th>Tempo</th>
</tr>
</thead>
<tbody>
<tr v-for="(result, index) in lastTest.tests" :key="'pdf-'+index">
<td>{{ result.description }}</td>
<td :class="{ color: result.error ? 'has-text-danger' : 'has-text-success' }">
<span v-if="result.error">
<i class="material-icons" style="vertical-align: middle;">close</i>
{{ result.error }}
</span>
<span v-else>
<i class="material-icons" style="vertical-align: middle;">check</i>
Passou
</span>
</td>
<td>{{ formatExecutionTime(result.duration) }}</td>
</tr>
</tbody>
</table>
<div style="display: flex; justify-content: space-between; font-size: 0.8rem; margin-top: 1rem;">
<div class="has-text-grey"></div>
<div><!-- Paginação automática do html2pdf --></div>
</div>
</div>
</div>
<script src="vue@2.js"></script>
<script src="html2pdf.bundle.min.js"></script>
<script src="xlsx.full.min.js"></script>
<script src="report-api.js"></script>
</body>
</html>