Electron export test #3376 (#3512)

* electron export test #3376

* typo

* increase timeout
This commit is contained in:
Kurt Hutten
2024-08-19 16:29:44 +10:00
committed by GitHub
parent 5e694961e8
commit 2e24137863
4 changed files with 132 additions and 16 deletions

View File

@ -538,14 +538,19 @@ export interface Paths {
export const doExport = async (
output: Models['OutputFormat_type'],
page: Page
page: Page,
isElectron = false
): Promise<Paths> => {
await page.getByRole('button', { name: APP_NAME }).click()
const exportMenuButton = page.getByRole('button', {
name: 'Export current part',
})
await expect(exportMenuButton).toBeVisible()
await exportMenuButton.click()
if (!isElectron) {
await page.getByRole('button', { name: APP_NAME }).click()
const exportMenuButton = page.getByRole('button', {
name: 'Export current part',
})
await expect(exportMenuButton).toBeVisible()
await exportMenuButton.click()
} else {
await page.getByTestId('export-pane-button').click()
}
await expect(page.getByTestId('command-bar')).toBeVisible()
// Go through export via command bar
@ -572,13 +577,21 @@ export const doExport = async (
const [downloadPromise1, downloadResolve1] = getPromiseAndResolve()
let downloadCnt = 0
page.on('download', async (download) => {
if (downloadCnt === 0) {
downloadResolve1(download)
}
downloadCnt++
})
if (!isElectron)
page.on('download', async (download) => {
if (downloadCnt === 0) {
downloadResolve1(download)
}
downloadCnt++
})
await page.getByRole('button', { name: 'Submit command' }).click()
if (isElectron) {
return {
modelPath: '',
imagePath: '',
outputType: output.type,
}
}
// Handle download
const download = await downloadPromise1