Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions tests/e2e/support/objects/app-files/resource/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -812,15 +812,13 @@ export const downloadResources = async (args: downloadResourcesArgs): Promise<Do
}

case 'PREVIEW_TOPBAR':
await Promise.all([
page.locator(appBarDownloadFileButton).waitFor(),
page.locator(appBarContextMenu).click()
])
const downloadButtonPromise = page.locator(appBarDownloadFileButton).waitFor()
await page.locator(appBarContextMenu).click()
await downloadButtonPromise
Comment on lines +815 to +817
Copy link
Contributor

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?

Suggested change
const downloadButtonPromise = page.locator(appBarDownloadFileButton).waitFor()
await page.locator(appBarContextMenu).click()
await downloadButtonPromise
await page.locator(appBarContextMenu).click()
await page.locator(appBarDownloadFileButton).waitFor()

Copy link
Contributor Author

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:

  1. Preparation
  2. Action
  3. Wait

Copy link
Contributor Author

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 😆


const [download] = await Promise.all([
page.waitForEvent('download'),
page.locator(appBarDownloadFileButton).click()
])
const downloadPromise = page.waitForEvent('download')
await page.locator(appBarDownloadFileButton).click()
const download = await downloadPromise
downloads.push(download)
break
}
Expand Down
9 changes: 4 additions & 5 deletions tests/e2e/support/objects/app-files/utils/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ const texEditor = '#text-editor'
const pdfViewer = '#pdf-viewer'
const imageViewer = '.stage'

export const close = (page: Page): Promise<unknown> => {
return Promise.all([
page.waitForURL(/.*\/files\/(spaces|shares|link|search)\/.*/),
page.locator(closeTextEditorOrViewerButton).click()
])
export const close = async (page: Page) => {
const navigationPromise = page.waitForURL(/.*\/files\/(spaces|shares|link|search)\/.*/)
await page.locator(closeTextEditorOrViewerButton).click()
await navigationPromise
}

export const save = async (page: Page): Promise<unknown> => {
Expand Down