You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.2 KiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

import { test, expect } from '@playwright/test';
import { BASE_URL } from './utils';
test.describe('Smoke', () => {
test('Tour', async ({ page }) => {
// Open the tree page
await page.goto(`${BASE_URL}retro/tree`);
await page.click('text="Running"');
await page.click('text="Files"');
// Create a new console
await page.click('text="New Console"');
// Choose the kernel
await page.click('text="Select"');
const console = await page.waitForEvent('popup');
await console.waitForSelector('.jp-CodeConsole');
// Create a new notebook
const [notebook] = await Promise.all([
page.waitForEvent('popup'),
page.click('text="New Notebook"')
]);
// Choose the kernel
await notebook.click('text="Select"');
await notebook.click('pre[role="presentation"]');
// Enter code in the first cell
await notebook.fill('//textarea', 'import math');
await notebook.press('//textarea', 'Enter');
await notebook.press('//textarea', 'Enter');
await notebook.fill('//textarea', 'math.pi');
// Run the cell
await notebook.click(
"//button[normalize-space(@title)='Run the selected cells and advance']"
);
// Enter code in the next cell
await notebook.fill(
"//div[normalize-space(.)=' ']/div[1]/textarea",
'import this'
);
// Run the cell
await notebook.click(
'//button[normalize-space(@title)=\'Run the selected cells and advance\']/span/span/*[local-name()="svg"]'
);
// Save the notebook
// TODO: re-enable after fixing the name on save dialog?
// await notebook.click('//span/*[local-name()="svg"]');
// Click on the Jupyter logo to open the tree page
const [tree2] = await Promise.all([
notebook.waitForEvent('popup'),
notebook.click(
'//*[local-name()="svg" and normalize-space(.)=\'Jupyter\']'
)
]);
// Shut down the kernels
await tree2.click('text="Running"');
await tree2.click('text="Shut Down All"');
await tree2.click("//div[normalize-space(.)='Shut Down All']");
// Close the pages
await tree2.close();
await notebook.close();
await console.close();
await page.close();
expect(true).toBe(true);
});
});