-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic reticulate test. * Creates a python repl from R * Waits for python to be ready * Sets x = 100 * Goes back to R console * Sets R variable y equal to the python variable x * Checks value and type of y ### QA Notes All smoke tests should pass
- Loading branch information
1 parent
3a75032
commit e168eb2
Showing
1 changed file
with
83 additions
and
0 deletions.
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
test/smoke/src/areas/positron/reticulate/reticulate.test.ts
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,83 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* 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, PositronRFixtures, PositronUserSettingsFixtures, UserSetting } from '../../../../../automation'; | ||
import { setupAndStartApp } from '../../../test-runner/test-hooks'; | ||
|
||
// In order to run this test on Windows, I think we need to set the env var: | ||
// RETICULATE_PYTHON | ||
// to the installed python path | ||
describe('Reticulate #web', () => { | ||
setupAndStartApp(); | ||
let app: Application; | ||
let userSettings: PositronUserSettingsFixtures; | ||
|
||
describe('Reticulate', () => { | ||
before(async function () { | ||
app = this.app as Application; | ||
|
||
try { | ||
|
||
await PositronRFixtures.SetupFixtures(this.app as Application); | ||
|
||
userSettings = new PositronUserSettingsFixtures(app); | ||
|
||
// remove this once https://github.com/posit-dev/positron/issues/5226 | ||
// is resolved | ||
const kernelSupervisorSetting: UserSetting = ['positronKernelSupervisor.enable', 'false']; | ||
const reticulateSetting: UserSetting = ['positron.reticulate.enabled', 'true']; | ||
|
||
await userSettings.setUserSettings([ | ||
kernelSupervisorSetting, | ||
reticulateSetting | ||
] | ||
); | ||
|
||
} catch (e) { | ||
this.app.code.driver.takeScreenshot('reticulateSetup'); | ||
throw e; | ||
} | ||
}); | ||
|
||
after(async function () { | ||
await userSettings.unsetUserSettings(); | ||
|
||
}); | ||
|
||
it('R - Verify Basic Reticulate Functionality [C...]', async function () { | ||
|
||
await app.workbench.positronConsole.pasteCodeToConsole('reticulate::repl_python()'); | ||
await app.workbench.positronConsole.sendEnterKey(); | ||
|
||
try { | ||
await app.workbench.positronConsole.waitForConsoleContents((contents) => contents.some((line) => line.includes('Yes/no/cancel'))); | ||
await app.workbench.positronConsole.typeToConsole('no'); | ||
await app.workbench.positronConsole.sendEnterKey(); | ||
|
||
} catch { | ||
// Prompt did not appear | ||
} | ||
|
||
await app.workbench.positronConsole.waitForReady('>>>'); | ||
|
||
await app.workbench.positronConsole.pasteCodeToConsole('x=100'); | ||
await app.workbench.positronConsole.sendEnterKey(); | ||
|
||
await PositronRFixtures.SetupFixtures(this.app as Application); | ||
|
||
await app.workbench.positronConsole.pasteCodeToConsole('y<-reticulate::py$x'); | ||
await app.workbench.positronConsole.sendEnterKey(); | ||
|
||
await app.workbench.positronLayouts.enterLayout('fullSizedAuxBar'); | ||
|
||
await expect(async () => { | ||
const variablesMap = await app.workbench.positronVariables.getFlatVariables(); | ||
expect(variablesMap.get('y')).toStrictEqual({ value: '100', type: 'int' }); | ||
}).toPass({ timeout: 60000 }); | ||
|
||
}); | ||
}); | ||
}); |