Follow up on PR feedback

This commit is contained in:
Dmitriy Vasyura
2026-01-10 18:34:27 +01:00
parent 4c0056e0ff
commit cfb2532f2e
3 changed files with 53 additions and 50 deletions

View File

@@ -111,33 +111,10 @@ export function setup(context: TestContext) {
const port = /Extension host agent listening on (\d+)/.exec(text)?.[1];
if (port) {
(async function () {
try {
const browser = await context.launchBrowser();
const page = await browser.newPage();
const url = `http://localhost:${port}?tkn=${token}&folder=/${test.workspaceDir.replaceAll(path.sep, '/')}`;
context.log(`Navigating to ${url}`);
await page.goto(url, { waitUntil: 'networkidle' });
context.log('Waiting for the workbench to load');
await page.waitForSelector('.monaco-workbench');
context.log('Verifying page title contains "Visual Studio Code"');
assert.match(await page.title(), /Visual Studio Code/);
await test.run(page);
context.log('Closing browser');
await browser.close();
test.validate();
} catch (error) {
assert.fail(error instanceof Error ? error.message : String(error));
} finally {
context.killProcessTree(server.pid!);
}
})();
const url = `http://localhost:${port}?tkn=${token}&folder=/${test.workspaceDir.replaceAll(path.sep, '/')}`;
runUITest(url, test)
.catch(error => assert.fail(error instanceof Error ? error.message : String(error)))
.finally(() => context.killProcessTree(server.pid!));
}
});
@@ -146,5 +123,26 @@ export function setup(context: TestContext) {
server.on('exit', resolve);
});
}
async function runUITest(url: string, test: UITest) {
const browser = await context.launchBrowser();
const page = await browser.newPage();
context.log(`Navigating to ${url}`);
await page.goto(url, { waitUntil: 'networkidle' });
context.log('Waiting for the workbench to load');
await page.waitForSelector('.monaco-workbench');
context.log('Verifying page title contains "Visual Studio Code"');
assert.match(await page.title(), /Visual Studio Code/);
await test.run(page);
context.log('Closing browser');
await browser.close();
test.validate();
}
});
}