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

Add wait to fix cypress comment test #4176

Merged
merged 1 commit into from
Oct 9, 2023
Merged

Conversation

eikhr
Copy link
Member

@eikhr eikhr commented Oct 8, 2023

Description

I don't know why it didn't work, but waiting a bit fixes it.

Result

Testing

  • I have thoroughly tested my changes.

Cypress no logner fails. It consistently failed without the wait.


Resolves ... (either GitHub issue or Linear task)

@github-actions github-actions bot added the review-needed Pull requests that need review label Oct 8, 2023
Copy link
Member

@ivarnakken ivarnakken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get that it works, but I'm highly against this as a fix😬

@eikhr
Copy link
Member Author

eikhr commented Oct 8, 2023

Yea, it would be better if someone figured out how to wait until it is clickable. Do you have any idea what might be causing this? I think the most recent change to the comment field is to replace lego-editor with a normal input-field.

@ollfkaih ollfkaih merged commit 0e1a820 into master Oct 9, 2023
4 checks passed
@ollfkaih ollfkaih deleted the fix-cypress-comment-test branch October 9, 2023 10:24
@norbye
Copy link
Member

norbye commented Oct 9, 2023

Yea, it would be better if someone figured out how to wait until it is clickable. Do you have any idea what might be causing this? I think the most recent change to the comment field is to replace lego-editor with a normal input-field.

tl;dr: I don't think the problem is waiting until it is clickable, as it is clickable all along, but rather that the input resets both the focus and content when other parts of the page are rendered

I tried running the event page on a simulated slow connection (chrome slow 3G), and every time another API call was fetched successfully the comment area was re-rendered, and the focus on the element was lost along with the content that was written before the re-render.

My initial thought was to try to write directly into the field as below (writing before focus is lost), but this might not be sufficient as it mostly avoids the real problem..

-cy.get(c('CommentForm')).find('input').first().click();
-cy.focused().type('This event will be awesome');
+cy.get(c('CommentForm')).find('input').first().type('This event will be awesome')

It might be better to investigate the element itself to make sure the input gets saved in the state when it gets edited so the value doesn't get reset when the page re-renders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review-needed Pull requests that need review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants