You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Melhorar dramaticamente a experiência do desenvolvedor ao lidar com erros de timeout no Cypress, fornecendo **sugestões contextuais e acionáveis** baseadas na análise do contexto do erro.
6
+
Improve the developer experience when dealing with timeout errors in Cypress by providing actionable, context-aware suggestions based on analysis of the failure context.
6
7
7
-
## 🚀 Motivação
8
+
## Motivation
8
9
9
-
Erros de timeout são extremamente comuns em testes Cypress, mas as mensagens tradicionais são genéricas:
10
+
Timeout errors are extremely common in Cypress tests, yet default messages are often generic and unhelpful:
10
11
11
12
```
12
13
cy.get() timed out waiting 4000ms
13
14
```
14
15
15
-
Com este sistema, os desenvolvedores recebem diagnósticos inteligentes:
16
+
This diagnostics system aims to enrich those messages with intelligent, actionable suggestions:
16
17
17
18
```
18
19
cy.get() timed out waiting 4000ms
@@ -27,172 +28,120 @@ cy.get() timed out waiting 4000ms
27
28
28
29
2. 8 network requests are still pending
29
30
a) Wait for specific API calls to complete using cy.intercept()
30
-
b) Consider increasing the timeout if the requests are expected to be slow
31
-
c) Check if some requests are failing or hanging in the Network tab
Status: Work‑in‑progress (not yet integrated into Cypress). This document describes an experimental timeout diagnostics system that analyzes command context (selectors, network, animations, DOM mutations) and produces contextual recommendations to help users address flaky or timing-related failures.
35
+
36
+
Objective
37
+
---------
38
+
Improve the developer experience for timeout errors by producing actionable, context-aware suggestions when a command times out. Instead of a generic message like `cy.get() timed out waiting 4000ms`, diagnostics should indicate likely causes (dynamic content, pending network requests, animations, etc.) and suggest concrete fixes.
39
+
40
+
Motivation
41
+
----------
42
+
Timeouts are a frequent source of confusion in end-to-end tests. The goal of this feature is to reduce debugging time and teach best practices inline by providing targeted suggestions and examples.
43
+
44
+
Example enhanced output
45
+
-----------------------
46
+
```
47
+
cy.get('.user-list') timed out waiting 4000ms
48
+
49
+
Diagnostic suggestions:
50
+
51
+
1) Selector likely targets dynamic content
52
+
• Wait for the loading state: cy.get('.loading-spinner').should('not.exist')
53
+
• Prefer stable data attributes: e.g. [data-cy="user-list"]
54
+
• Consider intercepting the API call that populates this content
55
+
56
+
2) Network requests pending (8)
57
+
• Use cy.intercept('GET', '/api/users').as('getUsers') and cy.wait('@getUsers')
58
+
• If requests are expected to be slow, either wait for the specific request or increase the timeout
To integrate this into Cypress's existing error pipeline we would:
102
+
103
+
1. Extend `error_utils` (or the error creation path) to provide additional context (selector, pending network count, DOM mutation rate, animation state) when creating a timeout error.
104
+
2. Call `TimeoutDiagnostics.analyze(context)` and append the returned suggestions to the error message (optionally behind a feature flag).
105
+
3. Add a configuration option to opt in/out of diagnostics in CI or local environments.
1.**Reduz tempo de debugging**: Desenvolvedores identificam problemas mais rapidamente
158
-
2.**Educação inline**: Ensina melhores práticas durante o desenvolvimento
159
-
3.**Menos frustração**: Erros mais claros = desenvolvedores mais felizes
160
-
4.**Reduz issues no GitHub**: Menos perguntas sobre "por que meu teste timeout?"
161
-
5.**Melhora adoção**: Desenvolvedores iniciantes aprendem mais rápido
124
+
```
162
125
163
-
## 🧪 Testes
164
-
165
-
Execute os testes unitários:
166
-
167
-
```bash
168
-
cd packages/driver
169
-
yarn test timeout_diagnostics.spec.ts
170
-
```
126
+
Tests
127
+
-----
128
+
Run unit tests for the diagnostics module:
171
129
172
-
Cobertura inclui:
173
-
- ✅ Detecção de todos os tipos de problemas
174
-
- ✅ Formatação de mensagens
175
-
- ✅ Casos extremos e edge cases
176
-
- ✅ Combinação de múltiplos diagnósticos
130
+
```powershell
131
+
cd packages/driver
132
+
yarn test timeout_diagnostics.spec.ts
133
+
```
177
134
178
-
## 🚀 Próximos Passos
135
+
Notes & next steps
136
+
------------------
137
+
- This README documents the experimental design and examples. The feature is intentionally left out of the main error flow until heuristics and runtime metric collection are reviewed.
138
+
- Next: finalize analysis heuristics, expand unit tests, and implement an opt-in integration path in `error_utils`.
179
139
180
-
1. ✅ Criar módulo de diagnósticos com testes
181
-
2. ⏳ Integrar com sistema de erros existente
182
-
3. ⏳ Adicionar coleta de métricas de contexto
183
-
4. ⏳ Criar configuração para habilitar/desabilitar
184
-
5. ⏳ Adicionar mais padrões e sugestões baseado em feedback
185
-
6. ⏳ Documentação para usuários finais
140
+
License
141
+
-------
142
+
MIT — consistent with the Cypress project
186
143
187
-
## 🤝 Contribuindo
188
-
189
-
Este é um sistema extensível. Para adicionar novos diagnósticos:
190
-
191
-
1. Adicione padrão em `COMMON_PATTERNS`
192
-
2. Crie método `analyze*Issues()`
193
-
3. Adicione testes correspondentes
194
-
4. Documente o novo diagnóstico
195
-
196
-
## 📝 Licença
197
-
198
-
MIT - Consistente com o projeto Cypress
144
+
If you'd like, I can also:
145
+
- normalize the file encoding/artifacts (there were some garbled characters in the original), and
146
+
- open a small PR on the `feat/timeout-diagnostics` branch with this cleaned README.
0 commit comments