Skip to content

Commit

Permalink
more updates
Browse files Browse the repository at this point in the history
  • Loading branch information
midleman committed Dec 16, 2024
1 parent 45df21b commit 93e5b03
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test-e2e-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ jobs:
run: bash scripts/pr-tags-transform.sh ${{ inputs.project}} "${{ inputs.grep }}"
shell: bash

- run: npm --prefix test/automation run compile && npm --prefix test/e2e run compile # fail fast

- name: Cache node_modules, build, extensions, and remote
uses: ./.github/actions/cache-multi-paths

Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/test-e2e-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Compile E2E Tests
run: |
npm --prefix test/automation run compile
npm --prefix test/e2e run compile
- name: Set screen resolution
shell: pwsh
Expand Down Expand Up @@ -101,11 +105,6 @@ jobs:
- name: Compile and Download
run: npm exec -- npm-run-all --max-old-space-size=4095 -lp compile "electron x64" playwright-install download-builtin-extensions

- name: Compile E2E Tests
run: |
npm --prefix test/automation run compile
npm --prefix test/e2e run compile
- name: Install python dependencies
run: |
curl https://raw.githubusercontent.com/posit-dev/qa-example-content/main/requirements.txt --output requirements.txt
Expand Down
16 changes: 11 additions & 5 deletions test/automation/src/positron/positronConsole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { QuickInput } from '../quickinput';
import { InterpreterInfo, InterpreterType } from './utils/positronInterpreterInfo';
import { IElement } from '../driver';


const CONSOLE_INPUT = '.console-input';
const ACTIVE_CONSOLE_INSTANCE = '.console-instance[style*="z-index: auto"]';
const MAXIMIZE_CONSOLE = '.bottom .codicon-positron-maximize-panel';
Expand Down Expand Up @@ -206,17 +205,24 @@ export class PositronConsole {


async waitForConsoleContents(
expectedText: string,
consoleText: string,
options: {
timeout?: number;
contain?: boolean;
} = {}
): Promise<string[]> {
const { timeout = 30000 } = options;
const { timeout = 15000, contain = true } = options;

const consoleLines = this.code.driver.page.locator(CONSOLE_LINES);
await expect(consoleLines.filter({ hasText: expectedText })).toBeVisible({ timeout });
const filteredLines = consoleLines.filter({ hasText: consoleText });

return await consoleLines.allTextContents();
if (contain) {
await expect(filteredLines).toBeVisible({ timeout });
return filteredLines.allTextContents();
} else {
await expect(consoleLines.filter({ hasText: consoleText })).toHaveCount(0, { timeout });
return [];
}
}

async waitForCurrentConsoleLineContents(expectedText: string, timeout = 30000): Promise<string> {
Expand Down
6 changes: 2 additions & 4 deletions test/e2e/features/console/console-clipboard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ async function toggleAuxiliaryBar(app: Application) {

async function initializeConsole(console: any) {
await test.step('Initialize console', async () => {
await console.sendEnterKey(); // Clear current input
await console.barClearButton.click(); // Clear console history
await console.waitForConsoleContents(''); // Ensure console is empty
await console.sendEnterKey();
await console.barClearButton.click();
});
}

Expand All @@ -66,7 +65,6 @@ async function executeCopyAndPaste(console: any, page: any, testLine: string) {

// Clear the console
await console.barClearButton.click();
await console.waitForConsoleContents('');

// Paste the copied line into the console
await page.keyboard.press(`${modifier}+V`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ test.describe('R - New Project Wizard', { tag: [tags.NEW_PROJECT_WIZARD] }, () =

// You should either manually interact with the Console to proceed with the Renv
// install or temporarily uncomment the code below to automate the interaction.
// await app.workbench.positronConsole.waitForConsoleContents((contents) =>
// contents.some((line) => line.includes('Do you want to proceed?'))
// );
// await app.workbench.positronConsole.waitForConsoleContents('Do you want to proceed?')
// await app.workbench.positronConsole.typeToConsole('y');
// await app.workbench.positronConsole.sendEnterKey();

Expand All @@ -73,7 +71,7 @@ test.describe('R - New Project Wizard', { tag: [tags.NEW_PROJECT_WIZARD] }, () =
expect(projectFiles).toContain('renv.lock');
}).toPass({ timeout: 50000 });
// Verify that renv output in the console confirms no issues occurred
await app.workbench.positronConsole.waitForConsoleContents('renv activated')
await app.workbench.positronConsole.waitForConsoleContents('renv activated');
});

test('R - Renv already installed [C656251]', { tag: [tags.WIN] }, async function ({ app }) {
Expand All @@ -97,15 +95,15 @@ test.describe('R - New Project Wizard', { tag: [tags.NEW_PROJECT_WIZARD] }, () =
expect(projectFiles).toContain('renv.lock');
}).toPass({ timeout: 50000 });
// Verify that renv output in the console confirms no issues occurred
await app.workbench.positronConsole.waitForConsoleContents('renv activated')
await app.workbench.positronConsole.waitForConsoleContents('renv activated');
});

test('R - Cancel Renv install [C656252]', { tag: [tags.WIN] }, async function ({ app }) {
const projSuffix = addRandomNumSuffix('_cancelRenvInstall');
const pw = app.workbench.positronNewProjectWizard;
// Remove renv package so we are prompted to install it again
await app.workbench.positronConsole.executeCode('R', 'remove.packages("renv")', '>');
await app.workbench.positronConsole.waitForConsoleContents(`Removing package`)
await app.workbench.positronConsole.waitForConsoleContents(`Removing package`);
// Create a new R project - select Renv but opt out of installing
await pw.startNewProject(ProjectType.R_PROJECT);
await pw.navigate(ProjectWizardNavigateAction.NEXT);
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/features/plots/plots.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ test.describe('Plots', { tag: [tags.PLOTS, tags.EDITOR] }, () => {
await app.workbench.positronPlots.waitForWebviewPlot('.widget-output .jp-OutputArea-child');

// The printed statement should not be shown in the console.
const lines = await app.workbench.positronConsole.waitForConsoleContents();
expect(lines).not.toContain('Hello, world!');
await app.workbench.positronConsole.waitForConsoleContents('Hello World', { contain: false });

});

test('Python - Verifies bokeh Python widget [C730343]', { tag: [tags.WEB, tags.WIN] }, async function ({ app }) {
Expand Down

0 comments on commit 93e5b03

Please sign in to comment.