@equallyze/wally-cypress 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Equallyze
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,416 @@
1
+ # @equallyze/wally-cypress
2
+
3
+ > Plugin Cypress para integraΓ§Γ£o com a plataforma **Wally** de testes automatizados de acessibilidade digital.
4
+
5
+ [![npm version](https://badge.fury.io/js/@equallyze%2Fwally-cypress.svg)](https://www.npmjs.com/package/@equallyze/wally-cypress)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ ---
9
+
10
+ ## πŸ“‹ Índice
11
+
12
+ - [VisΓ£o Geral](#-visΓ£o-geral)
13
+ - [InstalaΓ§Γ£o](#-instalaΓ§Γ£o)
14
+ - [ConfiguraΓ§Γ£o](#%EF%B8%8F-configuraΓ§Γ£o)
15
+ - [Uso](#-uso)
16
+ - [API](#-api)
17
+ - [Exemplos](#-exemplos)
18
+ - [Fluxo de Funcionamento](#-fluxo-de-funcionamento)
19
+ - [Troubleshooting](#-troubleshooting)
20
+
21
+ ---
22
+
23
+ ## 🎯 Visão Geral
24
+
25
+ O **wally-cypress** permite integrar seus testes E2E Cypress com a plataforma Wally para:
26
+
27
+ - βœ… Capturar pΓ‘ginas durante a execuΓ§Γ£o dos testes
28
+ - βœ… Enviar HTML para anΓ‘lise automΓ‘tica de acessibilidade
29
+ - βœ… Gerar relatΓ³rios detalhados de conformidade (WCAG 2.1/2.2, ABNT NBR 17225, EAA)
30
+ - βœ… Integrar com pipelines CI/CD
31
+
32
+ ### Como funciona?
33
+
34
+ 1. **InΓ­cio da execuΓ§Γ£o**: Plugin inicia uma sessΓ£o de navegaΓ§Γ£o no Wally
35
+ 2. **Durante os testes**: `cy.accessibility('Nome da PΓ‘gina')` captura e envia o HTML
36
+ 3. **Fim da execuΓ§Γ£o**: SessΓ£o Γ© finalizada e anΓ‘lise de acessibilidade Γ© disparada
37
+ 4. **Resultado**: RelatΓ³rio disponΓ­vel no dashboard Wally
38
+
39
+ ---
40
+
41
+ ## πŸ“¦ InstalaΓ§Γ£o
42
+
43
+ ```bash
44
+ # npm
45
+ npm install @equallyze/wally-cypress --save-dev
46
+
47
+ # yarn
48
+ yarn add @equallyze/wally-cypress --dev
49
+
50
+ # pnpm
51
+ pnpm add @equallyze/wally-cypress -D
52
+ ```
53
+
54
+ ### Requisitos
55
+
56
+ - Node.js >= 18.0.0
57
+ - Cypress >= 12.0.0
58
+ - Conta no [Wally](https://acessibilidade.global) com API Key
59
+
60
+ ---
61
+
62
+ ## βš™οΈ ConfiguraΓ§Γ£o
63
+
64
+ ### 1. Configurar o Plugin (cypress.config.ts)
65
+
66
+ ```typescript
67
+ import { defineConfig } from 'cypress';
68
+ import { wallyPlugin } from '@equallyze/wally-cypress/plugin';
69
+
70
+ export default defineConfig({
71
+ e2e: {
72
+ baseUrl: 'https://seu-site.com',
73
+ setupNodeEvents(on, config) {
74
+ // ConfiguraΓ§Γ£o do plugin Wally
75
+ wallyPlugin(on, config, {
76
+ apiKey: process.env.WALLY_API_KEY!,
77
+ projectId: process.env.WALLY_PROJECT_ID!,
78
+ });
79
+
80
+ return config;
81
+ },
82
+ },
83
+ });
84
+ ```
85
+
86
+ ### 2. Importar Support Commands (cypress/support/e2e.ts)
87
+
88
+ ```typescript
89
+ import '@equallyze/wally-cypress/support';
90
+ ```
91
+
92
+ ### 3. VariΓ‘veis de Ambiente
93
+
94
+ Crie um arquivo `.env` ou configure no seu CI/CD:
95
+
96
+ ```bash
97
+ WALLY_API_KEY=sua-api-key-aqui
98
+ WALLY_PROJECT_ID=id-do-projeto
99
+ ```
100
+
101
+ #### Obtendo suas credenciais
102
+
103
+ 1. Acesse [wally.equallyze.com](https://acessibilidade.global)
104
+ 2. VΓ‘ em **ConfiguraΓ§Γ΅es** > **API Keys**
105
+ 3. Crie uma nova API Key
106
+ 4. Copie o **Project ID** do projeto desejado
107
+
108
+ ---
109
+
110
+ ## πŸš€ Uso
111
+
112
+ ### Uso BΓ‘sico
113
+
114
+ ```typescript
115
+ describe('Testes de Acessibilidade', () => {
116
+ it('deve verificar acessibilidade do fluxo de checkout', () => {
117
+ // Navega para homepage
118
+ cy.visit('/');
119
+ cy.accessibility('Homepage'); // Captura para anΓ‘lise
120
+
121
+ // Navega para produtos
122
+ cy.get('[data-cy="products-link"]').click();
123
+ cy.accessibility('PΓ‘gina de Produtos');
124
+
125
+ // Adiciona ao carrinho
126
+ cy.get('[data-cy="add-to-cart"]').first().click();
127
+ cy.accessibility('Carrinho de Compras');
128
+
129
+ // Checkout
130
+ cy.get('[data-cy="checkout-btn"]').click();
131
+ cy.accessibility('Checkout - Step 1');
132
+ });
133
+ });
134
+ ```
135
+
136
+ ### MΓΊltiplos Specs
137
+
138
+ A sessΓ£o Γ© gerenciada automaticamente durante toda a execuΓ§Γ£o do Cypress:
139
+
140
+ ```typescript
141
+ // spec-1.cy.ts
142
+ describe('Homepage', () => {
143
+ it('deve ser acessΓ­vel', () => {
144
+ cy.visit('/');
145
+ cy.accessibility('Homepage');
146
+ });
147
+ });
148
+
149
+ // spec-2.cy.ts
150
+ describe('Produtos', () => {
151
+ it('lista deve ser acessΓ­vel', () => {
152
+ cy.visit('/produtos');
153
+ cy.accessibility('Lista de Produtos');
154
+ });
155
+ });
156
+ // Todas as pΓ‘ginas capturadas sΓ£o enviadas na mesma sessΓ£o
157
+ // e analisadas juntas ao final da execuΓ§Γ£o
158
+ ```
159
+
160
+ ---
161
+
162
+ ## πŸ“– API
163
+
164
+ ### Comando Cypress
165
+
166
+ #### `cy.accessibility(pageName)`
167
+
168
+ Captura a pΓ‘gina atual e envia para anΓ‘lise de acessibilidade.
169
+
170
+ | ParΓ’metro | Tipo | DescriΓ§Γ£o |
171
+ | ---------- | -------- | ------------------------------------------------------ |
172
+ | `pageName` | `string` | Nome descritivo da pΓ‘gina (ex: "Homepage", "Checkout") |
173
+
174
+ **Retorna**: `Chainable<WallyPage | null>`
175
+
176
+ ```typescript
177
+ cy.accessibility('FormulΓ‘rio de Cadastro').then((page) => {
178
+ expect(page?.title).to.equal('FormulΓ‘rio de Cadastro');
179
+ });
180
+ ```
181
+
182
+ > **Nota**: A sessΓ£o Wally Γ© gerenciada automaticamente pelo plugin:
183
+ >
184
+ > - **InΓ­cio**: Hook `before:run` inicia a sessΓ£o
185
+ > - **Fim**: Hook `after:run` finaliza e dispara a anΓ‘lise
186
+
187
+ ---
188
+
189
+ ### OpΓ§Γ΅es de ConfiguraΓ§Γ£o
190
+
191
+ | OpΓ§Γ£o | Tipo | Default | DescriΓ§Γ£o |
192
+ | --------------- | --------- | -------------- | ------------------------------------------------ |
193
+ | `apiKey` | `string` | **required** | API Key da organizaΓ§Γ£o |
194
+ | `projectId` | `string` | **required** | ID do projeto no Wally |
195
+ | `environment` | `string` | `'production'` | Ambiente: `production`, `staging`, `development` |
196
+ | `normId` | `string` | - | ID da norma de acessibilidade |
197
+ | `qualityGateId` | `string` | - | ID do quality gate |
198
+ | `timeout` | `number` | `30000` | Timeout das requisiΓ§Γ΅es (ms) |
199
+ | `failOnError` | `boolean` | `false` | Falhar teste em caso de erro |
200
+
201
+ ---
202
+
203
+ ## πŸ’‘ Exemplos
204
+
205
+ ### IntegraΓ§Γ£o com Login
206
+
207
+ ```typescript
208
+ describe('Área autenticada', () => {
209
+ beforeEach(() => {
210
+ cy.login(); // Seu comando de login
211
+ });
212
+
213
+ it('dashboard deve ser acessΓ­vel', () => {
214
+ cy.visit('/dashboard');
215
+ cy.accessibility('Dashboard');
216
+
217
+ cy.get('[data-cy="profile-menu"]').click();
218
+ cy.accessibility('Menu de Perfil Aberto');
219
+ });
220
+ });
221
+ ```
222
+
223
+ ### Testando Modais e Overlays
224
+
225
+ ```typescript
226
+ it('modal de confirmaΓ§Γ£o deve ser acessΓ­vel', () => {
227
+ cy.visit('/products');
228
+ cy.accessibility('Lista de Produtos');
229
+
230
+ // Abre modal
231
+ cy.get('[data-cy="delete-btn"]').first().click();
232
+ cy.get('[data-cy="confirm-modal"]').should('be.visible');
233
+
234
+ // Captura com modal aberto
235
+ cy.accessibility('Modal de ConfirmaΓ§Γ£o');
236
+
237
+ // Fecha modal
238
+ cy.get('[data-cy="cancel-btn"]').click();
239
+ });
240
+ ```
241
+
242
+ ### CI/CD (GitHub Actions)
243
+
244
+ ```yaml
245
+ name: E2E Tests with Accessibility
246
+
247
+ on: [push, pull_request]
248
+
249
+ jobs:
250
+ cypress:
251
+ runs-on: ubuntu-latest
252
+ steps:
253
+ - uses: actions/checkout@v4
254
+
255
+ - name: Setup Node.js
256
+ uses: actions/setup-node@v4
257
+ with:
258
+ node-version: '20'
259
+
260
+ - name: Install dependencies
261
+ run: npm ci
262
+
263
+ - name: Run Cypress tests
264
+ run: npm run cy:run
265
+ env:
266
+ WALLY_API_KEY: ${{ secrets.WALLY_API_KEY }}
267
+ WALLY_PROJECT_ID: ${{ secrets.WALLY_PROJECT_ID }}
268
+ ```
269
+
270
+ ---
271
+
272
+ ## πŸ”„ Fluxo de Funcionamento
273
+
274
+ ```
275
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
276
+ β”‚ CYPRESS TEST β”‚
277
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
278
+ β”‚ β”‚ before:run β”‚β†’ β”‚ Test Specs β”‚β†’ β”‚ after:run β”‚ β”‚
279
+ β”‚ β”‚ (init plugin) β”‚ β”‚ (captures) β”‚ β”‚ (finish) β”‚ β”‚
280
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
281
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
282
+ β”‚ β”‚ β”‚
283
+ β–Ό β–Ό β–Ό
284
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
285
+ β”‚ WALLY BACKEND API β”‚
286
+ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
287
+ β”‚ β”‚ POST /sessions β”‚ β”‚ POST /pages β”‚ β”‚ POST /finish β”‚ β”‚
288
+ β”‚ β”‚ (create) β”‚ β”‚ (upload HTML) β”‚ β”‚ (analyze) β”‚ β”‚
289
+ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
290
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
291
+ β”‚
292
+ β–Ό
293
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
294
+ β”‚ WALLY ANALYSIS β”‚
295
+ β”‚ (WCAG/NBR/EAA) β”‚
296
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
297
+ β”‚
298
+ β–Ό
299
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
300
+ β”‚ WALLY DASHBOARD β”‚
301
+ β”‚ (RelatΓ³rios) β”‚
302
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
303
+ ```
304
+
305
+ ---
306
+
307
+ ## πŸ› Troubleshooting
308
+
309
+ ### Erro: "apiKey Γ© obrigatΓ³rio"
310
+
311
+ Certifique-se de que a variΓ‘vel de ambiente estΓ‘ configurada:
312
+
313
+ ```bash
314
+ # Teste local
315
+ export WALLY_API_KEY=sua-api-key
316
+ npx cypress run
317
+ ```
318
+
319
+ ### Erro: "Falha ao validar API Key"
320
+
321
+ 1. Verifique se a API Key estΓ‘ correta
322
+ 2. Confira se a API Key nΓ£o expirou
323
+ 3. Verifique conectividade com a API Wally
324
+
325
+ ### PΓ‘ginas nΓ£o aparecem no relatΓ³rio
326
+
327
+ 1. Verifique se `cy.accessibility()` estΓ‘ sendo chamado
328
+ 2. Confira os logs do Cypress para erros
329
+ 3. Ative `verbose: true` na configuraΓ§Γ£o
330
+
331
+ ### SessΓ£o nΓ£o Γ© finalizada
332
+
333
+ O plugin finaliza automaticamente no hook `after:run`. Verifique se:
334
+
335
+ 1. O Cypress estΓ‘ finalizando corretamente (sem crash)
336
+ 2. A configuraΓ§Γ£o do plugin estΓ‘ correta no `cypress.config.ts`
337
+ 3. NΓ£o hΓ‘ erros de rede/timeout nos logs
338
+
339
+ ---
340
+
341
+ ## πŸ“„ LicenΓ§a
342
+
343
+ MIT Β© [Equallyze](https://equallyze.com)
344
+
345
+ ---
346
+
347
+ ## �️ Desenvolvimento
348
+
349
+ ### PrΓ©-requisitos
350
+
351
+ - Node.js >= 18.0.0
352
+ - npm ou pnpm
353
+
354
+ ### Setup local
355
+
356
+ ```bash
357
+ # Clone o repositΓ³rio
358
+ git clone https://gitlab.com/ucloud-tech/wally/wally-cypress.git
359
+ cd wally-cypress
360
+
361
+ # Instale dependΓͺncias
362
+ npm install
363
+
364
+ # Build
365
+ npm run build
366
+
367
+ # Rodar testes
368
+ npm test
369
+
370
+ # Rodar testes com cobertura
371
+ npm run test:coverage
372
+
373
+ # Lint
374
+ npm run lint
375
+
376
+ # Typecheck
377
+ npm run typecheck
378
+ ```
379
+
380
+ ### Hooks de Pre-commit
381
+
382
+ O projeto usa **Husky** + **lint-staged** para garantir qualidade do cΓ³digo:
383
+
384
+ - **pre-commit**: Executa ESLint e Prettier nos arquivos staged
385
+ - **pre-push**: Executa typecheck e testes com cobertura mΓ­nima de 50%
386
+
387
+ ### Scripts disponΓ­veis
388
+
389
+ | Script | DescriΓ§Γ£o |
390
+ | ----------------------- | --------------------------------- |
391
+ | `npm run build` | Compila o projeto |
392
+ | `npm run dev` | Build em modo watch |
393
+ | `npm test` | Executa testes |
394
+ | `npm run test:coverage` | Testes com relatΓ³rio de cobertura |
395
+ | `npm run lint` | Executa ESLint |
396
+ | `npm run lint:fix` | ESLint com auto-fix |
397
+ | `npm run format` | Formata cΓ³digo com Prettier |
398
+ | `npm run typecheck` | Verifica tipos TypeScript |
399
+ | `npm run validate` | Executa lint, typecheck e testes |
400
+
401
+ ### Cobertura de Testes
402
+
403
+ O projeto requer cobertura mΓ­nima de **50%** em:
404
+
405
+ - Branches
406
+ - Functions
407
+ - Lines
408
+ - Statements
409
+
410
+ ---
411
+
412
+ ## πŸ”— Links
413
+
414
+ - [DocumentaΓ§Γ£o Wally](https://docs.wally.equallyze.com)
415
+ - [Dashboard Wally](https://acessibilidade.global)
416
+ - [Suporte](mailto:suporte@equallyze.com)
@@ -0,0 +1,2 @@
1
+ export { W as WallyConfig, a as WallyEnvironment, b as WallyPage, c as WallySession, w as wallyPlugin } from './plugin-DE0EFpNI.mjs';
2
+ export { registerWallyCommands } from './support.mjs';
@@ -0,0 +1,2 @@
1
+ export { W as WallyConfig, a as WallyEnvironment, b as WallyPage, c as WallySession, w as wallyPlugin } from './plugin-DE0EFpNI.js';
2
+ export { registerWallyCommands } from './support.js';