Add smoke tests for text cell toolbar actions. (#18792)

This commit is contained in:
Cory Rivera
2022-03-22 12:51:56 -07:00
committed by GitHub
parent 783215c160
commit 1fa453f8f2
2 changed files with 79 additions and 13 deletions

View File

@@ -31,7 +31,7 @@ export function setup(opts: minimist.ParsedArgs) {
await app.workbench.sqlNotebook.selectAllTextInEditor();
await app.workbench.sqlNotebook.textCellToolbar.boldSelectedText();
await app.code.dispatchKeybinding('escape');
await app.workbench.sqlNotebook.waitForTextCellPreviewContent(sampleText, 'p', 'strong');
await app.workbench.sqlNotebook.waitForTextCellPreviewContent(sampleText, 'p strong');
});
it('can perform basic code cell functionality', async function () {
@@ -145,6 +145,74 @@ export function setup(opts: minimist.ParsedArgs) {
});
});
describe('Cell Toolbar Actions', function () {
const sampleText: string = 'Test Text';
async function createCellAndSelectAllText(app: Application): Promise<void> {
await app.workbench.sqlNotebook.newUntitledNotebook();
await app.workbench.sqlNotebook.addCellFromPlaceholder('Markdown');
await app.workbench.sqlNotebook.waitForPlaceholderGone();
await app.workbench.sqlNotebook.textCellToolbar.changeTextCellView('Split View');
await app.workbench.sqlNotebook.waitForTypeInEditor(sampleText);
await app.workbench.sqlNotebook.selectAllTextInEditor();
}
it('can bold selected text', async function () {
const app = this.app as Application;
await createCellAndSelectAllText(app);
await app.workbench.sqlNotebook.textCellToolbar.boldSelectedText();
await app.code.dispatchKeybinding('escape');
await app.workbench.sqlNotebook.waitForTextCellPreviewContent(sampleText, 'p strong');
});
it('can italicize selected text', async function () {
const app = this.app as Application;
await createCellAndSelectAllText(app);
await app.workbench.sqlNotebook.textCellToolbar.italicizeSelectedText();
await app.code.dispatchKeybinding('escape');
await app.workbench.sqlNotebook.waitForTextCellPreviewContent(sampleText, 'p em');
});
it('can underline selected text', async function () {
const app = this.app as Application;
await createCellAndSelectAllText(app);
await app.workbench.sqlNotebook.textCellToolbar.underlineSelectedText();
await app.code.dispatchKeybinding('escape');
await app.workbench.sqlNotebook.waitForTextCellPreviewContent(sampleText, 'p u');
});
it('can highlight selected text', async function () {
const app = this.app as Application;
await createCellAndSelectAllText(app);
await app.workbench.sqlNotebook.textCellToolbar.highlightSelectedText();
await app.code.dispatchKeybinding('escape');
await app.workbench.sqlNotebook.waitForTextCellPreviewContent(sampleText, 'p mark');
});
it('can codify selected text', async function () {
const app = this.app as Application;
await createCellAndSelectAllText(app);
await app.workbench.sqlNotebook.textCellToolbar.codifySelectedText();
await app.code.dispatchKeybinding('escape');
await app.workbench.sqlNotebook.waitForTextCellPreviewContent(sampleText, 'pre code');
});
it('can bullet selected text', async function () {
const app = this.app as Application;
await createCellAndSelectAllText(app);
await app.workbench.sqlNotebook.textCellToolbar.insertList();
await app.code.dispatchKeybinding('escape');
await app.workbench.sqlNotebook.waitForTextCellPreviewContent(sampleText, 'ul li');
});
it('can number selected text', async function () {
const app = this.app as Application;
await createCellAndSelectAllText(app);
await app.workbench.sqlNotebook.textCellToolbar.insertOrderedList();
await app.code.dispatchKeybinding('escape');
await app.workbench.sqlNotebook.waitForTextCellPreviewContent(sampleText, 'ol li');
});
});
describe('markdown', function () {
it('can create http link from markdown', async function () {
const app = this.app as Application;