Skip to content
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

Merged
merged 7 commits into from
Jan 22, 2025
Merged

test: [] Fix flaky tests #1825

merged 7 commits into from
Jan 22, 2025

Conversation

colomolo
Copy link
Contributor

@colomolo colomolo commented Jan 20, 2025

Attempt to fix flaky RTE tests.

@github-actions github-actions bot added the tests label Jan 20, 2025
@colomolo colomolo marked this pull request as ready for review January 22, 2025 11:35
@colomolo colomolo requested a review from a team as a code owner January 22, 2025 11:35
@@ -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');
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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"?

Copy link
Contributor

@MayaGillilan MayaGillilan Jan 22, 2025

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

Copy link
Contributor Author

@colomolo colomolo Jan 22, 2025

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.

Copy link
Contributor

@MayaGillilan MayaGillilan Jan 22, 2025

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 😄

cypress/component/rich-text/RichTextEditor.HR.spec.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@MayaGillilan MayaGillilan left a 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

@colomolo colomolo merged commit b2fb41a into master Jan 22, 2025
16 checks passed
@colomolo colomolo deleted the fix-flaky-tests branch January 22, 2025 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants