Skip to content

Commit

Permalink
Smoke tests: R and Python F1 help from console (#5416)
Browse files Browse the repository at this point in the history
F1 help test for R and Python from console.

### QA Notes

All smoke tests should pass.
  • Loading branch information
testlabauto authored Nov 19, 2024
1 parent 3b7693d commit 3d0cc41
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 2 deletions.
4 changes: 4 additions & 0 deletions test/automation/src/positron/positronConsole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ export class PositronConsole {
);
}

async doubleClickConsoleText(text: string) {
await this.code.driver.page.locator(`${ACTIVE_CONSOLE_INSTANCE} div span`).getByText(text).dblclick();
}

async waitForConsoleContents(accept?: (contents: string[]) => boolean) {
const elements = await this.code.waitForElements(`${ACTIVE_CONSOLE_INSTANCE} div span`,
false,
Expand Down
6 changes: 4 additions & 2 deletions test/smoke/src/areas/positron/apps/python-apps.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ describe('Python Applications #pr', () => {
const viewer = app.workbench.positronViewer;

await app.workbench.quickaccess.openFile(join(app.workspacePathOrFolder, 'workspaces', 'python_apps', 'flask_example', '__init__.py'));
await app.workbench.quickaccess.runCommand('workbench.action.toggleSidebarVisibility');
await app.workbench.quickaccess.runCommand('workbench.action.toggleAuxiliaryBar');
await app.workbench.positronEditor.pressPlay();

await app.workbench.quickaccess.runCommand('workbench.action.toggleAuxiliaryBar');
const viewerFrame = viewer.getViewerFrame();
const loginLocator = this.app.web
? viewerFrame.frameLocator('iframe').getByText('Log In')
Expand All @@ -105,7 +107,7 @@ describe('Python Applications #pr', () => {
await expect(async () => {
await expect(loginLocator).toBeVisible({ timeout: 30000 });
}).toPass({ timeout: 60000 });

await app.workbench.quickaccess.runCommand('workbench.action.toggleSidebarVisibility');
});

});
Expand Down
75 changes: 75 additions & 0 deletions test/smoke/src/areas/positron/help/f1.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2024 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/


import { expect } from '@playwright/test';
import { Application, PositronPythonFixtures, PositronRFixtures } from '../../../../../automation';
import { setupAndStartApp } from '../../../test-runner/test-hooks';
import { join } from 'path';


describe('F1 Help #web #win', () => {
setupAndStartApp();

describe('R F1 Help', () => {

before(async function () {

await PositronRFixtures.SetupFixtures(this.app as Application);
});

it('R - Verifies basic F1 help functionality [C1018854]', async function () {

const app = this.app as Application;

await app.workbench.quickaccess.openFile(join(app.workspacePathOrFolder, 'workspaces', 'nyc-flights-data-r', 'flights-data-frame.r'));
await app.workbench.quickaccess.runCommand('r.sourceCurrentFile');

await app.workbench.positronConsole.pasteCodeToConsole('colnames(df2)');

await app.workbench.positronConsole.doubleClickConsoleText('colnames');

await app.workbench.positronConsole.sendKeyboardKey('F1');

await expect(async () => {
const helpFrame = await app.workbench.positronHelp.getHelpFrame(0);
await expect(helpFrame.locator('body')).toContainText('Row and Column Names', { timeout: 30000 });
}).toPass({ timeout: 30000 });

});
});
});

describe('F1 Help #web #win #pr', () => {
setupAndStartApp();

describe('Python F1 Help', () => {

before(async function () {

await PositronPythonFixtures.SetupFixtures(this.app as Application);
});

it('Python - Verifies basic F1 help functionality [C1018854]', async function () {

const app = this.app as Application;

await app.workbench.quickaccess.openFile(join(app.workspacePathOrFolder, 'workspaces', 'nyc-flights-data-py', 'flights-data-frame.py'));
await app.workbench.quickaccess.runCommand('python.execInConsole');

await app.workbench.positronConsole.pasteCodeToConsole('list(df.columns)');

await app.workbench.positronConsole.doubleClickConsoleText('list');

await app.workbench.positronConsole.sendKeyboardKey('F1');

await expect(async () => {
const helpFrame = await app.workbench.positronHelp.getHelpFrame(0);
await expect(helpFrame.locator('p').first()).toContainText('Built-in mutable sequence.', { timeout: 30000 });
}).toPass({ timeout: 30000 });

});
});
});

0 comments on commit 3d0cc41

Please sign in to comment.