Skip to content

Commit

Permalink
couple more
Browse files Browse the repository at this point in the history
  • Loading branch information
midleman committed Nov 2, 2024
1 parent 486ec7f commit a40ab9e
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 0 deletions.
94 changes: 94 additions & 0 deletions test/smoke/src/e2e/data-explorer/large-data-frame.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2024 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/

import { join } from 'path';
import { test, expect } from '../_test.setup';

const LAST_CELL_CONTENTS = '2013-09-30 08:00:00';
const FILTER_PARAMS = ['distance', 'is equal to', '2586'];
const POST_FILTER_DATA_SUMMARY = 'Showing 8,204 rows (2.44% of 336,776 total)  19 columns';

test.use({
suiteId: __filename
});

test.describe('Data Explorer - Large Data Frame', {
tag: ['@pr', '@web', '@win']
}, () => {
test.beforeEach(async function ({ app }) {
await app.workbench.positronLayouts.enterLayout('stacked');
});

test.afterEach(async function ({ app }) {
await app.workbench.positronDataExplorer.closeDataExplorer();
});

test('Python - Verifies data explorer functionality with large data frame [C557555]', async function ({ app, interpreter, logger }) {
await interpreter.set('Python');
await app.workbench.quickaccess.openFile(join(app.workspacePathOrFolder, 'workspaces', 'nyc-flights-data-py', 'flights-data-frame.py'));
await app.workbench.quickaccess.runCommand('python.execInConsole');

logger.log('Opening data grid');
await expect(async () => {
await app.workbench.positronVariables.doubleClickVariableRow('df');
expect(await app.code.driver.getLocator('.label-name:has-text("Data: df")').innerText() === 'Data: df');
}).toPass();

await app.workbench.positronSideBar.closeSecondarySideBar();

await expect(async () => {
// Validate full grid by checking bottom right corner data
await app.workbench.positronDataExplorer.clickLowerRightCorner();
const tableData = await app.workbench.positronDataExplorer.getDataExplorerTableData();
const lastRow = tableData.at(-1);
const lastHour = lastRow!['time_hour'];
expect(lastHour).toBe(LAST_CELL_CONTENTS);
}).toPass();

await expect(async () => {
// Filter data set
await app.workbench.positronDataExplorer.clickUpperLeftCorner();
await app.workbench.positronDataExplorer.addFilter(...FILTER_PARAMS as [string, string, string]);

const statusBar = await app.workbench.positronDataExplorer.getDataExplorerStatusBar();
expect(statusBar.textContent).toBe(POST_FILTER_DATA_SUMMARY);
}).toPass();

});

test('R - Verifies data explorer functionality with large data frame [C557554]', {
tag: ['@web', '@pr']
}, async function ({ app, logger, interpreter }) {
await interpreter.set('R');
await app.workbench.quickaccess.openFile(join(app.workspacePathOrFolder, 'workspaces', 'nyc-flights-data-r', 'flights-data-frame.r'));
await app.workbench.quickaccess.runCommand('r.sourceCurrentFile');

logger.log('Opening data grid');
await expect(async () => {
await app.workbench.positronVariables.doubleClickVariableRow('df2');
expect(await app.code.driver.getLocator('.label-name:has-text("Data: df2")').innerText() === 'Data: df2');
}).toPass();

await app.workbench.positronSideBar.closeSecondarySideBar();

await expect(async () => {
// Validate full grid by checking bottom right corner data
await app.workbench.positronDataExplorer.clickLowerRightCorner();
const tableData = await app.workbench.positronDataExplorer.getDataExplorerTableData();
const lastRow = tableData.at(-1);
const lastHour = lastRow!['time_hour'];
expect(lastHour).toBe(LAST_CELL_CONTENTS);
}).toPass();

await expect(async () => {
// Filter data set
await app.workbench.positronDataExplorer.clickUpperLeftCorner();
await app.workbench.positronDataExplorer.addFilter(...FILTER_PARAMS as [string, string, string]);
const statusBar = await app.workbench.positronDataExplorer.getDataExplorerStatusBar();
expect(statusBar.textContent).toBe(POST_FILTER_DATA_SUMMARY);
}).toPass();

});
});
1 change: 1 addition & 0 deletions test/smoke/src/e2e/notebook/notebook-variables.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright (C) 2024 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/

import { test, expect } from '../_test.setup';

test.use({
Expand Down
55 changes: 55 additions & 0 deletions test/smoke/src/e2e/variables/variables-pane.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*---------------------------------------------------------------------------------------------
* Copyright (C) 2024 Posit Software, PBC. All rights reserved.
* Licensed under the Elastic License 2.0. See LICENSE.txt for license information.
*--------------------------------------------------------------------------------------------*/

import { test, expect } from '../_test.setup';

test.use({
suiteId: __filename
});

test.describe('Variables Pane #web #win', { tag: ['@web', '@win', '@pr'] }, () => {
test.beforeEach(async function ({ app }) {
await app.workbench.positronLayouts.enterLayout('stacked');
});

test('Python - Verifies Variables pane basic function with python interpreter [C628634]', async function ({ app, logger, python }) {
const executeCode = async (code: string) => {
await app.workbench.positronConsole.executeCode('Python', code, '>>>');
};

await executeCode('x=1');
await executeCode('y=10');
await executeCode('z=100');

logger.log('Entered lines in console defining variables');
await app.workbench.positronConsole.logConsoleContents();
await app.workbench.positronLayouts.enterLayout('fullSizedAuxBar');
const variablesMap = await app.workbench.positronVariables.getFlatVariables();

expect(variablesMap.get('x')).toStrictEqual({ value: '1', type: 'int' });
expect(variablesMap.get('y')).toStrictEqual({ value: '10', type: 'int' });
expect(variablesMap.get('z')).toStrictEqual({ value: '100', type: 'int' });

});

test('R - Verifies Variables pane basic function with R interpreter [C628635]', async function ({ app, logger, r }) {
const executeCode = async (code: string) => {
await app.workbench.positronConsole.executeCode('R', code, '>');
};

await executeCode('x=1');
await executeCode('y=10');
await executeCode('z=100');

logger.log('Entered lines in console defining variables');
await app.workbench.positronConsole.logConsoleContents();
await app.workbench.positronLayouts.enterLayout('fullSizedAuxBar');
const variablesMap = await app.workbench.positronVariables.getFlatVariables();

expect(variablesMap.get('x')).toStrictEqual({ value: '1', type: 'dbl' });
expect(variablesMap.get('y')).toStrictEqual({ value: '10', type: 'dbl' });
expect(variablesMap.get('z')).toStrictEqual({ value: '100', type: 'dbl' });
});
});

0 comments on commit a40ab9e

Please sign in to comment.