mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 20:26:08 +00:00
Add more logging and perf markers around resolving the connection token and the socket factory (#170490)
* Add more logging and perf markers around resolving the connection token and the socket factory * set `exposeFunction` earlier * bla windows * also expose function for unit tests beofre opening Co-authored-by: Benjamin Pasero <benjamin.pasero@microsoft.com>
This commit is contained in:
@@ -35,6 +35,12 @@ type BrowserType = 'chromium' | 'firefox' | 'webkit';
|
||||
async function runTestsInBrowser(browserType: BrowserType, endpoint: url.UrlWithStringQuery, server: cp.ChildProcess): Promise<void> {
|
||||
const browser = await playwright[browserType].launch({ headless: !Boolean(optimist.argv.debug) });
|
||||
const context = await browser.newContext();
|
||||
try {
|
||||
await context.grantPermissions([`clipboard-read`, `clipboard-write`]); // some tests need clipboard access
|
||||
} catch (error) {
|
||||
// ignore, seems to fail on Windows
|
||||
}
|
||||
|
||||
const page = await context.newPage();
|
||||
await page.setViewportSize({ width, height });
|
||||
|
||||
@@ -58,21 +64,6 @@ async function runTestsInBrowser(browserType: BrowserType, endpoint: url.UrlWith
|
||||
console.error('Request Failed', e.url(), e.failure()?.errorText);
|
||||
});
|
||||
|
||||
const host = endpoint.host;
|
||||
const protocol = 'vscode-remote';
|
||||
|
||||
const testWorkspacePath = URI.file(path.resolve(optimist.argv.workspacePath)).path;
|
||||
const testExtensionUri = url.format({ pathname: URI.file(path.resolve(optimist.argv.extensionDevelopmentPath)).path, protocol, host, slashes: true });
|
||||
const testFilesUri = url.format({ pathname: URI.file(path.resolve(optimist.argv.extensionTestsPath)).path, protocol, host, slashes: true });
|
||||
|
||||
const payloadParam = `[["extensionDevelopmentPath","${testExtensionUri}"],["extensionTestsPath","${testFilesUri}"],["enableProposedApi",""],["webviewExternalEndpointCommit","ef65ac1ba57f57f2a3961bfe94aa20481caca4c6"],["skipWelcome","true"]]`;
|
||||
|
||||
if (path.extname(testWorkspacePath) === '.code-workspace') {
|
||||
await page.goto(`${endpoint.href}&workspace=${testWorkspacePath}&payload=${payloadParam}`);
|
||||
} else {
|
||||
await page.goto(`${endpoint.href}&folder=${testWorkspacePath}&payload=${payloadParam}`);
|
||||
}
|
||||
|
||||
await page.exposeFunction('codeAutomationLog', (type: string, args: any[]) => {
|
||||
console[type](...args);
|
||||
});
|
||||
@@ -92,6 +83,21 @@ async function runTestsInBrowser(browserType: BrowserType, endpoint: url.UrlWith
|
||||
|
||||
process.exit(code);
|
||||
});
|
||||
|
||||
const host = endpoint.host;
|
||||
const protocol = 'vscode-remote';
|
||||
|
||||
const testWorkspacePath = URI.file(path.resolve(optimist.argv.workspacePath)).path;
|
||||
const testExtensionUri = url.format({ pathname: URI.file(path.resolve(optimist.argv.extensionDevelopmentPath)).path, protocol, host, slashes: true });
|
||||
const testFilesUri = url.format({ pathname: URI.file(path.resolve(optimist.argv.extensionTestsPath)).path, protocol, host, slashes: true });
|
||||
|
||||
const payloadParam = `[["extensionDevelopmentPath","${testExtensionUri}"],["extensionTestsPath","${testFilesUri}"],["enableProposedApi",""],["webviewExternalEndpointCommit","ef65ac1ba57f57f2a3961bfe94aa20481caca4c6"],["skipWelcome","true"]]`;
|
||||
|
||||
if (path.extname(testWorkspacePath) === '.code-workspace') {
|
||||
await page.goto(`${endpoint.href}&workspace=${testWorkspacePath}&payload=${payloadParam}`);
|
||||
} else {
|
||||
await page.goto(`${endpoint.href}&folder=${testWorkspacePath}&payload=${payloadParam}`);
|
||||
}
|
||||
}
|
||||
|
||||
function consoleLogFn(msg: playwright.ConsoleMessage) {
|
||||
|
||||
Reference in New Issue
Block a user