@checksum-ai/runtime 1.1.12-alpha → 1.1.13
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/checksum-root/playwright.config.ts +7 -1
- package/checksumlib.js +21 -21
- package/cli.js +30 -30
- package/index.d.ts +7 -0
- package/index.js +53 -51
- package/package.json +4 -4
- package/scripts/playwright_patches/1.41.2.js +40 -0
- package/scripts/playwright_patches/1.46.0.js +40 -0
- package/test-run-monitor.js +6 -6
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checksum-ai/runtime",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.13",
|
|
4
4
|
"description": "Checksum.ai test runtime",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@playwright/test": "1.46.0",
|
|
8
|
-
"ts-node": "^10.9.1",
|
|
9
8
|
"jsdom": "^22.1.0",
|
|
10
|
-
"
|
|
11
|
-
"request": "^2.88.2"
|
|
9
|
+
"playwright-extra": "^4.3.6",
|
|
10
|
+
"request": "^2.88.2",
|
|
11
|
+
"ts-node": "^10.9.1"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
@@ -215,6 +215,45 @@ function testType(projectRoot) {
|
|
|
215
215
|
replaceContent(file, originalContent, newContent);
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
+
function indexContent(projectRoot) {
|
|
219
|
+
const file = join(projectRoot, "node_modules", "playwright", "lib", "index.js")
|
|
220
|
+
if (!doesFileExist) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
let originalContent, newContent;
|
|
224
|
+
originalContent = `const browser = await playwright[browserName].launch();`
|
|
225
|
+
newContent = `
|
|
226
|
+
let browser = playwright[browserName];
|
|
227
|
+
try {
|
|
228
|
+
const { playwrightExtra } = testInfo?.project?.use || {};
|
|
229
|
+
if (playwrightExtra && playwrightExtra?.length) {
|
|
230
|
+
const pw= require("playwright-extra")
|
|
231
|
+
const PupeteerExtraPlugin = require("puppeteer-extra-plugin").PuppeteerExtraPlugin
|
|
232
|
+
const chromium = pw.chromium;
|
|
233
|
+
|
|
234
|
+
playwrightExtra.forEach((plugin, i) => {
|
|
235
|
+
try {
|
|
236
|
+
if(!(plugin instanceof PupeteerExtraPlugin)){
|
|
237
|
+
console.warn(\`Plugin at index \${i} is not an instance of PupeteerExtraPlugin\`);
|
|
238
|
+
}
|
|
239
|
+
chromium.use(plugin);
|
|
240
|
+
} catch (e) {
|
|
241
|
+
console.warn(e);
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
browser = chromium;
|
|
245
|
+
}
|
|
246
|
+
} catch (e) {
|
|
247
|
+
console.warn(
|
|
248
|
+
"CHECKSUM: Failed to load Playwright Extra, using Playwright instead.",
|
|
249
|
+
e
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
browser = await browser.launch();
|
|
253
|
+
`
|
|
254
|
+
replaceContent(file, originalContent, newContent)
|
|
255
|
+
}
|
|
256
|
+
|
|
218
257
|
function channelOwner(projectRoot) {
|
|
219
258
|
const file = join(
|
|
220
259
|
projectRoot,
|
|
@@ -258,6 +297,7 @@ function run(projectPath) {
|
|
|
258
297
|
testInfo(projectPath);
|
|
259
298
|
testType(projectPath);
|
|
260
299
|
channelOwner(projectPath);
|
|
300
|
+
indexContent(projectPath);
|
|
261
301
|
}
|
|
262
302
|
} else {
|
|
263
303
|
// console.warn("Project path not found", projectPath);
|
|
@@ -194,6 +194,45 @@ function testType(projectRoot) {
|
|
|
194
194
|
amend(file, entryPointText, appendText);
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
+
function indexContent(projectRoot) {
|
|
198
|
+
const file = join(projectRoot, "node_modules", "playwright", "lib", "index.js")
|
|
199
|
+
if (!doesFileExist) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
let originalContent, newContent;
|
|
203
|
+
originalContent = `const browser = await playwright[browserName].launch();`
|
|
204
|
+
newContent = `
|
|
205
|
+
let browser = playwright[browserName];
|
|
206
|
+
try {
|
|
207
|
+
const { playwrightExtra } = testInfo?.project?.use || {};
|
|
208
|
+
if (playwrightExtra && playwrightExtra?.length) {
|
|
209
|
+
const pw= require("playwright-extra")
|
|
210
|
+
const PupeteerExtraPlugin = require("puppeteer-extra-plugin").PuppeteerExtraPlugin
|
|
211
|
+
const chromium = pw.chromium;
|
|
212
|
+
|
|
213
|
+
playwrightExtra.forEach((plugin, i) => {
|
|
214
|
+
try {
|
|
215
|
+
if(!(plugin instanceof PupeteerExtraPlugin)){
|
|
216
|
+
console.warn(\`Plugin at index \${i} is not an instance of PupeteerExtraPlugin\`);
|
|
217
|
+
}
|
|
218
|
+
chromium.use(plugin);
|
|
219
|
+
} catch (e) {
|
|
220
|
+
console.warn(e);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
browser = chromium;
|
|
224
|
+
}
|
|
225
|
+
} catch (e) {
|
|
226
|
+
console.warn(
|
|
227
|
+
"CHECKSUM: Failed to load Playwright Extra, using Playwright instead.",
|
|
228
|
+
e
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
browser = await browser.launch();
|
|
232
|
+
`
|
|
233
|
+
replaceContent(file, originalContent, newContent)
|
|
234
|
+
}
|
|
235
|
+
|
|
197
236
|
function channelOwner(projectRoot) {
|
|
198
237
|
const file = join(
|
|
199
238
|
projectRoot,
|
|
@@ -253,6 +292,7 @@ function run(projectPath) {
|
|
|
253
292
|
testType(projectPath);
|
|
254
293
|
channelOwner(projectPath);
|
|
255
294
|
stackTrace(projectPath);
|
|
295
|
+
indexContent(projectPath);
|
|
256
296
|
}
|
|
257
297
|
} else {
|
|
258
298
|
// console.warn("Project path not found", projectPath);
|