From accbc1fc3b0476dcff62ceccb97c4174498fd774 Mon Sep 17 00:00:00 2001 From: Frank Noirot Date: Thu, 10 Oct 2024 11:38:24 -0400 Subject: [PATCH] Remove a few E2E workflows for test setup that have proven flaky on Windows (#4135) * Remove a few E2E workflows for test setup that have proven flaky on Windows * fix lint --- e2e/playwright/projects.spec.ts | 75 ++++++++++++++++----------------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/e2e/playwright/projects.spec.ts b/e2e/playwright/projects.spec.ts index 8538c506f..6f3402c4b 100644 --- a/e2e/playwright/projects.spec.ts +++ b/e2e/playwright/projects.spec.ts @@ -1,4 +1,4 @@ -import { test, expect, Page } from '@playwright/test' +import { test, expect } from '@playwright/test' import { doExport, executorInputPath, @@ -618,31 +618,30 @@ test( 'Deleting projects, can delete individual project, can still create projects after deleting all', { tag: '@electron' }, async ({ browserName }, testInfo) => { + const projectData = [ + ['router-template-slate', 'cylinder.kcl'], + ['bracket', 'focusrite_scarlett_mounting_braket.kcl'], + ['lego', 'lego.kcl'], + ] + const { electronApp, page } = await setupElectron({ testInfo, + folderSetupFn: async (dir) => { + // Do these serially to ensure the order is correct + for (const [name, file] of projectData) { + await fsp.mkdir(join(dir, name), { recursive: true }) + await fsp.copyFile( + executorInputPath(file), + join(dir, name, `main.kcl`) + ) + // Wait 1s between each project to ensure the order is correct + await new Promise((r) => setTimeout(r, 1_000)) + } + }, }) await page.setViewportSize({ width: 1200, height: 500 }) - page.on('console', console.log) - const createProjectAndRenameItTest = async ({ - name, - page, - }: { - name: string - page: Page - }) => { - await test.step(`Create and rename project ${name}`, async () => { - await createProjectAndRenameIt({ name, page }) - }) - } - - // we need to create the folders so that the order is correct - // creating them ahead of time with fs tools means they all have the same timestamp - await createProjectAndRenameItTest({ name: 'router-template-slate', page }) - await createProjectAndRenameItTest({ name: 'bracket', page }) - await createProjectAndRenameItTest({ name: 'lego', page }) - await test.step('delete the middle project, i.e. the bracket project', async () => { const project = page.getByText('bracket') @@ -744,8 +743,26 @@ test( 'Can sort projects on home page', { tag: '@electron' }, async ({ browserName }, testInfo) => { + const projectData = [ + ['router-template-slate', 'cylinder.kcl'], + ['bracket', 'focusrite_scarlett_mounting_braket.kcl'], + ['lego', 'lego.kcl'], + ] + const { electronApp, page } = await setupElectron({ testInfo, + folderSetupFn: async (dir) => { + // Do these serially to ensure the order is correct + for (const [name, file] of projectData) { + await fsp.mkdir(join(dir, name), { recursive: true }) + await fsp.copyFile( + executorInputPath(file), + join(dir, name, `main.kcl`) + ) + // Wait 1s between each project to ensure the order is correct + await new Promise((r) => setTimeout(r, 1_000)) + } + }, }) await page.setViewportSize({ width: 1200, height: 500 }) @@ -753,24 +770,6 @@ test( page.on('console', console.log) - const createProjectAndRenameItTest = async ({ - name, - page, - }: { - name: string - page: Page - }) => { - await test.step(`Create and rename project ${name}`, async () => { - await createProjectAndRenameIt({ name, page }) - }) - } - - // we need to create the folders so that the order is correct - // creating them ahead of time with fs tools means they all have the same timestamp - await createProjectAndRenameItTest({ name: 'router-template-slate', page }) - await createProjectAndRenameItTest({ name: 'bracket', page }) - await createProjectAndRenameItTest({ name: 'lego', page }) - await test.step('should be shorted by modified initially', async () => { const lastModifiedButton = page.getByRole('button', { name: 'Last Modified',