mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 17:23:02 -05:00
Keyboard navigation smoke test (#18796)
This commit is contained in:
@@ -3,11 +3,10 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Application } from '../../../../../automation';
|
||||
import { Application, ctrlOrCmd } from '../../../../../automation';
|
||||
import * as minimist from 'minimist';
|
||||
import { afterSuite, beforeSuite } from '../../../utils';
|
||||
import * as assert from 'assert';
|
||||
|
||||
export function setup(opts: minimist.ParsedArgs) {
|
||||
describe('Notebook', () => {
|
||||
beforeSuite(opts);
|
||||
@@ -59,6 +58,7 @@ export function setup(opts: minimist.ParsedArgs) {
|
||||
await app.workbench.sqlNotebook.waitForColorization('6', 'mtk1'); // employees
|
||||
});
|
||||
|
||||
|
||||
// Python Notebooks
|
||||
|
||||
it('can open new notebook, configure Python, and execute one cell', async function () {
|
||||
@@ -132,6 +132,50 @@ export function setup(opts: minimist.ParsedArgs) {
|
||||
await app.code.dispatchKeybinding('escape');
|
||||
});
|
||||
|
||||
describe('Notebook keyboard navigation', async () => {
|
||||
it('can enter and exit edit mode and navigate using keyboard nav', async function () {
|
||||
const app = this.app as Application;
|
||||
await app.workbench.sqlNotebook.newUntitledNotebook();
|
||||
await app.workbench.sqlNotebook.addCellFromPlaceholder('Code'); // add new code cell
|
||||
await app.workbench.sqlNotebook.waitForPlaceholderGone();
|
||||
const activeCodeCellId = (await app.workbench.sqlNotebook.getActiveCell()).attributes['id'];
|
||||
await app.workbench.sqlNotebook.waitForTypeInEditor('code cell', activeCodeCellId); // the new cell should be in edit mode
|
||||
await app.workbench.sqlNotebook.exitActiveCell();
|
||||
await app.workbench.sqlNotebook.waitForActiveCellGone();
|
||||
|
||||
await app.workbench.sqlNotebook.addCell('markdown'); // add markdown cell
|
||||
await app.workbench.sqlNotebook.textCellToolbar.changeTextCellView('Split View');
|
||||
const activeTextCellId = (await app.workbench.sqlNotebook.getActiveCell()).attributes['id'];
|
||||
await app.workbench.sqlNotebook.waitForTypeInEditor('text cell', activeTextCellId); // Text cell should be in edit mode
|
||||
|
||||
await app.code.dispatchKeybinding('escape'); // exit edit mode and stay in browse mode
|
||||
await app.code.dispatchKeybinding('up'); // select code cell
|
||||
await app.workbench.sqlNotebook.getActiveCell(activeCodeCellId); // check that the code cell is now active
|
||||
await app.code.dispatchKeybinding('enter');
|
||||
await app.workbench.sqlNotebook.waitForTypeInEditor('test', activeCodeCellId); // code cell should be in edit mode after hitting enter
|
||||
await app.code.dispatchKeybinding('escape'); // exit edit mode and stay in browse mode
|
||||
await app.code.dispatchKeybinding('down'); // select text cell
|
||||
await app.code.dispatchKeybinding('enter');
|
||||
await app.workbench.sqlNotebook.textCellToolbar.changeTextCellView('Split View');
|
||||
await app.workbench.sqlNotebook.waitForTypeInEditor('test', activeTextCellId); // text cell should be in edit mode after hitting enter
|
||||
});
|
||||
|
||||
it('cannot move through cells when find widget is invoked', async function () {
|
||||
const app = this.app as Application;
|
||||
await app.workbench.sqlNotebook.newUntitledNotebook();
|
||||
await app.workbench.sqlNotebook.addCell('markdown');
|
||||
await app.workbench.sqlNotebook.exitActiveCell();
|
||||
await app.workbench.sqlNotebook.addCell('markdown');
|
||||
await app.workbench.sqlNotebook.exitActiveCell();
|
||||
await app.workbench.sqlNotebook.addCell('markdown');
|
||||
await app.code.dispatchKeybinding('escape');
|
||||
const activeCellId = (await app.workbench.sqlNotebook.getActiveCell()).attributes['id'];
|
||||
await app.workbench.sqlNotebook.notebookFind.openFindWidget();
|
||||
await app.code.dispatchKeybinding('down');
|
||||
await app.workbench.sqlNotebook.getActiveCell(activeCellId); // verify that the active cell is the same
|
||||
});
|
||||
});
|
||||
|
||||
describe('Notebook Toolbar Actions', async () => {
|
||||
|
||||
it('Collapse and Expand Cell', async function () {
|
||||
@@ -333,27 +377,27 @@ export function setup(opts: minimist.ParsedArgs) {
|
||||
|
||||
it('can bold text with keyboard shortcut', async function () {
|
||||
const app = this.app as Application;
|
||||
await verifyToolbarKeyboardShortcut(app, app.workbench.sqlNotebook.ctrlOrCmd + '+b', 'p strong');
|
||||
await verifyToolbarKeyboardShortcut(app, `${ctrlOrCmd}+b`, 'p strong');
|
||||
});
|
||||
|
||||
it('can italicize text with keyboard shortcut', async function () {
|
||||
const app = this.app as Application;
|
||||
await verifyToolbarKeyboardShortcut(app, app.workbench.sqlNotebook.ctrlOrCmd + '+i', 'p em');
|
||||
await verifyToolbarKeyboardShortcut(app, `${ctrlOrCmd}+i`, 'p em');
|
||||
});
|
||||
|
||||
it('can underline text with keyboard shortcut', async function () {
|
||||
const app = this.app as Application;
|
||||
await verifyToolbarKeyboardShortcut(app, app.workbench.sqlNotebook.ctrlOrCmd + '+u', 'p u');
|
||||
await verifyToolbarKeyboardShortcut(app, `${ctrlOrCmd}+u`, 'p u');
|
||||
});
|
||||
|
||||
it('can highlight text with keyboard shortcut', async function () {
|
||||
const app = this.app as Application;
|
||||
await verifyToolbarKeyboardShortcut(app, app.workbench.sqlNotebook.ctrlOrCmd + '+shift+h', 'p mark');
|
||||
await verifyToolbarKeyboardShortcut(app, `${ctrlOrCmd}+shift+h`, 'p mark');
|
||||
});
|
||||
|
||||
it('can codify text with keyboard shortcut', async function () {
|
||||
const app = this.app as Application;
|
||||
await verifyToolbarKeyboardShortcut(app, app.workbench.sqlNotebook.ctrlOrCmd + '+shift+k', 'pre code');
|
||||
await verifyToolbarKeyboardShortcut(app, `${ctrlOrCmd}+shift+k`, 'pre code');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user