froth-webdriverio-framework 7.0.101 → 7.0.103

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.
@@ -140,12 +140,40 @@ const commonHooks = {
140
140
  console.log('==== BEFORE SESSION ====');
141
141
  try {
142
142
 
143
- await validateSyntax()
143
+ await validateSyntax(specs)
144
144
  /** 🔍 Print raw capabilities first */
145
145
  console.log('🟡 Raw Capabilities (Before):');
146
146
  console.log(JSON.stringify(capabilities, null, 2));
147
147
  /** 2️⃣ BrowserStack capability normalization */
148
- capabilities = await setBrowseratckSession(capabilities)
148
+
149
+ if (process.env.PLATFORM === 'browserstack' || process.env.PLATFORM === 'browserstacklocal') {
150
+
151
+ const bsOpts = capabilities['bstack:options'] || {};
152
+ /** 🔍 Print existing BS options */
153
+ console.log('🟢 Existing bstack:options (Before Modification):');
154
+ console.log(JSON.stringify(bsOpts, null, 2));
155
+
156
+ if (process.env.BS_SESSION_TYPE === 'app-automate') {
157
+ const appPath = process.env.BROWSERSTACK_APP_PATH;
158
+ if (!appPath) {
159
+ await failExecution('BROWSERSTACK_APP_PATH is missing');
160
+ }
161
+
162
+ bsOpts.app = appPath;
163
+ capabilities['appium:app'] = appPath;
164
+
165
+ console.log('✅ App & media set in before session');
166
+
167
+ if (capabilities.platformName === 'android') {
168
+ capabilities['appium:autoGrantPermissions'] = true;
169
+ // capabilities['appium:autoGrantPermissions'] = bsCaps.autoGrantPermissions;
170
+ }
171
+ else
172
+ capabilities['autoAcceptAlerts'] = true;
173
+
174
+ }
175
+ // console.log("Config deatils :" + JSON.stringify(config, null, 2));
176
+ }
149
177
  console.log('🔎 Final capabilities:', JSON.stringify(capabilities, null, 2));
150
178
 
151
179
  } catch (error) {
@@ -336,7 +364,7 @@ async function extractLineColumn(error) {
336
364
  }
337
365
 
338
366
 
339
- async function validateSyntax() {
367
+ async function validateSyntax(specs) {
340
368
  try {
341
369
  let syntaxFailed = false;
342
370
 
@@ -368,35 +396,5 @@ async function validateSyntax() {
368
396
  async function setBrowseratckSession(capabilities) {
369
397
 
370
398
 
371
- if (process.env.PLATFORM !== 'browserstack' || process.env.PLATFORM !== 'browserstacklocal') {
372
- return capabilities;
373
- }
374
-
375
- const bsOpts = capabilities['bstack:options'] || {};
376
- /** 🔍 Print existing BS options */
377
- console.log('🟢 Existing bstack:options (Before Modification):');
378
- console.log(JSON.stringify(bsOpts, null, 2));
379
-
380
- if (process.env.BS_SESSION_TYPE === 'app-automate') {
381
- const appPath = process.env.BROWSERSTACK_APP_PATH;
382
- if (!appPath) {
383
- await failExecution('BROWSERSTACK_APP_PATH is missing');
384
- }
385
-
386
- bsOpts.app = appPath;
387
- capabilities['appium:app'] = appPath;
388
-
389
- console.log('✅ App & media set in before session');
390
-
391
- if (capabilities.platformName === 'android') {
392
- capabilities['appium:autoGrantPermissions'] = true;
393
- // capabilities['appium:autoGrantPermissions'] = bsCaps.autoGrantPermissions;
394
- }
395
- else
396
- capabilities['autoAcceptAlerts'] = true;
397
-
398
- return capabilities
399
- // console.log("Config deatils :" + JSON.stringify(config, null, 2));
400
- }
401
399
  }
402
400
  module.exports = commonHooks;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "7.0.101",
3
+ "version": "7.0.103",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",