-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: [] Fix flaky tests #1825
test: [] Fix flaky tests #1825
Conversation
@@ -13,9 +13,12 @@ describe('Rich Text Editor - HR', { viewportHeight: 2000, viewportWidth: 1000 }, | |||
const expectDocumentToBeEmpty = () => richText.expectValue(undefined); | |||
|
|||
function addBlockquote(content = '') { | |||
richText.editor.click().type(content); | |||
richText.editor.click(); | |||
richText.editor.should('be.focused'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about adding a helper function that does these three steps and you just pass in the text to be typed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure as in this case at the end of these three actions we should have focus in the editor, so if we wrap them in a helper method this will be not so evident. Maybe could be hinted with good naming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 fair point, although I think being focused is a natural assumption if you're typing. Maybe something like "focusAndType"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may also want to do something like this for markdown and JSON editors, not sure if those have been flakey though. But I recall markdown having some issues at least before migrating it to component tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, actually, used almost the same name before reading your comment 😀 Also, added few (potentially) redundant checks, but should help to make it more stable.
Markdown and JSON editors doesn't seem to be flaky. I suggest not to touch them for now, but keep an eye on them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like with cypress you can never have too much redundancy 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, only thing is I'm not sure we need to check focus again after the focusAndType? but extra redundancy also doesn't hurt so maybe it's safer
Attempt to fix flaky RTE tests.