diff --git a/src/sql/workbench/contrib/notebook/browser/cellViews/markdownToolbar.component.ts b/src/sql/workbench/contrib/notebook/browser/cellViews/markdownToolbar.component.ts index d2f1540faf..ff631a05ea 100644 --- a/src/sql/workbench/contrib/notebook/browser/cellViews/markdownToolbar.component.ts +++ b/src/sql/workbench/contrib/notebook/browser/cellViews/markdownToolbar.component.ts @@ -189,7 +189,7 @@ export class MarkdownToolbarComponent extends AngularDisposable { undefined, this._actionBar.actionRunner, undefined, - 'masked-pseudo-after dropdown-arrow', + 'masked-pseudo-after dropdown-arrow heading-dropdown', this.optionParagraph, undefined ); diff --git a/test/automation/src/sql/notebook.ts b/test/automation/src/sql/notebook.ts index ca20537b11..534a7b3bcb 100644 --- a/test/automation/src/sql/notebook.ts +++ b/test/automation/src/sql/notebook.ts @@ -9,8 +9,8 @@ import { QuickInput } from '../quickinput'; import { Editors } from '../editors'; import { IElement } from '..'; -const winOrCtrl = process.platform === 'win32' ? 'win' : 'ctrl'; -const ctrlOrCmd = process.platform === 'win32' ? 'ctrl' : 'cmd'; +const winOrCtrl = process.platform === 'darwin' ? 'ctrl' : 'win'; +const ctrlOrCmd = process.platform === 'darwin' ? 'cmd' : 'ctrl'; export class Notebook { @@ -233,8 +233,16 @@ export class TextCellToolbar { await this.clickToolbarButton('Insert code'); } - public async insertLink(): Promise { - throw new Error('Method not implemented.'); + public async insertLink(linkLabel: string, linkAddress: string): Promise { + await this.clickToolbarButton('Insert link'); + const linkDialogSelector = 'div.modal.callout-dialog[aria-label="Insert link"]'; + const displayTextSelector = `${linkDialogSelector} input[aria-label="Text to display"]`; + await this.code.waitForSetValue(displayTextSelector, linkLabel); + + const addressTextSelector = `${linkDialogSelector} input[aria-label="Address"]`; + await this.code.waitForSetValue(addressTextSelector, linkAddress); + + await this.code.dispatchKeybinding('enter'); } public async insertList(): Promise { @@ -245,9 +253,13 @@ export class TextCellToolbar { await this.clickToolbarButton('Insert ordered list'); } - public async changeSelectedTextSize(): Promise { - throw new Error('Method not implemented.'); - } + // Disabled since the text size dropdown is not clickable on Unix from smoke tests + // public async changeSelectedTextSize(textSize: 'Heading 1' | 'Heading 2' | 'Heading 3' | 'Paragraph'): Promise { + // const actionSelector = `${TextCellToolbar.textCellToolbar} .monaco-dropdown a.heading-dropdown`; + // await this.code.waitAndClick(actionSelector); + // const menuItemSelector = `.context-view.monaco-menu-container .monaco-menu .action-menu-item[title="${textSize}"]`; + // await this.code.waitAndClick(menuItemSelector); + // } private async clickToolbarButton(buttonTitle: string) { const actionSelector = `${TextCellToolbar.textCellToolbar} a[title="${buttonTitle}"]`; diff --git a/test/smoke/src/sql/areas/notebook/notebook.test.ts b/test/smoke/src/sql/areas/notebook/notebook.test.ts index 9130fa57e4..a045ba051c 100644 --- a/test/smoke/src/sql/areas/notebook/notebook.test.ts +++ b/test/smoke/src/sql/areas/notebook/notebook.test.ts @@ -211,6 +211,54 @@ export function setup(opts: minimist.ParsedArgs) { await app.code.dispatchKeybinding('escape'); await app.workbench.sqlNotebook.waitForTextCellPreviewContent(sampleText, 'ol li'); }); + + // Text size tests are disabled because the text size dropdown + // is not clickable on Unix from the smoke tests + // it('can change text size to Heading 1', async function () { + // const app = this.app as Application; + // await createCellAndSelectAllText(app); + // await app.workbench.sqlNotebook.textCellToolbar.changeSelectedTextSize('Heading 1'); + // await app.code.dispatchKeybinding('escape'); + // await app.workbench.sqlNotebook.waitForTextCellPreviewContent(sampleText, 'h1'); + // }); + + // it('can change text size to Heading 2', async function () { + // const app = this.app as Application; + // await createCellAndSelectAllText(app); + // await app.workbench.sqlNotebook.textCellToolbar.changeSelectedTextSize('Heading 2'); + // await app.code.dispatchKeybinding('escape'); + // await app.workbench.sqlNotebook.waitForTextCellPreviewContent(sampleText, 'h2'); + // }); + + // it('can change text size to Heading 3', async function () { + // const app = this.app as Application; + // await createCellAndSelectAllText(app); + // await app.workbench.sqlNotebook.textCellToolbar.changeSelectedTextSize('Heading 3'); + // await app.code.dispatchKeybinding('escape'); + // await app.workbench.sqlNotebook.waitForTextCellPreviewContent(sampleText, 'h3'); + // }); + + // it('can change text size to Paragraph', async function () { + // const app = this.app as Application; + // await createCellAndSelectAllText(app); + // await app.workbench.sqlNotebook.textCellToolbar.changeSelectedTextSize('Paragraph'); + // await app.code.dispatchKeybinding('escape'); + // await app.workbench.sqlNotebook.waitForTextCellPreviewContent(sampleText, 'p'); + // }); + + it('can insert link', async function () { + const app = this.app as Application; + await app.workbench.sqlNotebook.newUntitledNotebook(); + await app.workbench.sqlNotebook.addCellFromPlaceholder('Markdown'); + await app.workbench.sqlNotebook.waitForPlaceholderGone(); + await app.workbench.sqlNotebook.textCellToolbar.changeTextCellView('Split View'); + + const sampleLabel = 'Microsoft'; + const sampleAddress = 'https://www.microsoft.com'; + await app.workbench.sqlNotebook.textCellToolbar.insertLink(sampleLabel, sampleAddress); + await app.code.dispatchKeybinding('escape'); + await app.workbench.sqlNotebook.waitForTextCellPreviewContent(sampleLabel, `p a[href="${sampleAddress}"]`); + }); }); describe('markdown', function () {