automation_model 1.0.46 → 1.0.48
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/bin/stable_browser.js +21 -1
- package/package.json +1 -1
package/bin/stable_browser.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import reg_parser from "regex-parser";
|
|
2
2
|
import { expect } from "@playwright/test";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
let configuration = null;
|
|
3
5
|
class StableBrowser {
|
|
4
6
|
constructor(browser, page, logger) {
|
|
5
7
|
this.browser = browser;
|
|
@@ -313,8 +315,26 @@ class StableBrowser {
|
|
|
313
315
|
}
|
|
314
316
|
}
|
|
315
317
|
async waitForPageLoad(options = {}) {
|
|
318
|
+
let timeout = 10000;
|
|
319
|
+
if (!configuration) {
|
|
320
|
+
try {
|
|
321
|
+
if (fs.existsSync(".ai_config.json")) {
|
|
322
|
+
configuration = JSON.parse(fs.readFileSync(".ai_config.json"));
|
|
323
|
+
} else {
|
|
324
|
+
configuration = {};
|
|
325
|
+
}
|
|
326
|
+
} catch (e) {
|
|
327
|
+
this.logger.error("unable to read .ai_config.json");
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if (configuration.page_timeout) {
|
|
331
|
+
timeout = configuration.page_timeout;
|
|
332
|
+
}
|
|
333
|
+
if (options.page_timeout) {
|
|
334
|
+
timeout = options.page_timeout;
|
|
335
|
+
}
|
|
316
336
|
const waitOptions = {
|
|
317
|
-
timeout:
|
|
337
|
+
timeout: timeout,
|
|
318
338
|
};
|
|
319
339
|
try {
|
|
320
340
|
await Promise.all([
|