Notebooks: add behavior checks to untrusted notebook smoke test (#13885)

* check untrusted notebook behavior

* remove skips

* check for elements after trusted nb is reopened

* move trusted element checks to notebook method

* make selector more specific
This commit is contained in:
Lucy Zhang
2021-01-06 07:16:35 -08:00
committed by GitHub
parent 16943c68c6
commit fae0600a46
2 changed files with 22 additions and 0 deletions

View File

@@ -133,6 +133,22 @@ export class Notebook {
}); });
await this.waitForResultsGone(cellIds); await this.waitForResultsGone(cellIds);
} }
async waitForTrustedElements(): Promise<void> {
const cellSelector = '.notebookEditor .notebook-cell';
await this.code.waitForElement(`${cellSelector} iframe`);
await this.code.waitForElement(`${cellSelector} dialog`);
await this.code.waitForElement(`${cellSelector} embed`);
await this.code.waitForElement(`${cellSelector} svg`);
}
async waitForTrustedElementsGone(): Promise<void> {
const cellSelector = '.notebookEditor .notebook-cell';
await this.code.waitForElementGone(`${cellSelector} iframe`);
await this.code.waitForElementGone(`${cellSelector} dialog`);
await this.code.waitForElementGone(`${cellSelector} embed`);
await this.code.waitForElementGone(`${cellSelector} svg`);
}
} }
export class NotebookToolbar { export class NotebookToolbar {

View File

@@ -46,13 +46,19 @@ export function setup() {
await app.workbench.sqlNotebook.openFile('untrusted.ipynb'); await app.workbench.sqlNotebook.openFile('untrusted.ipynb');
await app.workbench.sqlNotebook.waitForKernel('SQL'); await app.workbench.sqlNotebook.waitForKernel('SQL');
await app.workbench.sqlNotebook.waitForNotTrustedIcon(); await app.workbench.sqlNotebook.waitForNotTrustedIcon();
await app.workbench.sqlNotebook.waitForTrustedElementsGone();
await app.workbench.sqlNotebook.trustNotebook(); await app.workbench.sqlNotebook.trustNotebook();
await app.workbench.sqlNotebook.waitForTrustedIcon(); await app.workbench.sqlNotebook.waitForTrustedIcon();
await app.workbench.sqlNotebook.waitForTrustedElements();
await app.workbench.quickaccess.runCommand('workbench.action.files.save'); await app.workbench.quickaccess.runCommand('workbench.action.files.save');
await app.workbench.quickaccess.runCommand('workbench.action.closeActiveEditor'); await app.workbench.quickaccess.runCommand('workbench.action.closeActiveEditor');
await app.workbench.sqlNotebook.openFile('untrusted.ipynb'); await app.workbench.sqlNotebook.openFile('untrusted.ipynb');
await app.workbench.sqlNotebook.waitForTrustedIcon(); await app.workbench.sqlNotebook.waitForTrustedIcon();
await app.workbench.sqlNotebook.waitForTrustedElements();
await app.workbench.quickaccess.runCommand('workbench.action.closeActiveEditor'); await app.workbench.quickaccess.runCommand('workbench.action.closeActiveEditor');
}); });
}); });