-
Notifications
You must be signed in to change notification settings - Fork 25
fix flaky close viewer after download #1010
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
Conversation
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.
Pull Request Overview
This PR fixes flaky test behavior by refactoring asynchronous operations to use sequential awaits instead of Promise.all() for improved reliability in end-to-end tests.
- Replaced Promise.all() with sequential awaits in the editor close function to ensure proper timing
- Updated download resource functionality to use sequential awaits for better control over async operations
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/e2e/support/objects/app-files/utils/editor.ts | Refactored close function to use sequential async/await pattern instead of Promise.all() |
| tests/e2e/support/objects/app-files/resource/actions.ts | Updated download functionality to use sequential awaits for better reliability |
| const downloadButtonPromise = page.locator(appBarDownloadFileButton).waitFor() | ||
| await page.locator(appBarContextMenu).click() | ||
| await downloadButtonPromise |
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 would be the difference to?
| const downloadButtonPromise = page.locator(appBarDownloadFileButton).waitFor() | |
| await page.locator(appBarContextMenu).click() | |
| await downloadButtonPromise | |
| await page.locator(appBarContextMenu).click() | |
| await page.locator(appBarDownloadFileButton).waitFor() |
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 are looking for the button BEFORE the menu opens.
following docs
https://playwright.dev/docs/downloads#introduction
better do it like:
- Preparation
- Action
- Wait
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.
let see how it works. I couldn't think of anything more interesting 😆
|
🤔 Hmmm, this is same test that fails when tracing is enabled. |
where? in the opencloud CI? |
Yes, in Opencloud CI, SEE PR: But, currently facing some problems with playwright not being found in the CI. |
Thanks, I couldn't reproduce it using chrome. Maybe it's same issue, maybe not (I don't see auth popup in the trace) |
Try running it with tracing enabled.
Let's see 😄 |
yes, I can confirm, now I got auth popup |
Problem
The E2E tests for media viewer download and file closing were experiencing flakiness due to race conditions in Promise.all usage.
Solution
Applied Playwright's recommended "prepare promise first" pattern:
How to reproduce
HEADLESS=false pnpm test:e2e:cucumber:chromium tests/e2e/cucumber/features/shares/share.feature:79cc @dragonchaser