codeceptjs 4.0.1-beta.14 → 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,7 +1389,6 @@ class Playwright extends Helper {
|
|
|
1389
1389
|
}
|
|
1390
1390
|
}
|
|
1391
1391
|
|
|
1392
|
-
// Close browserContext if recordHar is enabled
|
|
1393
1392
|
if (this.options.recordHar && this.browserContext) {
|
|
1394
1393
|
try {
|
|
1395
1394
|
await this.browserContext.close()
|
|
@@ -1399,16 +1398,16 @@ class Playwright extends Helper {
|
|
|
1399
1398
|
}
|
|
1400
1399
|
this.browserContext = null
|
|
1401
1400
|
|
|
1402
|
-
// Initiate browser close without waiting for it to complete
|
|
1403
|
-
// The browser process will be cleaned up when the Node process exits
|
|
1404
1401
|
if (this.browser) {
|
|
1405
1402
|
try {
|
|
1406
|
-
//
|
|
1407
|
-
this.browser.close()
|
|
1408
|
-
// Silently ignore any errors during async close
|
|
1409
|
-
})
|
|
1403
|
+
// Add timeout to prevent browser.close() from hanging indefinitely
|
|
1404
|
+
await Promise.race([this.browser.close(), new Promise((_, reject) => setTimeout(() => reject(new Error('Browser close timeout')), 5000))])
|
|
1410
1405
|
} catch (e) {
|
|
1411
|
-
// Ignore
|
|
1406
|
+
// Ignore errors if browser is already closed or timeout
|
|
1407
|
+
if (!e.message?.includes('Browser close timeout')) {
|
|
1408
|
+
// Non-timeout error, can be ignored as well
|
|
1409
|
+
}
|
|
1410
|
+
// Force cleanup even on error
|
|
1412
1411
|
}
|
|
1413
1412
|
}
|
|
1414
1413
|
this.browser = null
|