This repository has been archived by the owner on Feb 16, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #289 from jtpio/tree-menu
Improve menus
- Loading branch information
Showing
28 changed files
with
251 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"title": "RetroLab Menu Entries", | ||
"description": "RetroLab Menu Entries", | ||
"jupyter.lab.menus": { | ||
"main": [ | ||
{ | ||
"id": "jp-mainmenu-file", | ||
"items": [ | ||
{ | ||
"command": "application:rename", | ||
"rank": 4 | ||
}, | ||
{ | ||
"command": "notebook:trust", | ||
"rank": 20 | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"properties": {}, | ||
"additionalProperties": false, | ||
"type": "object" | ||
} |
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,70 @@ | ||
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
|
||
import path from 'path'; | ||
|
||
import { test } from './fixtures'; | ||
|
||
import { expect } from '@playwright/test'; | ||
|
||
const FILE = 'environment.yml'; | ||
|
||
test.use({ autoGoto: false }); | ||
|
||
const processRenameDialog = async (page, prevName: string, newName: string) => { | ||
// Rename in the input dialog | ||
await page.fill( | ||
`//div[normalize-space(.)='File Path${prevName}New Name']/input`, | ||
newName | ||
); | ||
|
||
await Promise.all([ | ||
await page.click('text="Rename"'), | ||
// wait until the URL is updated | ||
await page.waitForNavigation() | ||
]); | ||
}; | ||
|
||
test.describe('Editor', () => { | ||
test.beforeEach(async ({ page, tmpPath }) => { | ||
await page.contents.uploadFile( | ||
path.resolve(__dirname, `../../binder/${FILE}`), | ||
`${tmpPath}/${FILE}` | ||
); | ||
}); | ||
|
||
test('Renaming the file by clicking on the title', async ({ | ||
page, | ||
tmpPath | ||
}) => { | ||
const file = `${tmpPath}/${FILE}`; | ||
await page.goto(`edit/${file}`); | ||
|
||
// Click on the title | ||
await page.click(`text="${FILE}"`); | ||
|
||
const newName = 'test.yml'; | ||
await processRenameDialog(page, file, newName); | ||
|
||
// Check the URL contains the new name | ||
const url = page.url(); | ||
expect(url).toContain(newName); | ||
}); | ||
|
||
test('Renaming the file via the menu entry', async ({ page, tmpPath }) => { | ||
const file = `${tmpPath}/${FILE}`; | ||
await page.goto(`edit/${file}`); | ||
|
||
// Click on the title | ||
await page.menu.clickMenuItem('File>Rename…'); | ||
|
||
// Rename in the input dialog | ||
const newName = 'test.yml'; | ||
|
||
await processRenameDialog(page, file, newName); | ||
|
||
// Check the URL contains the new name | ||
const url = page.url(); | ||
expect(url).toContain(newName); | ||
}); | ||
}); |
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,45 @@ | ||
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
|
||
import path from 'path'; | ||
|
||
import { test } from './fixtures'; | ||
|
||
import { expect } from '@playwright/test'; | ||
|
||
const NOTEBOOK = 'empty.ipynb'; | ||
|
||
const MENU_PATHS = [ | ||
'File', | ||
'File>New', | ||
'Edit', | ||
'View', | ||
'Run', | ||
'Kernel', | ||
'Settings', | ||
'Settings>Theme', | ||
'Help' | ||
]; | ||
|
||
test.use({ autoGoto: false }); | ||
|
||
test.describe('Notebook Menus', () => { | ||
test.beforeEach(async ({ page, tmpPath }) => { | ||
await page.contents.uploadFile( | ||
path.resolve(__dirname, `./notebooks/${NOTEBOOK}`), | ||
`${tmpPath}/${NOTEBOOK}` | ||
); | ||
}); | ||
|
||
MENU_PATHS.forEach(menuPath => { | ||
test(`Open menu item ${menuPath}`, async ({ page, tmpPath }) => { | ||
await page.goto(`notebooks/${tmpPath}/${NOTEBOOK}`); | ||
await page.menu.open(menuPath); | ||
expect(await page.menu.isOpen(menuPath)).toBeTruthy(); | ||
|
||
const imageName = `opened-menu-${menuPath.replace(/>/g, '-')}.png`; | ||
const menu = await page.menu.getOpenMenu(); | ||
expect(await menu.screenshot()).toMatchSnapshot(imageName.toLowerCase()); | ||
}); | ||
}); | ||
}); |
Binary file added
BIN
+31.5 KB
ui-tests/test/menus.spec.ts-snapshots/opened-menu-edit-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+25.7 KB
ui-tests/test/menus.spec.ts-snapshots/opened-menu-edit-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+27.7 KB
ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+23.6 KB
ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.62 KB
ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-new-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.66 KB
ui-tests/test/menus.spec.ts-snapshots/opened-menu-file-new-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11 KB
ui-tests/test/menus.spec.ts-snapshots/opened-menu-help-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.66 KB
ui-tests/test/menus.spec.ts-snapshots/opened-menu-help-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+19.8 KB
ui-tests/test/menus.spec.ts-snapshots/opened-menu-kernel-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+17 KB
ui-tests/test/menus.spec.ts-snapshots/opened-menu-kernel-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+25.1 KB
ui-tests/test/menus.spec.ts-snapshots/opened-menu-run-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+21.2 KB
ui-tests/test/menus.spec.ts-snapshots/opened-menu-run-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+21.5 KB
ui-tests/test/menus.spec.ts-snapshots/opened-menu-settings-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+18.7 KB
ui-tests/test/menus.spec.ts-snapshots/opened-menu-settings-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+16.2 KB
...ests/test/menus.spec.ts-snapshots/opened-menu-settings-theme-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.8 KB
ui-tests/test/menus.spec.ts-snapshots/opened-menu-settings-theme-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+36.4 KB
ui-tests/test/menus.spec.ts-snapshots/opened-menu-view-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+31.3 KB
ui-tests/test/menus.spec.ts-snapshots/opened-menu-view-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,33 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "6f7028b9-4d2c-4fa2-96ee-bfa77bbee434", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.7" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Binary file modified
BIN
-966 Bytes
(97%)
ui-tests/test/settings.spec.ts-snapshots/top-hidden-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-995 Bytes
(96%)
ui-tests/test/settings.spec.ts-snapshots/top-hidden-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-883 Bytes
(97%)
ui-tests/test/settings.spec.ts-snapshots/top-visible-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-999 Bytes
(96%)
ui-tests/test/settings.spec.ts-snapshots/top-visible-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.