-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
|
||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' }); | ||
}); | ||
}); |