Fix notebooks and notebook smoketest in web

This commit is contained in:
Rob Lourens 2020-05-21 08:56:22 -05:00
parent fbb367917c
commit b877c4d411
3 changed files with 6 additions and 5 deletions

View file

@ -454,8 +454,9 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
DOM.toggleClass(this.getDomNode(), 'notebook-editor-editable', !!this.viewModel!.metadata?.editable);
}
private createWebview(id: string, document: URI) {
private async createWebview(id: string, document: URI): Promise<void> {
this.webview = this.instantiationService.createInstance(BackLayerWebView, this, id, document);
await this.webview.waitForInitialization();
this.webview.webview.onDidBlur(() => this.updateEditorFocus());
this.webview.webview.onDidFocus(() => this.updateEditorFocus());
this.localStore.add(this.webview.onMessage(message => {
@ -467,8 +468,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
}
private async attachModel(textModel: NotebookTextModel, viewState: INotebookEditorViewState | undefined) {
this.createWebview(this.getId(), textModel.uri);
await this.webview!.waitForInitialization();
await this.createWebview(this.getId(), textModel.uri);
this.eventDispatcher = new NotebookEventDispatcher();
this.viewModel = this.instantiationService.createInstance(NotebookViewModel, textModel.viewType, textModel, this.eventDispatcher, this.getLayoutInfo());

View file

@ -79,7 +79,7 @@ export class Notebook {
async focusInCellOutput(): Promise<void> {
await this.quickAccess.runCommand('notebook.cell.focusInOutput');
await this.code.waitForActiveElement('webview');
await this.code.waitForActiveElement('webview, .webview');
}
async focusOutCellOutput(): Promise<void> {

View file

@ -25,7 +25,8 @@ const vscodeToPlaywrightKey: { [key: string]: string } = {
up: 'ArrowUp',
down: 'ArrowDown',
left: 'ArrowLeft',
home: 'Home'
home: 'Home',
esc: 'Escape'
};
function buildDriver(browser: playwright.Browser, page: playwright.Page): IDriver {