diff --git a/__tests__/text-classification.spec.js b/__tests__/text-classification.spec.js index 57c986dc..bf72b277 100644 --- a/__tests__/text-classification.spec.js +++ b/__tests__/text-classification.spec.js @@ -32,12 +32,25 @@ test('text classification simple', async () => { await page.click('text=Loggers') await page.click('text=config.yaml') - await page.getByRole('button', { name: 'Code' }).click() + // TODO: simplify the downloadPromise calls + // Here we are trying to wait for 2 seconds before clicking on the `Code` and `Download Zip` button const downloadPromise = await page .waitForEvent('download', { timeout: 2000 }) .catch(() => { + page.getByRole('button', { name: 'Code' }).click() page.getByRole('button', { name: 'Download Zip' }).click() - return page.waitForEvent('download') + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + // these catch calls are required to make sure if CI fails initially then we can have something to rely for further tests + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) }) await downloadPromise.saveAs('./dist-tests/text-classification-simple.zip') @@ -88,12 +101,22 @@ test('text classification all', async () => { await page.click('text=Loggers') await page.click('text=config.yaml') - await page.getByRole('button', { name: 'Code' }).click() const downloadPromise = await page .waitForEvent('download', { timeout: 2000 }) .catch(() => { + page.getByRole('button', { name: 'Code' }).click() page.getByRole('button', { name: 'Download Zip' }).click() - return page.waitForEvent('download') + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) }) await downloadPromise.saveAs('./dist-tests/text-classification-all.zip') }) @@ -112,14 +135,24 @@ test('text classification launch', async () => { await page.click('text=Loggers') await page.click('text=config.yaml') - await page.getByRole('button', { name: 'Code' }).click() - await page.getByRole('button', { name: 'Download Zip' }).click() const downloadPromise = await page .waitForEvent('download', { timeout: 2000 }) .catch(() => { + page.getByRole('button', { name: 'Code' }).click() page.getByRole('button', { name: 'Download Zip' }).click() - return page.waitForEvent('download') + return page.waitForEvent('download', { timeout: 2000 }) }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + await downloadPromise.saveAs('./dist-tests/text-classification-launch.zip') }) @@ -138,13 +171,22 @@ test('text classification spawn', async () => { await page.click('text=Loggers') await page.click('text=config.yaml') - await page.getByRole('button', { name: 'Code' }).click() - await page.getByRole('button', { name: 'Download Zip' }).click() const downloadPromise = await page .waitForEvent('download', { timeout: 2000 }) .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() page.getByRole('button', { name: 'Download Zip' }).click() - return page.waitForEvent('download') + return page.waitForEvent('download', { timeout: 2000 }) }) await downloadPromise.saveAs('./dist-tests/text-classification-spawn.zip') }) diff --git a/__tests__/vision-classification.spec.js b/__tests__/vision-classification.spec.js index a10d6caa..4502fbce 100644 --- a/__tests__/vision-classification.spec.js +++ b/__tests__/vision-classification.spec.js @@ -32,14 +32,25 @@ test('vision classification simple', async () => { await page.click('text=Loggers') await page.click('text=config.yaml') - await page.getByRole('button', { name: 'Code' }).click() - await page.getByRole('button', { name: 'Download Zip' }).click() - + // TODO: simplify the downloadPromise calls + // Here we are trying to wait for 2 seconds before clicking on the `Code` and `Download Zip` button const downloadPromise = await page .waitForEvent('download', { timeout: 2000 }) .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + // these catch calls are required to make sure if CI fails initially then we can have something to rely for further tests + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() page.getByRole('button', { name: 'Download Zip' }).click() - return page.waitForEvent('download') + return page.waitForEvent('download', { timeout: 2000 }) }) await downloadPromise.saveAs('./dist-tests/vision-classification-simple.zip') @@ -90,13 +101,22 @@ test('vision classification all', async () => { await page.click('text=Loggers') await page.click('text=config.yaml') - await page.getByRole('button', { name: 'Code' }).click() - await page.getByRole('button', { name: 'Download Zip' }).click() const downloadPromise = await page .waitForEvent('download', { timeout: 2000 }) .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() page.getByRole('button', { name: 'Download Zip' }).click() - return page.waitForEvent('download') + return page.waitForEvent('download', { timeout: 2000 }) }) await downloadPromise.saveAs('./dist-tests/vision-classification-all.zip') }) @@ -115,13 +135,22 @@ test('vision classification launch', async () => { await page.click('text=Loggers') await page.click('text=config.yaml') - await page.getByRole('button', { name: 'Code' }).click() - await page.getByRole('button', { name: 'Download Zip' }).click() const downloadPromise = await page .waitForEvent('download', { timeout: 2000 }) .catch(() => { + page.getByRole('button', { name: 'Code' }).click() page.getByRole('button', { name: 'Download Zip' }).click() - return page.waitForEvent('download') + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) }) await downloadPromise.saveAs('./dist-tests/vision-classification-launch.zip') }) @@ -141,13 +170,22 @@ test('vision classification spawn', async () => { await page.click('text=Loggers') await page.click('text=config.yaml') - await page.getByRole('button', { name: 'Code' }).click() - await page.getByRole('button', { name: 'Download Zip' }).click() const downloadPromise = await page .waitForEvent('download', { timeout: 2000 }) .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() page.getByRole('button', { name: 'Download Zip' }).click() - return page.waitForEvent('download') + return page.waitForEvent('download', { timeout: 2000 }) }) await downloadPromise.saveAs('./dist-tests/vision-classification-spawn.zip') }) diff --git a/__tests__/vision-dcgan.spec.js b/__tests__/vision-dcgan.spec.js index f20bf760..5cbe8a03 100644 --- a/__tests__/vision-dcgan.spec.js +++ b/__tests__/vision-dcgan.spec.js @@ -32,14 +32,25 @@ test('vision dcgan simple', async () => { await page.click('text=Loggers') await page.click('text=config.yaml') - await page.getByRole('button', { name: 'Code' }).click() - await page.getByRole('button', { name: 'Download Zip' }).click() - + // TODO: simplify the downloadPromise calls + // Here we are trying to wait for 2 seconds before clicking on the `Code` and `Download Zip` button const downloadPromise = await page .waitForEvent('download', { timeout: 2000 }) .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + // these catch calls are required to make sure if CI fails initially then we can have something to rely for further tests + page.getByRole('button', { name: 'Code' }).click() page.getByRole('button', { name: 'Download Zip' }).click() - return page.waitForEvent('download') + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) }) await downloadPromise.saveAs('./dist-tests/vision-dcgan-simple.zip') }) @@ -89,16 +100,23 @@ test('vision dcgan all', async () => { await page.click('text=Loggers') await page.click('text=config.yaml') - await page.getByRole('button', { name: 'Code' }).click() - await page.getByRole('button', { name: 'Download Zip' }).click() - const downloadPromise = await page .waitForEvent('download', { timeout: 2000 }) .catch(() => { + page.getByRole('button', { name: 'Code' }).click() page.getByRole('button', { name: 'Download Zip' }).click() - return page.waitForEvent('download') + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) }) - await downloadPromise.saveAs('./dist-tests/vision-dcgan-all.zip') }) @@ -116,16 +134,23 @@ test('vision dcgan launch', async () => { await page.click('text=Loggers') await page.click('text=config.yaml') - await page.getByRole('button', { name: 'Code' }).click() - await page.getByRole('button', { name: 'Download Zip' }).click() - const downloadPromise = await page .waitForEvent('download', { timeout: 2000 }) .catch(() => { + page.getByRole('button', { name: 'Code' }).click() page.getByRole('button', { name: 'Download Zip' }).click() - return page.waitForEvent('download') + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) }) - await downloadPromise.saveAs('./dist-tests/vision-dcgan-launch.zip') }) @@ -144,14 +169,22 @@ test('vision dcgan spawn', async () => { await page.click('text=Loggers') await page.click('text=config.yaml') - await page.getByRole('button', { name: 'Code' }).click() - await page.getByRole('button', { name: 'Download Zip' }).click() - const downloadPromise = await page .waitForEvent('download', { timeout: 2000 }) .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() page.getByRole('button', { name: 'Download Zip' }).click() - return page.waitForEvent('download') + return page.waitForEvent('download', { timeout: 2000 }) }) await downloadPromise.saveAs('./dist-tests/vision-dcgan-spawn.zip') }) diff --git a/__tests__/vision-segmentation.spec.js b/__tests__/vision-segmentation.spec.js index 5d081ee9..60baa3a7 100644 --- a/__tests__/vision-segmentation.spec.js +++ b/__tests__/vision-segmentation.spec.js @@ -32,16 +32,26 @@ test('vision segmentation simple', async () => { await page.click('text=Loggers') await page.click('text=config.yaml') - await page.getByRole('button', { name: 'Code' }).click() - await page.getByRole('button', { name: 'Download Zip' }).click() - + // TODO: simplify the downloadPromise calls + // Here we are trying to wait for 2 seconds before clicking on the `Code` and `Download Zip` button const downloadPromise = await page .waitForEvent('download', { timeout: 2000 }) .catch(() => { + page.getByRole('button', { name: 'Code' }).click() page.getByRole('button', { name: 'Download Zip' }).click() - return page.waitForEvent('download') + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + // these catch calls are required to make sure if CI fails initially then we can have something to rely for further tests + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) }) - await downloadPromise.saveAs('./dist-tests/vision-segmentation-simple.zip') }) @@ -90,14 +100,22 @@ test('vision segmentation all', async () => { await page.click('text=Loggers') await page.click('text=config.yaml') - await page.getByRole('button', { name: 'Code' }).click() - await page.getByRole('button', { name: 'Download Zip' }).click() - const downloadPromise = await page .waitForEvent('download', { timeout: 2000 }) .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() page.getByRole('button', { name: 'Download Zip' }).click() - return page.waitForEvent('download') + return page.waitForEvent('download', { timeout: 2000 }) }) await downloadPromise.saveAs('./dist-tests/vision-segmentation-all.zip') @@ -117,16 +135,23 @@ test('vision segmentation launch', async () => { await page.click('text=Loggers') await page.click('text=config.yaml') - await page.getByRole('button', { name: 'Code' }).click() - await page.getByRole('button', { name: 'Download Zip' }).click() - const downloadPromise = await page .waitForEvent('download', { timeout: 2000 }) .catch(() => { + page.getByRole('button', { name: 'Code' }).click() page.getByRole('button', { name: 'Download Zip' }).click() - return page.waitForEvent('download') + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) }) - await downloadPromise.saveAs('./dist-tests/vision-segmentation-launch.zip') }) @@ -145,14 +170,22 @@ test('vision segmentation spawn', async () => { await page.click('text=Loggers') await page.click('text=config.yaml') - await page.getByRole('button', { name: 'Code' }).click() - await page.getByRole('button', { name: 'Download Zip' }).click() - const downloadPromise = await page .waitForEvent('download', { timeout: 2000 }) .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() + page.getByRole('button', { name: 'Download Zip' }).click() + return page.waitForEvent('download', { timeout: 2000 }) + }) + .catch(() => { + page.getByRole('button', { name: 'Code' }).click() page.getByRole('button', { name: 'Download Zip' }).click() - return page.waitForEvent('download') + return page.waitForEvent('download', { timeout: 2000 }) }) await downloadPromise.saveAs('./dist-tests/vision-segmentation-spawn.zip')