mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-03 03:41:14 +08:00
Set base url
This commit is contained in:
parent
e1c3197566
commit
59728fbbd9
@ -3,10 +3,10 @@
|
||||
|
||||
import { chromium, firefox, Browser } from 'playwright';
|
||||
|
||||
import { BrowserName } from './utils';
|
||||
import { BrowserName, BASE_URL } from './utils';
|
||||
|
||||
const JUPYTERLAB_CLASSIC =
|
||||
'http://localhost:8889/classic/notebooks/app/test/data/example.ipynb';
|
||||
const NOTEBOOK_PATH = 'app/test/data/example.ipynb';
|
||||
const NOTEBOOK_URL = `${BASE_URL}classic/notebooks/${NOTEBOOK_PATH}`;
|
||||
|
||||
describe('Notebook', () => {
|
||||
let browser: Browser;
|
||||
@ -23,7 +23,7 @@ describe('Notebook', () => {
|
||||
describe('Title', () => {
|
||||
it('should be rendered', async () => {
|
||||
const page = await browser.newPage();
|
||||
await page.goto(JUPYTERLAB_CLASSIC);
|
||||
await page.goto(NOTEBOOK_URL);
|
||||
await page.waitForTimeout(2000);
|
||||
const href = await page.evaluate(() => {
|
||||
return document.querySelector('#jp-ClassicLogo')?.getAttribute('href');
|
||||
@ -35,23 +35,23 @@ describe('Notebook', () => {
|
||||
describe('Renaming', () => {
|
||||
it('should be possible to rename the notebook', async () => {
|
||||
const page = await browser.newPage();
|
||||
await page.goto(JUPYTERLAB_CLASSIC);
|
||||
await page.goto(NOTEBOOK_URL);
|
||||
|
||||
// Click text="Untitled.ipynb"
|
||||
// Click on the title
|
||||
await page.click('text="example.ipynb"');
|
||||
|
||||
// Rename in the input dialog
|
||||
const newName = 'test.ipynb';
|
||||
await page.fill(
|
||||
"//div[normalize-space(.)='File Pathapp/test/data/example.ipynbNew Name']/input",
|
||||
`//div[normalize-space(.)='File Path${NOTEBOOK_PATH}New Name']/input`,
|
||||
newName
|
||||
);
|
||||
|
||||
// Click text="Rename"
|
||||
await Promise.all([
|
||||
page.waitForNavigation(/*{ url: 'http://localhost:8889/classic/notebooks/test.ipynb' }*/),
|
||||
page.waitForNavigation(),
|
||||
page.click('text="Rename"')
|
||||
]);
|
||||
|
||||
// Check the URL contains the new name
|
||||
const url = page.url();
|
||||
expect(url).toContain(newName);
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { chromium, firefox, Browser, BrowserContext } from 'playwright';
|
||||
|
||||
import { BrowserName } from './utils';
|
||||
import { BrowserName, BASE_URL } from './utils';
|
||||
|
||||
describe('Smoke', () => {
|
||||
let browser: Browser;
|
||||
@ -25,7 +25,7 @@ describe('Smoke', () => {
|
||||
const tree = await context.newPage();
|
||||
|
||||
// Open the tree page
|
||||
await tree.goto('http://localhost:8889/classic/tree?');
|
||||
await tree.goto(`${BASE_URL}classic/tree`);
|
||||
await tree.click('text="Running"');
|
||||
await tree.click('text="Files"');
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
import { chromium, firefox, Browser } from 'playwright';
|
||||
|
||||
import { BrowserName } from './utils';
|
||||
|
||||
const JUPYTERLAB_CLASSIC = 'http://localhost:8889/classic/tree';
|
||||
import { BASE_URL, BrowserName } from './utils';
|
||||
|
||||
describe('Tree', () => {
|
||||
let browser: Browser;
|
||||
@ -20,7 +18,7 @@ describe('Tree', () => {
|
||||
describe('File Browser', () => {
|
||||
it('should render a New Notebook button', async () => {
|
||||
const page = await browser.newPage();
|
||||
await page.goto(JUPYTERLAB_CLASSIC);
|
||||
await page.goto(`${BASE_URL}classic/tree`);
|
||||
|
||||
const button = await page.$('text="New Notebook"');
|
||||
expect(button).toBeDefined();
|
||||
|
@ -1 +1,3 @@
|
||||
export type BrowserName = 'chromium' | 'firefox';
|
||||
|
||||
export const BASE_URL = 'http://localhost:8889/';
|
||||
|
Loading…
Reference in New Issue
Block a user