Skip to content

Commit abfc30a

Browse files
authored
Update cypress.md
1 parent d4cbfa5 commit abfc30a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

docs/testing/cypress.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ cy.get('#foo')
270270
This keeps you from having to constantly add arbitrary timeout (and retry) logic in your test code flow.
271271

272272

273-
## Tip: Unit testing applicaiton code
273+
## Tip: Unit testing application code
274274
You can also use cypress to unit test your application code in isolation e.g.
275275

276276
```js
@@ -286,6 +286,15 @@ it('should only call function once', () => {
286286
});
287287
```
288288

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 });`.
296+
297+
289298

290299
## Resources
291300
* Website: https://www.cypress.io/

0 commit comments

Comments
 (0)