Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e tests: use webbrowser to check for urls in viewer #5818

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 7 additions & 18 deletions test/e2e/areas/viewer/viewer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,12 @@ test.describe('Viewer', { tag: [tags.VIEWER] }, () => {
await app.workbench.positronViewer.clearViewer();
});

test.skip('Python - Verify Viewer functionality with vetiver [C784887]', {
annotation: [{ type: 'issue', description: 'https://github.com/posit-dev/positron/issues/5569' }]
}, async function ({ app, page, logger, python }) {
test('Python - Verify Viewer functionality with webbrowser [C784887]', async function ({ app, page, logger, python }) {
logger.log('Sending code to console');
await app.workbench.positronConsole.pasteCodeToConsole(pythonScript);
await app.workbench.positronConsole.sendEnterKey();
const theDoc = app.workbench.positronViewer.getViewerLocator('#thedoc');
await theDoc.waitFor({ state: 'attached', timeout: 60000 });

// This is bad because it can end up clicking a link inside the console:
//await app.workbench.positronConsole.activeConsole.click();

await app.workbench.positronConsole.clickConsoleTab();
await page.keyboard.press('Control+C');
await app.workbench.positronConsole.waitForConsoleContents('Application shutdown complete.');
const theDoc = app.workbench.positronViewer.getViewerLocator('head');
await theDoc.waitFor({ state: 'attached' });
});

// This randomly fails only in CI
Expand Down Expand Up @@ -83,12 +74,10 @@ test.describe('Viewer', { tag: [tags.VIEWER] }, () => {

});

const pythonScript = `from vetiver import VetiverModel, VetiverAPI
from vetiver.data import mtcars
from sklearn.linear_model import LinearRegression
model = LinearRegression().fit(mtcars.drop(columns="mpg"), mtcars["mpg"])
v = VetiverModel(model, model_name = "cars_linear", prototype_data = mtcars.drop(columns="mpg"))
VetiverAPI(v).run()`;
const pythonScript = `import webbrowser
# will not have any content, but we just want to make sure
# the viewer will open when webbrowser calls are make
webbrowser.open('http://127.0.0.1:8000')`;

const pythonGreatTablesScript = `from great_tables import GT, exibble
GT(exibble)`;
Expand Down
Loading