testaro 59.2.2 → 59.2.4
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/package.json +1 -1
- package/run.js +9 -0
package/package.json
CHANGED
package/run.js
CHANGED
|
@@ -100,6 +100,7 @@ const tmpDir = os.tmpdir();
|
|
|
100
100
|
|
|
101
101
|
// Facts about the current session.
|
|
102
102
|
let actCount = 0;
|
|
103
|
+
let browserCloseIntentional = false;
|
|
103
104
|
// Facts about the current act.
|
|
104
105
|
let actIndex = 0;
|
|
105
106
|
let browser;
|
|
@@ -214,6 +215,7 @@ const goTo = async (report, page, url, timeout, waitUntil) => {
|
|
|
214
215
|
// Closes the current browser.
|
|
215
216
|
const browserClose = async () => {
|
|
216
217
|
if (browser) {
|
|
218
|
+
browserCloseIntentional = true;
|
|
217
219
|
for (const context of browser.contexts()) {
|
|
218
220
|
try {
|
|
219
221
|
await context.close();
|
|
@@ -225,6 +227,7 @@ const browserClose = async () => {
|
|
|
225
227
|
}
|
|
226
228
|
}
|
|
227
229
|
await browser.close();
|
|
230
|
+
browserCloseIntentional = false;
|
|
228
231
|
browser = null;
|
|
229
232
|
}
|
|
230
233
|
};
|
|
@@ -283,6 +286,12 @@ const launch = exports.launch = async (report, debug, waits, tempBrowserID, temp
|
|
|
283
286
|
browser = await browserType.launch(browserOptions);
|
|
284
287
|
// Open a context (i.e. browser window).
|
|
285
288
|
const browserContext = await browser.newContext(device.windowOptions);
|
|
289
|
+
// Create a diagnostic listener for its unintentional closing.
|
|
290
|
+
browserContext.on('close', () => {
|
|
291
|
+
if (! browserCloseIntentional) {
|
|
292
|
+
console.log(new Error('Browser context closed').stack);
|
|
293
|
+
}
|
|
294
|
+
});
|
|
286
295
|
// Prevent default timeouts.
|
|
287
296
|
browserContext.setDefaultTimeout(0);
|
|
288
297
|
// When a page (i.e. browser tab) is added to the browser context (i.e. browser window):
|