@vscode/test-web 0.0.40 → 0.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/index.js +16 -19
- package/out/server/workbench.js +3 -1
- package/package.json +1 -1
- package/views/workbench-esm.html +0 -3
- package/views/workbench.html +0 -3
package/out/index.js
CHANGED
|
@@ -35,20 +35,14 @@ async function runTests(options) {
|
|
|
35
35
|
const server = await (0, main_1.runServer)(host, port, config);
|
|
36
36
|
return new Promise(async (s, e) => {
|
|
37
37
|
const endpoint = `http://${host}:${port}`;
|
|
38
|
-
const
|
|
39
|
-
context.once('close', () => server.close());
|
|
38
|
+
const configPage = async (page, browser) => {
|
|
40
39
|
const unreportedOutput = [];
|
|
41
|
-
await
|
|
42
|
-
|
|
43
|
-
console[type](...args);
|
|
44
|
-
}
|
|
45
|
-
catch (_e) {
|
|
46
|
-
unreportedOutput.push({ type, args });
|
|
47
|
-
}
|
|
40
|
+
await page.exposeFunction('codeAutomationLog', (type, args) => {
|
|
41
|
+
console[type](...args);
|
|
48
42
|
});
|
|
49
|
-
await
|
|
43
|
+
await page.exposeFunction('codeAutomationExit', async (code) => {
|
|
50
44
|
try {
|
|
51
|
-
await
|
|
45
|
+
await browser.close();
|
|
52
46
|
}
|
|
53
47
|
catch (error) {
|
|
54
48
|
console.error(`Error when closing browser: ${error}`);
|
|
@@ -67,8 +61,11 @@ async function runTests(options) {
|
|
|
67
61
|
});
|
|
68
62
|
};
|
|
69
63
|
console.log(`Opening browser on ${endpoint}...`);
|
|
70
|
-
const context = await openBrowser(endpoint, options,
|
|
71
|
-
if (
|
|
64
|
+
const context = await openBrowser(endpoint, options, configPage);
|
|
65
|
+
if (context) {
|
|
66
|
+
context.once('close', () => server.close());
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
72
69
|
server.close();
|
|
73
70
|
e(new Error('Can not run test as opening of browser failed.'));
|
|
74
71
|
}
|
|
@@ -103,10 +100,8 @@ async function open(options) {
|
|
|
103
100
|
const port = options.port ?? 3000;
|
|
104
101
|
const server = await (0, main_1.runServer)(host, port, config);
|
|
105
102
|
const endpoint = `http://${host}:${port}`;
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
};
|
|
109
|
-
const context = await openBrowser(endpoint, options, configContext);
|
|
103
|
+
const context = await openBrowser(endpoint, options);
|
|
104
|
+
context?.once('close', () => server.close());
|
|
110
105
|
return {
|
|
111
106
|
dispose: () => {
|
|
112
107
|
server.close();
|
|
@@ -115,7 +110,7 @@ async function open(options) {
|
|
|
115
110
|
};
|
|
116
111
|
}
|
|
117
112
|
exports.open = open;
|
|
118
|
-
async function openBrowser(endpoint, options,
|
|
113
|
+
async function openBrowser(endpoint, options, configPage) {
|
|
119
114
|
if (options.browserType === 'none') {
|
|
120
115
|
return undefined;
|
|
121
116
|
}
|
|
@@ -137,7 +132,6 @@ async function openBrowser(endpoint, options, configureContext) {
|
|
|
137
132
|
if (options.permissions) {
|
|
138
133
|
context.grantPermissions(options.permissions);
|
|
139
134
|
}
|
|
140
|
-
await configureContext(context);
|
|
141
135
|
// forcefully close browser if last page is closed. workaround for https://github.com/microsoft/playwright/issues/2946
|
|
142
136
|
let openPages = 0;
|
|
143
137
|
context.on('page', page => {
|
|
@@ -150,6 +144,9 @@ async function openBrowser(endpoint, options, configureContext) {
|
|
|
150
144
|
});
|
|
151
145
|
});
|
|
152
146
|
const page = context.pages()[0] ?? await context.newPage();
|
|
147
|
+
if (configPage) {
|
|
148
|
+
await configPage(page, browser);
|
|
149
|
+
}
|
|
153
150
|
if (options.waitForDebugger) {
|
|
154
151
|
await page.waitForFunction(() => '__jsDebugIsReady' in globalThis);
|
|
155
152
|
}
|
package/out/server/workbench.js
CHANGED
|
@@ -23,12 +23,14 @@ class Workbench {
|
|
|
23
23
|
this.productOverrides = productOverrides;
|
|
24
24
|
}
|
|
25
25
|
async render(workbenchWebConfiguration) {
|
|
26
|
+
if (this.productOverrides) {
|
|
27
|
+
workbenchWebConfiguration.productConfiguration = { ...workbenchWebConfiguration.productConfiguration, ...this.productOverrides };
|
|
28
|
+
}
|
|
26
29
|
const values = {
|
|
27
30
|
WORKBENCH_WEB_CONFIGURATION: asJSON(workbenchWebConfiguration),
|
|
28
31
|
WORKBENCH_AUTH_SESSION: '',
|
|
29
32
|
WORKBENCH_WEB_BASE_URL: this.baseUrl,
|
|
30
33
|
WORKBENCH_BUILTIN_EXTENSIONS: asJSON(this.builtInExtensions),
|
|
31
|
-
WORKBENCH_PRODUCT_OVERRIDES: this.productOverrides ? asJSON(this.productOverrides) : '',
|
|
32
34
|
WORKBENCH_MAIN: this.getMain()
|
|
33
35
|
};
|
|
34
36
|
try {
|
package/package.json
CHANGED
package/views/workbench-esm.html
CHANGED
|
@@ -25,9 +25,6 @@
|
|
|
25
25
|
<!-- Builtin Extensions (running out of sources) -->
|
|
26
26
|
<meta id="vscode-workbench-builtin-extensions" data-settings="{{WORKBENCH_BUILTIN_EXTENSIONS}}">
|
|
27
27
|
|
|
28
|
-
<!-- Product Overrides (running out of sources) -->
|
|
29
|
-
<meta id="vscode-workbench-product-overrides" data-settings="{{WORKBENCH_PRODUCT_OVERRIDES}}">
|
|
30
|
-
|
|
31
28
|
<!-- Workbench Icon/Manifest/CSS -->
|
|
32
29
|
<link rel="icon" href="{{WORKBENCH_WEB_BASE_URL}}/favicon.ico" type="image/x-icon" />
|
|
33
30
|
<link rel="manifest" href="{{WORKBENCH_WEB_BASE_URL}}/manifest.json">
|
package/views/workbench.html
CHANGED
|
@@ -25,9 +25,6 @@
|
|
|
25
25
|
<!-- Builtin Extensions (running out of sources) -->
|
|
26
26
|
<meta id="vscode-workbench-builtin-extensions" data-settings="{{WORKBENCH_BUILTIN_EXTENSIONS}}">
|
|
27
27
|
|
|
28
|
-
<!-- Product Overrides (running out of sources) -->
|
|
29
|
-
<meta id="vscode-workbench-product-overrides" data-settings="{{WORKBENCH_PRODUCT_OVERRIDES}}">
|
|
30
|
-
|
|
31
28
|
<!-- Workbench Icon/Manifest/CSS -->
|
|
32
29
|
<link rel="icon" href="{{WORKBENCH_WEB_BASE_URL}}/favicon.ico" type="image/x-icon" />
|
|
33
30
|
<link rel="manifest" href="{{WORKBENCH_WEB_BASE_URL}}/manifest.json">
|