codeceptjs 4.0.1-beta.13 → 4.0.1-beta.15
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.
|
@@ -239,8 +239,13 @@ function getImportString(testsPath, targetFolderPath, pathsToType, pathsToValue)
|
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
for (const name in pathsToValue) {
|
|
242
|
-
const
|
|
243
|
-
|
|
242
|
+
const originalPath = pathsToValue[name]
|
|
243
|
+
const relativePath = getPath(originalPath, targetFolderPath, testsPath)
|
|
244
|
+
if (originalPath.endsWith('.js') || originalPath.endsWith('.ts')) {
|
|
245
|
+
importStrings.push(`type ${name} = InstanceType<typeof import('${relativePath}').default>;`)
|
|
246
|
+
} else {
|
|
247
|
+
importStrings.push(`type ${name} = import('${relativePath}');`)
|
|
248
|
+
}
|
|
244
249
|
}
|
|
245
250
|
|
|
246
251
|
return importStrings
|
package/lib/helper/Playwright.js
CHANGED
|
@@ -1389,29 +1389,6 @@ class Playwright extends Helper {
|
|
|
1389
1389
|
}
|
|
1390
1390
|
}
|
|
1391
1391
|
|
|
1392
|
-
// Close all contexts and pages before closing browser to prevent hanging
|
|
1393
|
-
if (this.browser) {
|
|
1394
|
-
try {
|
|
1395
|
-
const contexts = await Promise.race([
|
|
1396
|
-
this.browser.contexts(),
|
|
1397
|
-
new Promise((_, reject) => setTimeout(() => reject(new Error('Get contexts timeout')), 1000))
|
|
1398
|
-
])
|
|
1399
|
-
// Close all pages in all contexts first
|
|
1400
|
-
await Promise.allSettled(contexts.map(async (ctx) => {
|
|
1401
|
-
try {
|
|
1402
|
-
const pages = await ctx.pages()
|
|
1403
|
-
await Promise.allSettled(pages.map(p => p.close().catch(() => {})))
|
|
1404
|
-
} catch (e) {
|
|
1405
|
-
// Ignore errors getting or closing pages
|
|
1406
|
-
}
|
|
1407
|
-
}))
|
|
1408
|
-
// Then close all contexts
|
|
1409
|
-
await Promise.allSettled(contexts.map(c => c.close().catch(() => {})))
|
|
1410
|
-
} catch (e) {
|
|
1411
|
-
// Ignore errors if browser is already closed or timeout getting contexts
|
|
1412
|
-
}
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
1392
|
if (this.options.recordHar && this.browserContext) {
|
|
1416
1393
|
try {
|
|
1417
1394
|
await this.browserContext.close()
|