diff --git a/extensions/vscode-test-resolver/src/download.ts b/extensions/vscode-test-resolver/src/download.ts index d94ea212237..805c4948210 100644 --- a/extensions/vscode-test-resolver/src/download.ts +++ b/extensions/vscode-test-resolver/src/download.ts @@ -23,14 +23,14 @@ function getDownloadUrl(updateUrl: string, commit: string, platform: string, qua return `${updateUrl}/commit:${commit}/server-${platform}/${quality}`; } -async function downloadVSCodeServerArchive(updateUrl: string, commit: string, quality: string, destDir: string): Promise { +async function downloadVSCodeServerArchive(updateUrl: string, commit: string, quality: string, destDir: string, log: (messsage: string) => void): Promise { ensureFolderExists(destDir); const platform = process.platform === 'win32' ? 'win32-x64' : process.platform === 'darwin' ? 'darwin' : 'linux-x64'; const downloadUrl = getDownloadUrl(updateUrl, commit, platform, quality); return new Promise((resolve, reject) => { - console.log(`Downloading VS Code Server from: ${downloadUrl}`); + log(`Downloading VS Code Server from: ${downloadUrl}`); const requestOptions: https.RequestOptions = parseUrl(downloadUrl); https.get(requestOptions, res => { @@ -70,9 +70,10 @@ async function downloadVSCodeServerArchive(updateUrl: string, commit: string, qu /** * Unzip a .zip or .tar.gz VS Code archive */ -function unzipVSCodeServer(vscodeArchivePath: string, extractDir: string) { +function unzipVSCodeServer(vscodeArchivePath: string, extractDir: string, destDir: string, log: (messsage: string) => void) { + log(`Extracting ${vscodeArchivePath}`); if (vscodeArchivePath.endsWith('.zip')) { - const tempDir = fs.mkdtempSync('vscode-server'); + const tempDir = fs.mkdtempSync(path.join(destDir, 'vscode-server-extract')); if (process.platform === 'win32') { cp.spawnSync('powershell.exe', [ '-NoProfile', @@ -95,17 +96,17 @@ function unzipVSCodeServer(vscodeArchivePath: string, extractDir: string) { } } -export async function downloadAndUnzipVSCodeServer(updateUrl: string, commit: string, quality: string = 'stable', destDir: string): Promise { +export async function downloadAndUnzipVSCodeServer(updateUrl: string, commit: string, quality: string = 'stable', destDir: string, log: (messsage: string) => void): Promise { const extractDir = path.join(destDir, commit); if (fs.existsSync(extractDir)) { - console.log(`Found ${extractDir}. Skipping download.`); + log(`Found ${extractDir}. Skipping download.`); } else { - console.log(`Downloading VS Code Server ${quality} - ${commit} into ${extractDir}.`); + log(`Downloading VS Code Server ${quality} - ${commit} into ${extractDir}.`); try { - const vscodeArchivePath = await downloadVSCodeServerArchive(updateUrl, commit, quality, destDir); + const vscodeArchivePath = await downloadVSCodeServerArchive(updateUrl, commit, quality, destDir, log); if (fs.existsSync(vscodeArchivePath)) { - unzipVSCodeServer(vscodeArchivePath, extractDir); + unzipVSCodeServer(vscodeArchivePath, extractDir, destDir, log); // Remove archive fs.unlinkSync(vscodeArchivePath); } @@ -114,4 +115,4 @@ export async function downloadAndUnzipVSCodeServer(updateUrl: string, commit: st } } return Promise.resolve(extractDir); -} \ No newline at end of file +} diff --git a/extensions/vscode-test-resolver/src/extension.ts b/extensions/vscode-test-resolver/src/extension.ts index fed26d59426..ccac6c52c48 100644 --- a/extensions/vscode-test-resolver/src/extension.ts +++ b/extensions/vscode-test-resolver/src/extension.ts @@ -103,7 +103,7 @@ export function activate(context: vscode.ExtensionContext) { if (!serverLocation) { const serverBin = path.join(remoteDataDir, 'bin'); progress.report({ message: 'Installing VSCode Server' }); - serverLocation = await downloadAndUnzipVSCodeServer(updateUrl, commit, quality, serverBin); + serverLocation = await downloadAndUnzipVSCodeServer(updateUrl, commit, quality, serverBin, m => outputChannel.appendLine(m)); } outputChannel.appendLine(`Using server build at ${serverLocation}`); diff --git a/test/automation/src/application.ts b/test/automation/src/application.ts index 2e09e3a5a20..9f6480ab42a 100644 --- a/test/automation/src/application.ts +++ b/test/automation/src/application.ts @@ -142,7 +142,7 @@ export class Application { await this.code.waitForElement('.monaco-workbench'); if (this.remote) { - await this.code.waitForTextContent('.monaco-workbench .statusbar-item[id="status.host"]', ' TestResolver'); + await this.code.waitForTextContent('.monaco-workbench .statusbar-item[id="status.host"]', ' TestResolver', undefined, 2000); } // wait a bit, since focus might be stolen off widgets diff --git a/test/automation/src/code.ts b/test/automation/src/code.ts index 6307cc3263b..a947b1c100e 100644 --- a/test/automation/src/code.ts +++ b/test/automation/src/code.ts @@ -282,14 +282,15 @@ export class Code { await this.driver.exitApplication(); } - async waitForTextContent(selector: string, textContent?: string, accept?: (result: string) => boolean): Promise { + async waitForTextContent(selector: string, textContent?: string, accept?: (result: string) => boolean, retryCount?: number): Promise { const windowId = await this.getActiveWindowId(); accept = accept || (result => textContent !== undefined ? textContent === result : !!result); return await poll( () => this.driver.getElements(windowId, selector).then(els => els.length > 0 ? Promise.resolve(els[0].textContent) : Promise.reject(new Error('Element not found for textContent'))), s => accept!(typeof s === 'string' ? s : ''), - `get text content '${selector}'` + `get text content '${selector}'`, + retryCount ); }