mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Wait for SqlToolsService to start before running smoke tests (#15864)
This commit is contained in:
@@ -146,10 +146,18 @@ export class Application {
|
|||||||
await this.code.waitForWindowIds(ids => ids.length > 0);
|
await this.code.waitForWindowIds(ids => ids.length > 0);
|
||||||
await this.code.waitForElement('.monaco-workbench');
|
await this.code.waitForElement('.monaco-workbench');
|
||||||
|
|
||||||
|
// {{SQL CARBON EDIT}} Wait for specified status bar items before considering the app ready - we wait for them together to avoid timing
|
||||||
|
// issues with the status bar items disappearing
|
||||||
|
const statusbarPromises: Promise<string>[] = [];
|
||||||
|
|
||||||
if (this.remote) {
|
if (this.remote) {
|
||||||
await this.code.waitForTextContent('.monaco-workbench .statusbar-item[id="status.host"]', ' TestResolver', undefined, 2000);
|
statusbarPromises.push(this.code.waitForTextContent('.monaco-workbench .statusbar-item[id="status.host"]', ' TestResolver', undefined, 2000));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wait for SQL Tools Service to start before considering the app ready
|
||||||
|
statusbarPromises.push(this.code.waitForTextContent('.monaco-workbench .statusbar-item[id="Microsoft.mssql"]', 'SQL Tools Service Started', undefined, 30000));
|
||||||
|
await Promise.all(statusbarPromises);
|
||||||
|
|
||||||
// wait a bit, since focus might be stolen off widgets
|
// wait a bit, since focus might be stolen off widgets
|
||||||
// as soon as they open (e.g. quick access)
|
// as soon as they open (e.g. quick access)
|
||||||
await new Promise(c => setTimeout(c, 1000));
|
await new Promise(c => setTimeout(c, 1000));
|
||||||
|
|||||||
@@ -20,9 +20,6 @@ export function setup() {
|
|||||||
let tmpDir = '';
|
let tmpDir = '';
|
||||||
it('can create new book with default content folder', async function () {
|
it('can create new book with default content folder', async function () {
|
||||||
const app = this.app as Application;
|
const app = this.app as Application;
|
||||||
// Add timeout for giving time for the SQL Tools Service to start (it'll error if it's not started yet)
|
|
||||||
// TODO @chgagnon - Figure out better way to have tests wait for STS
|
|
||||||
await new Promise(r => setTimeout(r, 10000));
|
|
||||||
// eslint-disable-next-line no-sync
|
// eslint-disable-next-line no-sync
|
||||||
tmpDir = tmp.dirSync().name;
|
tmpDir = tmp.dirSync().name;
|
||||||
await app.workbench.quickaccess.runCommand(CreateBookCommand);
|
await app.workbench.quickaccess.runCommand(CreateBookCommand);
|
||||||
@@ -31,14 +28,13 @@ export function setup() {
|
|||||||
await app.workbench.createBookDialog.create();
|
await app.workbench.createBookDialog.create();
|
||||||
const bookExists = await fs.stat(path.join(tmpDir, bookName));
|
const bookExists = await fs.stat(path.join(tmpDir, bookName));
|
||||||
assert(!!bookExists, 'Book was not created');
|
assert(!!bookExists, 'Book was not created');
|
||||||
|
// Wait a bit for the book to load in the viewlet before ending the test, otherwise we can get an error when it tries to read the deleted files
|
||||||
|
// TODO Instead it would be better to either not add the book to the viewlet to begin with or close it after the test is done
|
||||||
await new Promise(r => setTimeout(r, 2500));
|
await new Promise(r => setTimeout(r, 2500));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can create new book with specified content folder', async function () {
|
it('can create new book with specified content folder', async function () {
|
||||||
const app = this.app as Application;
|
const app = this.app as Application;
|
||||||
// Add timeout for giving time for the SQL Tools Service to start (it'll error if it's not started yet)
|
|
||||||
// TODO @chgagnon - Figure out better way to have tests wait for STS
|
|
||||||
await new Promise(r => setTimeout(r, 10000));
|
|
||||||
// eslint-disable-next-line no-sync
|
// eslint-disable-next-line no-sync
|
||||||
tmpDir = tmp.dirSync().name;
|
tmpDir = tmp.dirSync().name;
|
||||||
// Our content folder is just the workspace folder containing the test notebooks
|
// Our content folder is just the workspace folder containing the test notebooks
|
||||||
@@ -52,6 +48,8 @@ export function setup() {
|
|||||||
assert(!!bookExists, 'Book was not created');
|
assert(!!bookExists, 'Book was not created');
|
||||||
const contentNotebookExists = await fs.stat(path.join(tmpDir, bookName, 'hello.ipynb'));
|
const contentNotebookExists = await fs.stat(path.join(tmpDir, bookName, 'hello.ipynb'));
|
||||||
assert(!!contentNotebookExists, 'Notebook from content folder wasn\'t copied over');
|
assert(!!contentNotebookExists, 'Notebook from content folder wasn\'t copied over');
|
||||||
|
// Wait a bit for the book to load in the viewlet before ending the test, otherwise we can get an error when it tries to read the deleted files
|
||||||
|
// TODO Instead it would be better to either not add the book to the viewlet to begin with or close it after the test is done
|
||||||
await new Promise(r => setTimeout(r, 2500));
|
await new Promise(r => setTimeout(r, 2500));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user