forked from jupyterlab/jupyterlab
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport PR jupyterlab#14983: Fix
filebrowser.open
and add ability …
…to provide a factory
- Loading branch information
1 parent
3805b2c
commit e48c1c3
Showing
3 changed files
with
89 additions
and
9 deletions.
There are no files selected for viewing
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
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
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,48 @@ | ||
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
|
||
import { expect, test } from '@jupyterlab/galata'; | ||
|
||
const DEFAULT_NAME = 'Untitled.ipynb'; | ||
|
||
test.describe('filebrowser helper', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.menu.clickMenuItem('File>New>Notebook'); | ||
|
||
await page | ||
.locator('.jp-Dialog') | ||
.getByRole('button', { name: 'Select Kernel', exact: true }) | ||
.click(); | ||
|
||
await page.activity.closeAll(); | ||
}); | ||
|
||
test('should open a file', async ({ page }) => { | ||
await page.filebrowser.open(DEFAULT_NAME); | ||
|
||
expect(await page.activity.isTabActive(DEFAULT_NAME)).toEqual(true); | ||
}); | ||
|
||
test('should activate already opened file', async ({ page }) => { | ||
await page.menu.clickMenuItem('File>New>Console'); | ||
|
||
await page | ||
.locator('.jp-Dialog') | ||
.getByRole('button', { name: 'Select Kernel', exact: true }) | ||
.click(); | ||
|
||
expect.soft(await page.activity.isTabActive(DEFAULT_NAME)).toEqual(false); | ||
await page.filebrowser.open(DEFAULT_NAME); | ||
expect(await page.activity.isTabActive(DEFAULT_NAME)).toEqual(true); | ||
}); | ||
|
||
test('should open the file with another factory', async ({ page }) => { | ||
await page.filebrowser.open(DEFAULT_NAME); | ||
|
||
await page.filebrowser.open(DEFAULT_NAME, 'Editor'); | ||
|
||
await expect( | ||
page.getByRole('main').getByRole('tab', { name: DEFAULT_NAME }) | ||
).toHaveCount(2); | ||
}); | ||
}); |