mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
Add markdown smoke tests for changing text size and inserting links (#18888)
* Temporarily disabled text size tests due to issues running on Unix.
This commit is contained in:
@@ -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<void> {
|
||||
throw new Error('Method not implemented.');
|
||||
public async insertLink(linkLabel: string, linkAddress: string): Promise<void> {
|
||||
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<void> {
|
||||
@@ -245,9 +253,13 @@ export class TextCellToolbar {
|
||||
await this.clickToolbarButton('Insert ordered list');
|
||||
}
|
||||
|
||||
public async changeSelectedTextSize(): Promise<void> {
|
||||
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<void> {
|
||||
// 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}"]`;
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user