mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
Remote smoketest timeout (fixes #115159)
This commit is contained in:
parent
e4022fb0e2
commit
4bd2d367e7
|
@ -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<string> {
|
||||
async function downloadVSCodeServerArchive(updateUrl: string, commit: string, quality: string, destDir: string, log: (messsage: string) => void): Promise<string> {
|
||||
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<string> {
|
||||
export async function downloadAndUnzipVSCodeServer(updateUrl: string, commit: string, quality: string = 'stable', destDir: string, log: (messsage: string) => void): Promise<string> {
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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}`);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -282,14 +282,15 @@ export class Code {
|
|||
await this.driver.exitApplication();
|
||||
}
|
||||
|
||||
async waitForTextContent(selector: string, textContent?: string, accept?: (result: string) => boolean): Promise<string> {
|
||||
async waitForTextContent(selector: string, textContent?: string, accept?: (result: string) => boolean, retryCount?: number): Promise<string> {
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue