gifted-bear-34349
07/28/2022, 10:34 PMbitter-fountain-36713
07/29/2022, 2:14 AMmagnificent-finland-58048
07/29/2022, 3:38 AMmagnificent-finland-58048
07/29/2022, 3:39 AMmagnificent-finland-58048
07/29/2022, 3:39 AMmagnificent-finland-58048
07/29/2022, 3:42 AMnutritious-analyst-96582
07/29/2022, 3:42 AMgifted-bear-34349
07/29/2022, 4:29 PMlate-planet-4481
07/30/2022, 2:39 AMit() blocks the failure won't be as pinpoint precise at a glance in a test reporter like the Cypress Dashboard, but it's close enough. 99% of the time when I see a test failure the first thing I'm doing is attempting to run the test on my local test runner, at which point I no longer need that granular level of failure in the test reporter.
I will concede that Cypress (and most testing platforms, for that matter) could benefit from a more granular divider for longer tests. Assertions aren't always a good fit for this because they tend to be too numerous and don't read well. To remedy this, I wrote my own custom command called cy.checkpoint(). It does a number of things, including:
- Adding a clear log line with a custom message and a little β next to it
- Taking a screenshot and submitting it to a visual testing tool (Percy in my case)
So for any given it() block I usually have a handful of clearly-communicated cy.checkpoint() lines (and a dozen non-obvious assertions).late-planet-4481
07/30/2022, 2:44 AMit() block it'll be a giant impenetrable mess. Conversely, if your test is too large it becomes, again, a giant impenetrable mess. There's a balance somewhere.
What I would avoid doing is making your test unreadable in an attempt to shave a few seconds off of execution time.magnificent-finland-58048
07/30/2022, 8:58 AMmagnificent-finland-58048
07/30/2022, 8:59 AMcy.log('**foo**')magnificent-finland-58048
07/30/2022, 9:01 AMgifted-bear-34349
07/30/2022, 10:32 PMlate-planet-4481
07/31/2022, 7:02 PMit() blocks repeated. But the discussion is almost beside the point... I have my doubts that many of your tests would even fit within this type of structure. Does your app really have no state you have to accumulate before your assertions? Must be nice π
If you are building up state in a beforeEach() block then there's your speed cost right there.gifted-bear-34349
07/31/2022, 7:03 PM