Add Remote Book dialog smoke test (#15932)

* Add Remote Book smoke test

* fixes

* distro

* Try closing toasts

(cherry picked from commit fd53c91375f4ba73554c801be3378375b2521d31)
This commit is contained in:
Charles Gagnon
2021-06-30 10:51:56 -07:00
committed by GitHub
parent 6e814d9ff0
commit 66c1fdc457
6 changed files with 117 additions and 1 deletions

View File

@@ -0,0 +1,34 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Application } from '../../../../../automation';
import { promises as fs } from 'fs';
import * as path from 'path';
import { assert } from 'console';
const AddRemoteBookCommand = 'Jupyter Books: Add Remote Jupyter Book';
const JUPYTER_BOOK = 'CU';
const VERSION = '1.0';
const LANGUAGE = 'EN';
export function setup() {
describe('AddRemoteBookDialog', () => {
it('can open remote book', async function () {
const app = this.app as Application;
await app.workbench.quickaccess.runCommand(AddRemoteBookCommand);
await app.workbench.addRemoteBookDialog.setLocation('GitHub');
await app.workbench.addRemoteBookDialog.setRepoUrl('repos/microsoft/tigertoolbox');
await app.workbench.addRemoteBookDialog.search();
await app.workbench.addRemoteBookDialog.setRelease('SQL Server Big Data Clusters Operational Guide');
await app.workbench.addRemoteBookDialog.setJupyterBook(JUPYTER_BOOK);
await app.workbench.addRemoteBookDialog.setVersion(VERSION);
await app.workbench.addRemoteBookDialog.setLanguage(LANGUAGE);
await app.workbench.addRemoteBookDialog.add();
const bookExists = await fs.stat(path.join(app.workspacePathOrFolder, `${JUPYTER_BOOK}-${VERSION}-${LANGUAGE}`));
assert(!!bookExists, 'Expected book was not created');
});
});
}

View File

@@ -61,6 +61,9 @@ export function setup() {
// Try our best to clean up but don't fail the test if we can't
}
}
const app = this.app as Application;
// Workaround for error notification trying to read deleted books
await app.workbench.notificationToast.closeNotificationToasts();
});
});
}

View File

@@ -8,6 +8,7 @@ import { setup as setupNotebookTests } from './areas/notebook/notebook.test';
import { setup as setupNotebookViewTests } from './areas/notebook/notebookView.test';
import { setup as setupImportTests } from './areas/import/import.test';
import { setup as setupCreateBookDialogTests } from './areas/notebook/createBook.test';
import { setup as setupAddRemoteBookDialogTests } from './areas/notebook/addRemoteBook.test';
import { ApplicationOptions } from '../../../automation';
import * as yazl from 'yauzl';
import * as fs from 'fs';
@@ -24,6 +25,7 @@ export function main(isWeb: boolean = false): void {
setupNotebookTests();
setupNotebookViewTests();
setupCreateBookDialogTests();
setupAddRemoteBookDialogTests();
setupImportTests();
}