Refactored dashboard drag/resize testing#3726
Conversation
71f371e to
1a0674e
Compare
gabrieldutra
left a comment
There was a problem hiding this comment.
Left some comments from what I've noticed, but it's already a gain from what it was before.
I actually had the mind-blowing of that nature of .should() methods recently as well and here we can see the difference ^^
| expect(delta.height).to.eq(0); | ||
| }); | ||
| resizeBy(cy.get('@textboxEl'), 0, 10) | ||
| .then(() => cy.get('@textboxEl')) |
There was a problem hiding this comment.
I think this being necessary is a sign that passing a cy.get() as an argument is an anti-pattern (similar to this one). We should rather use it as a Cypress command or pass something else as argument.
For now I think it's ok to leave as is, but let's keep in mind this to when we discover a better way to treat those helper commands.
There was a problem hiding this comment.
I worked on making dragBy and resizeBy into commands but it didn't go smooth so I'm leaving as is to keep moving forward.
Description
As preparation for #3722 I leveraged the retrying nature of
should()to "wait" till drag/resize animations are over, therefore making these methods much simpler and more generic.This is a no brainer - all test pass and that's all that matters!
@gabrieldutra I couldn't make
increase(func).by(value)work, so instead I just assert the end value (width/height/top/left). It's less pretty but works just as well.