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
Copy file name to clipboardExpand all lines: docs/testing/cypress.md
+10-1Lines changed: 10 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -270,7 +270,7 @@ cy.get('#foo')
270
270
This keeps you from having to constantly add arbitrary timeout (and retry) logic in your test code flow.
271
271
272
272
273
-
## Tip: Unit testing applicaiton code
273
+
## Tip: Unit testing application code
274
274
You can also use cypress to unit test your application code in isolation e.g.
275
275
276
276
```js
@@ -286,6 +286,15 @@ it('should only call function once', () => {
286
286
});
287
287
```
288
288
289
+
## Tip: Breakpoint
290
+
The automatic snapshots + command log generated by the cypress test are great for debugging. That said you can pause test execution in two ways.
291
+
292
+
First make sure you have chrome developer tools open in the test runner. `CMD + ALT + i` on mac / `F12` on windows.
293
+
294
+
* Application code breakpoints: Use a `debugger` statement in your application code and the test runner will stop on that just like standard web developement.
295
+
* Test code breakpoints: You can use the `.debug()` command and cypress test execution will stop at it. Alternatively you can use a `debugger` statement in a `.then` command callback to cause a pause. e.g `.then(() => { debugger })`. You can even use it to grab some element `cy.get('#foo').then(($ /* a reference to the dom element */) => { debugger; })` or a network call e.g. `cy.request('https://someurl').then((res /* network response */) => { debugger });`.
0 commit comments