froth-webdriverio-framework 9.0.0 → 9.0.1

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.
@@ -8,8 +8,6 @@ let totalTestDuration = 0;
8
8
  const url = require('url');
9
9
  const fs = require('fs');
10
10
  const path = require('path');
11
- const vm = require('vm');
12
-
13
11
  let executionUpdated = false;
14
12
  const resultdetails = {
15
13
  comments: [],
@@ -139,15 +137,30 @@ const commonHooks = {
139
137
  beforeSession: async function (config, capabilities, specs) {
140
138
  console.log('==== BEFORE SESSION ====');
141
139
  try {
140
+ /** 1️⃣ Validate test syntax */
141
+ let syntaxFailed = false;
142
+
143
+ for (const fileUrl of specs) {
144
+ const filePath = url.fileURLToPath(fileUrl);
145
+ try {
146
+ new Function(fs.readFileSync(filePath, 'utf8'));
147
+ } catch (err) {
148
+ const msg = `❌ Syntax error in ${path.basename(filePath)}: ${err.message}`;
149
+ console.error(msg);
150
+ resultdetails.comments.push(msg);
151
+ syntaxFailed = true;
152
+ }
153
+ }
142
154
 
143
- await validateSyntax(specs)
144
- /** 🔍 Print raw capabilities first */
145
- console.log('🟡 Raw Capabilities (Before):');
146
- console.log(JSON.stringify(capabilities, null, 2));
155
+ if (syntaxFailed) {
156
+ await failExecution('Syntax validation failed');
157
+ }
147
158
  /** 2️⃣ BrowserStack capability normalization */
148
159
 
149
160
  if (process.env.PLATFORM === 'browserstack' || process.env.PLATFORM === 'browserstacklocal') {
150
-
161
+ /** 🔍 Print raw capabilities first */
162
+ console.log('🟡 Raw Capabilities (Before):');
163
+ console.log(JSON.stringify(capabilities, null, 2));
151
164
  const bsOpts = capabilities['bstack:options'] || {};
152
165
  /** 🔍 Print existing BS options */
153
166
  console.log('🟢 Existing bstack:options (Before Modification):');
@@ -173,6 +186,7 @@ const commonHooks = {
173
186
 
174
187
  }
175
188
  // console.log("Config deatils :" + JSON.stringify(config, null, 2));
189
+
176
190
  }
177
191
  console.log('🔎 Final capabilities:', JSON.stringify(capabilities, null, 2));
178
192
 
@@ -347,52 +361,5 @@ async function normalizeWdioError(error) {
347
361
  return `Automation framework error: ${msg}`;
348
362
  }
349
363
 
350
- async function extractLineColumn(error) {
351
- if (!error.stack) return { line: 'unknown', column: 'unknown' };
352
-
353
- // Matches: filename:line:column
354
- const match = error.stack.match(/:(\d+):(\d+)\)?$/m);
355
-
356
- if (match) {
357
- return {
358
- line: match[1],
359
- column: match[2]
360
- };
361
- }
362
-
363
- return { line: 'unknown', column: 'unknown' };
364
- }
365
-
366
-
367
- async function validateSyntax(specs) {
368
- try {
369
- let syntaxFailed = false;
370
-
371
- for (const fileUrl of specs) {
372
- console.log("file path ",fileUrl)
373
- const filePath = url.fileURLToPath(fileUrl);
374
- const code = fs.readFileSync(filePath, 'utf8');
375
-
376
- try {
377
- new vm.Script(code, { filename: filePath });
378
- } catch (err) {
379
- const { line, column } = await extractLineColumn(err);
380
-
381
- const msg = `❌ Syntax error in ${path.basename(filePath)} at line ${line}, column ${column}: ${err.message}`;
382
-
383
- console.error(msg);
384
- resultdetails.comments.push(msg);
385
- syntaxFailed = true;
386
- }
387
- }
388
-
389
- if (syntaxFailed) {
390
- await failExecution('Syntax validation failed');
391
- }
392
- } catch (e) {
393
- console.error("failed in validate syntax method:", e)
394
- }
395
- }
396
-
397
364
 
398
365
  module.exports = commonHooks;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "9.0.0",
3
+ "version": "9.0.1",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",
@@ -25,19 +25,29 @@
25
25
  "appium"
26
26
  ],
27
27
  "dependencies": {
28
- "@wdio/appium-service": "^9.21.0",
29
- "@wdio/browserstack-service": "^9.21.0",
30
- "@wdio/cli": "^9.21.1",
31
- "@wdio/local-runner": "^9.21.0",
32
- "@wdio/mocha-framework": "^9.21.0",
28
+ "@wdio/appium-service": "^9.23.0",
29
+ "@wdio/browserstack-service": "^9.23.0",
30
+ "@wdio/cli": "^9.23.0",
31
+ "@wdio/local-runner": "^9.23.0",
32
+ "@wdio/mocha-framework": "^9.23.0",
33
33
  "@wdio/spec-reporter": "^9.20.0",
34
34
  "appium": "^3.1.2",
35
- "appium-uiautomator2-driver": "^6.7.1",
36
- "chai": "^4.3.6",
35
+ "appium-uiautomator2-driver": "^6.7.8",
36
+ "assert": "^2.1.0",
37
+ "axios": "^1.13.2",
38
+ "browserstack-local": "^1.5.8",
39
+ "chai": "^6.2.2",
37
40
  "crypto-js": "^4.2.0",
38
41
  "deepmerge": "^4.3.1",
42
+ "express": "^5.2.1",
43
+ "form-data": "^4.0.5",
44
+ "fs": "^0.0.1-security",
45
+ "js-yaml": "^4.1.1",
46
+ "mysql2": "^3.16.0",
47
+ "node-fetch": "^3.3.2",
39
48
  "node-localstorage": "^3.0.5",
40
49
  "randexp": "^0.5.3",
41
- "webdriverio": "^9"
50
+ "ts-node": "^10.9.2",
51
+ "typescript": "^5.9.3"
42
52
  }
43
- }
53
+ }