From ebf6baaa436ce81075d4230b475f651b3e6e396f Mon Sep 17 00:00:00 2001 From: Rodrigo Silva Ferreira Date: Tue, 25 Nov 2025 13:24:51 -0500 Subject: [PATCH 1/3] e2e test - files pane refreshes once a file is created --- .../files-pane-refresh.test.ts | 43 ++++++++++++++ .../helpers/new-folder-flow.ts | 56 +++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 test/e2e/tests/new-folder-flow/files-pane-refresh.test.ts diff --git a/test/e2e/tests/new-folder-flow/files-pane-refresh.test.ts b/test/e2e/tests/new-folder-flow/files-pane-refresh.test.ts new file mode 100644 index 000000000000..603453b68381 --- /dev/null +++ b/test/e2e/tests/new-folder-flow/files-pane-refresh.test.ts @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (C) 2025 Posit Software, PBC. All rights reserved. + * Licensed under the Elastic License 2.0. See LICENSE.txt for license information. + *--------------------------------------------------------------------------------------------*/ + +// Simple Test: Files Pane Refresh +// Description: Verify that the Files pane refreshes after creating a file via the console. +// TODO: I'm unsure about the tags, and whether it fits well within new-folder-flow. +// If it does, should I have it as standalone test or include it to another test? +// Open to suggestions + +import { test, tags, expect } from '../_test.setup'; +import { createFileViaConsole } from './helpers/new-folder-flow'; + +test.use({ + suiteId: __filename +}); + +test.describe('Files Pane Refresh', { tag: [tags.WEB, tags.WORKBENCH, tags.CONSOLE] }, () => { + + test.afterAll(async ({ cleanup, app }) => { + // Primary removal via filesystem + await cleanup.removeTestFiles(['file.txt']); + + // Verify removal in Files pane; if still present, remove via console as a fallback + const filesList = app.code.driver.page.locator('.monaco-list > .monaco-scrollable-element'); + const stillVisible = await filesList.getByText('file.txt').count(); + if (stillVisible > 0) { + await app.workbench.console.executeCode('Python', `import pathlib +p = pathlib.Path('file.txt') +try: + p.unlink() +except FileNotFoundError: + pass`); + await expect(filesList.getByText('file.txt')).toHaveCount(0, { timeout: 10000 }); + } + }); + + test('Files pane refreshes after creating file.txt via console', async function ({ app, python }) { + await createFileViaConsole(app, 'Python', 'file.txt'); + }); + // only Python needed since the file creation principle is the same with the R console +}); diff --git a/test/e2e/tests/new-folder-flow/helpers/new-folder-flow.ts b/test/e2e/tests/new-folder-flow/helpers/new-folder-flow.ts index 5ed569cf6509..a15e7ab482d2 100644 --- a/test/e2e/tests/new-folder-flow/helpers/new-folder-flow.ts +++ b/test/e2e/tests/new-folder-flow/helpers/new-folder-flow.ts @@ -96,3 +96,59 @@ export async function verifyPyprojectTomlNotCreated(app: Application) { await expect(files.getByText('pyproject.toml')).toHaveCount(0, { timeout: 50000 }); }); } + +/** + * Create a file and a folder via console and verify they appear in the Files pane. + */ +export async function createFileAndFolderViaConsole( + app: Application, + runtime: 'Python' | 'R', + fileName: string, + folderName: string +) { + await test.step(`Create file and folder via ${runtime} and verify Files pane`, async () => { + if (runtime === 'Python') { + const pyCode = ` +import os +with open('${fileName}', 'w') as f: + f.write('hello') +os.makedirs('${folderName}', exist_ok=True) +`; + await app.workbench.console.executeCode('Python', pyCode); + } else { + const rCode = ` +file.create('${fileName}') +dir.create('${folderName}', showWarnings = FALSE) +`; + await app.workbench.console.executeCode('R', rCode); + } + + await app.workbench.explorer.verifyExplorerFilesExist([fileName]); + await app.workbench.explorer.verifyExplorerFilesExist([folderName]); + }); +} + +/** + * Create a single file via console and verify it appears in the Files pane. + */ +export async function createFileViaConsole( + app: Application, + runtime: 'Python' | 'R', + fileName: string +) { + await test.step(`Create file via ${runtime} and verify Files pane`, async () => { + if (runtime === 'Python') { + const pyCode = ` +open('${fileName}', 'w').write('hello') +`; + await app.workbench.console.executeCode('Python', pyCode); + } else { + const rCode = ` +file.create('${fileName}') +`; + await app.workbench.console.executeCode('R', rCode); + } + + await app.workbench.explorer.verifyExplorerFilesExist([fileName]); + }); +} From 6333a74e6ef3473ab0cda41049c2e03c4adc3ba6 Mon Sep 17 00:00:00 2001 From: Rodrigo Silva Ferreira Date: Mon, 1 Dec 2025 11:33:04 -0500 Subject: [PATCH 2/3] remove TODO comments and move file to console dir --- .../{new-folder-flow => console}/files-pane-refresh.test.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) rename test/e2e/tests/{new-folder-flow => console}/files-pane-refresh.test.ts (85%) diff --git a/test/e2e/tests/new-folder-flow/files-pane-refresh.test.ts b/test/e2e/tests/console/files-pane-refresh.test.ts similarity index 85% rename from test/e2e/tests/new-folder-flow/files-pane-refresh.test.ts rename to test/e2e/tests/console/files-pane-refresh.test.ts index 603453b68381..4210bafe1d1d 100644 --- a/test/e2e/tests/new-folder-flow/files-pane-refresh.test.ts +++ b/test/e2e/tests/console/files-pane-refresh.test.ts @@ -5,12 +5,9 @@ // Simple Test: Files Pane Refresh // Description: Verify that the Files pane refreshes after creating a file via the console. -// TODO: I'm unsure about the tags, and whether it fits well within new-folder-flow. -// If it does, should I have it as standalone test or include it to another test? -// Open to suggestions import { test, tags, expect } from '../_test.setup'; -import { createFileViaConsole } from './helpers/new-folder-flow'; +import { createFileViaConsole } from '../new-folder-flow/helpers/new-folder-flow'; test.use({ suiteId: __filename From fdf9ab44885ac3c1b22d4991967c4449e14f4a44 Mon Sep 17 00:00:00 2001 From: Rodrigo Silva Ferreira Date: Mon, 1 Dec 2025 12:24:08 -0500 Subject: [PATCH 3/3] unskip tests after pyrefly add --- test/e2e/tests/diagnostics/diagnostics.test.ts | 2 +- test/e2e/tests/outline/outline.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/e2e/tests/diagnostics/diagnostics.test.ts b/test/e2e/tests/diagnostics/diagnostics.test.ts index d29c462c9c0c..e128d79c8d33 100644 --- a/test/e2e/tests/diagnostics/diagnostics.test.ts +++ b/test/e2e/tests/diagnostics/diagnostics.test.ts @@ -17,7 +17,7 @@ test.describe('Diagnostics', { await runCommand('workbench.action.closeAllEditors'); }); - test.skip('Python - Verify diagnostics isolation between sessions in the editor and problems view', async function ({ app, runCommand, sessions }) { + test('Python - Verify diagnostics isolation between sessions in the editor and problems view', async function ({ app, runCommand, sessions }) { const { problems, editor, console } = app.workbench; // Start Python Session and install 'termcolor' diff --git a/test/e2e/tests/outline/outline.test.ts b/test/e2e/tests/outline/outline.test.ts index ddd975c57af3..98e74769086b 100644 --- a/test/e2e/tests/outline/outline.test.ts +++ b/test/e2e/tests/outline/outline.test.ts @@ -32,7 +32,7 @@ test.describe('Outline', { tag: [tags.WEB, tags.WIN, tags.OUTLINE] }, () => { await outline.focus(); }); - test.skip('Verify outline is based on editor and per session', async function ({ app, sessions }) { + test('Verify outline is based on editor and per session', async function ({ app, sessions }) { const { outline, console, editor } = app.workbench; // No active session - verify no outlines @@ -141,7 +141,7 @@ test.describe('Outline', { tag: [tags.WEB, tags.WIN, tags.OUTLINE] }, () => { test.describe('Outline: Basic', () => { - test.skip('Python - Verify Outline Contents', async function ({ app, python, openFile }) { + test('Python - Verify Outline Contents', async function ({ app, python, openFile }) { await openFile(join('workspaces', 'chinook-db-py', 'chinook-sqlite.py')); await app.workbench.outline.expectOutlineToContain([ 'data_file_path',