automation_model 1.0.47 → 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 +16 -0
- 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;
|
|
@@ -314,6 +316,20 @@ class StableBrowser {
|
|
|
314
316
|
}
|
|
315
317
|
async waitForPageLoad(options = {}) {
|
|
316
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
|
+
}
|
|
317
333
|
if (options.page_timeout) {
|
|
318
334
|
timeout = options.page_timeout;
|
|
319
335
|
}
|