notebook/ui-tests/test/tree.spec.ts
Nicolas Brichet 905553e6dd
Resolving some accessibility issues (#6719)
* Uses different ID for the running-session widgets, the one in main view and the one in panel

* Append kernel logo image only if necessary

* Add title to the button which close sidebar

* Add landmarks roles

* Fix UI-test

* lint
2023-02-09 10:26:40 +01:00

50 lines
1.4 KiB
TypeScript

// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
import { test } from './fixtures';
import { expect } from '@playwright/test';
const SUBFOLDER = 'subfolder';
test('Tree', async ({ page }) => {
await page.goto('tree');
const button = await page.$('text="New Notebook"');
expect(button).toBeDefined();
});
test('should go to subfolder', async ({ page, tmpPath }) => {
const dir = `${tmpPath}/${SUBFOLDER}`;
await page.contents.createDirectory(dir);
await page.goto(`tree/${dir}`);
expect(
await page.waitForSelector(`.jp-FileBrowser-crumbs >> text=/${SUBFOLDER}/`)
).toBeTruthy();
});
test('should update url when navigating in filebrowser', async ({
page,
tmpPath
}) => {
await page.contents.createDirectory(`${tmpPath}/${SUBFOLDER}`);
await page.dblclick(`.jp-FileBrowser-listing >> text=${SUBFOLDER}`);
await page.waitForSelector(`.jp-FileBrowser-crumbs >> text=/${SUBFOLDER}/`);
const url = new URL(page.url());
expect(url.pathname).toEqual(`/tree/${tmpPath}/${SUBFOLDER}`);
});
test('Should activate file browser tab', async ({ page, tmpPath }) => {
await page.goto(`tree/${tmpPath}`);
await page.click('text="Running"');
await expect(
page.locator('#main-panel #jp-running-sessions-tree')
).toBeVisible();
await page.menu.clickMenuItem('View>File Browser');
await expect(page.locator('#main-panel #filebrowser')).toBeVisible();
});