diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 4d873178f..647072c60 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -143,11 +143,11 @@ jobs: - name: Install browsers run: npm run playwright install --with-deps - - name: Capture snapshots + - name: Test snapshots uses: nick-fields/retry@v3.0.2 with: shell: bash - command: npm run test:snapshots -- --update-snapshots + command: npm run test:snapshots timeout_minutes: 5 max_attempts: 5 env: @@ -158,6 +158,17 @@ jobs: CI_PR_NUMBER: ${{ github.event.pull_request.number }} TARGET: web + - name: Update snapshots + if: always() + run: npm run test:snapshots -- --last-failed --update-snapshots + env: + token: ${{ secrets.KITTYCAD_API_TOKEN_DEV }} + TAB_API_URL: ${{ secrets.TAB_API_URL }} + TAB_API_KEY: ${{ secrets.TAB_API_KEY }} + CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha }} + CI_PR_NUMBER: ${{ github.event.pull_request.number }} + TARGET: web + - uses: actions/upload-artifact@v4 if: ${{ !cancelled() && (success() || failure()) }} with: diff --git a/e2e/playwright/file-tree.spec.ts b/e2e/playwright/file-tree.spec.ts index b51ffb75a..7ec6e1999 100644 --- a/e2e/playwright/file-tree.spec.ts +++ b/e2e/playwright/file-tree.spec.ts @@ -238,6 +238,26 @@ test.describe('when using the file tree to', () => { } ) + test( + `create new folders and that doesn't trigger a navigation`, + { tag: ['@electron', '@macos', '@windows'] }, + async ({ page, homePage, scene, toolbar, cmdBar }) => { + await homePage.goToModelingScene() + await scene.settled(cmdBar) + await toolbar.openPane('files') + const { createNewFolder } = await getUtils(page, test) + + await createNewFolder('folder') + + await createNewFolder('folder.kcl') + + await test.step(`Postcondition: folders are created and we didn't navigate`, async () => { + await toolbar.expectFileTreeState(['folder', 'folder.kcl', 'main.kcl']) + await expect(toolbar.fileName).toHaveText('main.kcl') + }) + } + ) + test( 'deleting all files recreates a default main.kcl with no code', { tag: '@electron' }, diff --git a/e2e/playwright/snapshot-tests.spec.ts-snapshots/code-color-goober-code-color-goober-works-with-single-quotes-1-Google-Chrome-linux.png b/e2e/playwright/snapshot-tests.spec.ts-snapshots/code-color-goober-code-color-goober-works-with-single-quotes-1-Google-Chrome-linux.png index c74e1e8d1..8a6d089c7 100644 Binary files a/e2e/playwright/snapshot-tests.spec.ts-snapshots/code-color-goober-code-color-goober-works-with-single-quotes-1-Google-Chrome-linux.png and b/e2e/playwright/snapshot-tests.spec.ts-snapshots/code-color-goober-code-color-goober-works-with-single-quotes-1-Google-Chrome-linux.png differ diff --git a/e2e/playwright/test-utils.ts b/e2e/playwright/test-utils.ts index e386b14c2..1ca56a799 100644 --- a/e2e/playwright/test-utils.ts +++ b/e2e/playwright/test-utils.ts @@ -557,6 +557,14 @@ export async function getUtils(page: Page, test_?: typeof test) { }) }, + createNewFolder: async (name: string) => { + return test?.step(`Create a folder named ${name}`, async () => { + await page.getByTestId('create-folder-button').click() + await page.getByTestId('tree-input-field').fill(name) + await page.keyboard.press('Enter') + }) + }, + cloneFile: async (name: string) => { return test?.step(`Cloning file '${name}'`, async () => { await page diff --git a/src/components/FileTree.tsx b/src/components/FileTree.tsx index d6a05f4d0..96ec18f31 100644 --- a/src/components/FileTree.tsx +++ b/src/components/FileTree.tsx @@ -654,7 +654,12 @@ export const useFileTreeOperations = () => { send({ type: 'Create file', - data: { name: args.name, makeDir: true, shouldSetToRename: false }, + data: { + name: args.name, + makeDir: true, + silent: true, + shouldSetToRename: false, + }, }) }