automation_model 1.0.737-dev → 1.0.739-dev

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.
@@ -48,6 +48,7 @@ declare class StableBrowser {
48
48
  logger: any;
49
49
  context: any;
50
50
  world?: any;
51
+ fastMode: boolean;
51
52
  project_path: null;
52
53
  webLogFile: null;
53
54
  networkLogger: null;
@@ -56,7 +57,7 @@ declare class StableBrowser {
56
57
  tags: null;
57
58
  isRecording: boolean;
58
59
  initSnapshotTaken: boolean;
59
- constructor(browser: Browser, page: Page, logger?: any, context?: any, world?: any);
60
+ constructor(browser: Browser, page: Page, logger?: any, context?: any, world?: any, fastMode?: boolean);
60
61
  registerEventListeners(context: any): void;
61
62
  switchApp(appName: any): Promise<void>;
62
63
  switchTab(tabTitleOrIndex: number | string): Promise<void>;
@@ -76,6 +76,7 @@ class StableBrowser {
76
76
  logger;
77
77
  context;
78
78
  world;
79
+ fastMode;
79
80
  project_path = null;
80
81
  webLogFile = null;
81
82
  networkLogger = null;
@@ -84,12 +85,13 @@ class StableBrowser {
84
85
  tags = null;
85
86
  isRecording = false;
86
87
  initSnapshotTaken = false;
87
- constructor(browser, page, logger = null, context = null, world = null) {
88
+ constructor(browser, page, logger = null, context = null, world = null, fastMode = false) {
88
89
  this.browser = browser;
89
90
  this.page = page;
90
91
  this.logger = logger;
91
92
  this.context = context;
92
93
  this.world = world;
94
+ this.fastMode = fastMode;
93
95
  if (!this.logger) {
94
96
  this.logger = console;
95
97
  }
@@ -118,6 +120,12 @@ class StableBrowser {
118
120
  context.pages = [this.page];
119
121
  const logFolder = path.join(this.project_path, "logs", "web");
120
122
  this.world = world;
123
+ if (process.env.FAST_MODE === "true") {
124
+ this.fastMode = true;
125
+ }
126
+ if (this.context) {
127
+ this.context.fastMode = this.fastMode;
128
+ }
121
129
  this.registerEventListeners(this.context);
122
130
  registerNetworkEvents(this.world, this, this.context, this.page);
123
131
  registerDownloadEvent(this.page, this.world, this.context);
@@ -198,7 +206,9 @@ class StableBrowser {
198
206
  if (newContextCreated) {
199
207
  this.registerEventListeners(this.context);
200
208
  await this.goto(this.context.environment.baseUrl);
201
- await this.waitForPageLoad();
209
+ if (!this.fastMode) {
210
+ await this.waitForPageLoad();
211
+ }
202
212
  }
203
213
  }
204
214
  async switchTab(tabTitleOrIndex) {
@@ -1045,7 +1055,9 @@ class StableBrowser {
1045
1055
  try {
1046
1056
  await _preCommand(state, this);
1047
1057
  await performAction("click", state.element, options, this, state, _params);
1048
- await this.waitForPageLoad();
1058
+ if (!this.fastMode) {
1059
+ await this.waitForPageLoad();
1060
+ }
1049
1061
  return state.info;
1050
1062
  }
1051
1063
  catch (e) {
@@ -1437,7 +1449,9 @@ class StableBrowser {
1437
1449
  await new Promise((resolve) => setTimeout(resolve, 500));
1438
1450
  }
1439
1451
  }
1440
- await _screenshot(state, this);
1452
+ if (!this.fastMode) {
1453
+ await _screenshot(state, this);
1454
+ }
1441
1455
  if (enter === true) {
1442
1456
  await new Promise((resolve) => setTimeout(resolve, 2000));
1443
1457
  await this.page.keyboard.press("Enter");
@@ -3674,7 +3688,7 @@ class StableBrowser {
3674
3688
  }
3675
3689
  if (this.initSnapshotTaken === false) {
3676
3690
  this.initSnapshotTaken = true;
3677
- if (world && world.attach && !process.env.DISABLE_SNAPSHOT) {
3691
+ if (world && world.attach && !process.env.DISABLE_SNAPSHOT && !this.fastMode) {
3678
3692
  const snapshot = await this.getAriaSnapshot();
3679
3693
  if (snapshot) {
3680
3694
  await world.attach(JSON.stringify(snapshot), "application/json+snapshot-before");