From 52782cfebdb64e22a039537c25c4938d6991104b Mon Sep 17 00:00:00 2001 From: Cory Rivera Date: Wed, 4 May 2022 20:52:22 -0700 Subject: [PATCH] Add smoke test for saving a WYSIWYG cell. (#19284) --- .../src/sql/areas/notebook/notebook.test.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/smoke/src/sql/areas/notebook/notebook.test.ts b/test/smoke/src/sql/areas/notebook/notebook.test.ts index 442228e3b7..808cf4ea47 100644 --- a/test/smoke/src/sql/areas/notebook/notebook.test.ts +++ b/test/smoke/src/sql/areas/notebook/notebook.test.ts @@ -435,6 +435,27 @@ export function setup(opts: minimist.ParsedArgs) { await app.workbench.sqlNotebook.textCellToolbar.changeTextCellView('Markdown View'); await app.workbench.sqlNotebook.waitForActiveCellEditorContents(s => s.includes('- **_Markdown Test_**')); }); + + it('can save and reopen WYSIWYG notebook', async function () { + const app = this.app as Application; + const filename = 'emptyNotebook.ipynb'; + await app.workbench.sqlNotebook.openFile(filename); + + // Add some text to a WYSIWYG cell and add some basic styling + await app.workbench.sqlNotebook.addCell('markdown'); + await app.workbench.sqlNotebook.textCellToolbar.changeTextCellView('Markdown View'); + let text = 'WYSIWYG Test'; + await app.workbench.sqlNotebook.waitForTypeInEditor(text); + await app.workbench.sqlNotebook.textCellToolbar.changeTextCellView('Rich Text View'); + await app.workbench.sqlNotebook.selectAllTextInRichTextEditor(); + await app.workbench.sqlNotebook.textCellToolbar.boldSelectedText(); + + // Save file, close it, and then reopen to verify WYSIWYG cell contents are the same + await app.workbench.quickaccess.runCommand('workbench.action.files.save'); + await app.workbench.quickaccess.runCommand('workbench.action.closeActiveEditor'); + await app.workbench.sqlNotebook.openFile(filename); + await app.workbench.sqlNotebook.waitForTextCellPreviewContent(text, 'p strong'); + }); }); describe('Cell Actions', function () {