Skip to content

fix(cypress): Use visit instead of reload to avoid cypress error #52524

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

Closed
wants to merge 1 commit into from

Conversation

come-nc
Copy link
Contributor

@come-nc come-nc commented Apr 29, 2025

  • Resolves: #

Summary

cypress test cypress/e2e/files_sharing/note-to-recipient.cy.ts was failing a lot in CI. This is an attempt to fix that.

Not 100% clear why the reload makes it flaky, but it seems related. My only guess is that with reload the details panel is already opened maybe?

Checklist

Not 100% clear why the reload makes it flaky, but it seems related.
My only guess is that with reload the details panel is already opened
 maybe?

Signed-off-by: Côme Chilliet <[email protected]>
@come-nc come-nc added the 3. to review Waiting for reviews label Apr 29, 2025
@come-nc come-nc self-assigned this Apr 29, 2025
@come-nc come-nc marked this pull request as ready for review April 29, 2025 09:15
@come-nc come-nc requested a review from a team as a code owner April 29, 2025 09:15
@come-nc come-nc requested review from artonge, skjnldsv and sorbaugh and removed request for a team April 29, 2025 09:15
@come-nc come-nc added the CI label Apr 29, 2025
@come-nc come-nc added this to the Nextcloud 32 milestone Apr 29, 2025
@come-nc
Copy link
Contributor Author

come-nc commented Apr 29, 2025

/backport to stable31

@come-nc
Copy link
Contributor Author

come-nc commented Apr 29, 2025

/backport to stable30

@come-nc
Copy link
Contributor Author

come-nc commented Apr 29, 2025

/backport to stable29

@@ -72,7 +72,7 @@ describe('files_sharing: Note to recipient', { testIsolation: true }, () => {
createShare('folder', sharee.userId, { read: true, download: true, note: 'Hello, this is the note.' })

// reload just to be sure
cy.reload()
cy.visit('/apps/files')
Copy link
Contributor

Choose a reason for hiding this comment

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

Not 100% sure as in the past Cypress did not do anything if it was already on that page.
Meaning it would not reload the page and in that case the following test is useless as it will always succeed.

Because we need a full reload to verify the UI is loaded correctly again

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hum.
Then should I leave both reload and then visit?
Or do I add a logout/login?

@susnux
Copy link
Contributor

susnux commented Apr 29, 2025

It seems to be more a problem of the file utils:

   1) files_sharing: Note to recipient
       shows an existing note when editing a share:
     AssertionError: Timed out retrying after 4000ms: Expected to find element: `undefined`, but never found it.
      at eval (webpack://nextcloud/./cypress/e2e/files/FilesUtils.ts:21:18)
      at Context.eval (webpack://nextcloud/./cypress/e2e/files/FilesUtils.ts:35:42)

I guess the root cause is searchForActionInRow which does assertions on HTML elements which cannot be retried.
So its a race condition:

  • If the row is found but the actions are not yet rendered it will fail as everything is searchForActionInRow cannot be retried and will just fail.
  • If the row is found after the actions are rendered it will work.

@come-nc
Copy link
Contributor Author

come-nc commented Apr 29, 2025

It seems to be more a problem of the file utils:

   1) files_sharing: Note to recipient
       shows an existing note when editing a share:
     AssertionError: Timed out retrying after 4000ms: Expected to find element: `undefined`, but never found it.
      at eval (webpack://nextcloud/./cypress/e2e/files/FilesUtils.ts:21:18)
      at Context.eval (webpack://nextcloud/./cypress/e2e/files/FilesUtils.ts:35:42)

I guess the root cause is searchForActionInRow which does assertions on HTML elements which cannot be retried. So its a race condition:

  • If the row is found but the actions are not yet rendered it will fail as everything is searchForActionInRow cannot be retried and will just fail.
  • If the row is found after the actions are rendered it will work.

Locally the error was it could not find the role "menu". So that matches the race condition you describe. Any idea how to fix it?

@come-nc come-nc closed this Jun 10, 2025
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