froth-webdriverio-framework 7.0.97 → 7.0.99
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/froth_configs/commonhook.js +17 -2
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ const fs = require('fs');
|
|
|
10
10
|
const path = require('path');
|
|
11
11
|
const vm = require('vm');
|
|
12
12
|
|
|
13
|
+
let suiteDetails;
|
|
13
14
|
let executionUpdated = false;
|
|
14
15
|
const resultdetails = {
|
|
15
16
|
comments: [],
|
|
@@ -138,6 +139,7 @@ const commonHooks = {
|
|
|
138
139
|
|
|
139
140
|
beforeSession: async function (config, capabilities, specs) {
|
|
140
141
|
console.log('==== BEFORE SESSION ====');
|
|
142
|
+
suiteDetails = JSON.parse(BUFFER.getItem('FROTHE_SUITE_DETAILS'));
|
|
141
143
|
try {
|
|
142
144
|
/** 1️⃣ Validate test syntax */
|
|
143
145
|
// let syntaxFailed = false;
|
|
@@ -161,13 +163,17 @@ const commonHooks = {
|
|
|
161
163
|
|
|
162
164
|
/** 1️⃣ Validate test syntax */
|
|
163
165
|
let syntaxFailed = false;
|
|
164
|
-
|
|
166
|
+
let script;
|
|
165
167
|
for (const fileUrl of specs) {
|
|
166
168
|
const filePath = url.fileURLToPath(fileUrl);
|
|
167
169
|
const code = fs.readFileSync(filePath, 'utf8');
|
|
168
170
|
|
|
169
171
|
try {
|
|
170
172
|
new vm.Script(code, { filename: filePath });
|
|
173
|
+
script = suiteDetails.find(s => s.scriptName === filePath.replace('.js', ''));
|
|
174
|
+
console.log("Script Details:", script);
|
|
175
|
+
|
|
176
|
+
|
|
171
177
|
} catch (err) {
|
|
172
178
|
const { line, column } = await extractLineColumn(err);
|
|
173
179
|
|
|
@@ -180,8 +186,17 @@ const commonHooks = {
|
|
|
180
186
|
}
|
|
181
187
|
|
|
182
188
|
if (syntaxFailed) {
|
|
189
|
+
|
|
190
|
+
await exeDetails.updateScriptExecutionStatus(
|
|
191
|
+
BUFFER.getItem('ORGANISATION_DOMAIN_URL'),
|
|
192
|
+
BUFFER.getItem('FROTH_LOGIN_TOKEN'),
|
|
193
|
+
script.scriptId,
|
|
194
|
+
script.platform.toLowerCase(),
|
|
195
|
+
"FAILED"
|
|
196
|
+
);
|
|
183
197
|
await failExecution('Syntax validation failed');
|
|
184
198
|
}
|
|
199
|
+
|
|
185
200
|
/** 2️⃣ BrowserStack capability normalization */
|
|
186
201
|
|
|
187
202
|
if (process.env.PLATFORM === 'browserstack' || process.env.PLATFORM === 'browserstacklocal') {
|
|
@@ -285,7 +300,7 @@ const commonHooks = {
|
|
|
285
300
|
|
|
286
301
|
}
|
|
287
302
|
|
|
288
|
-
|
|
303
|
+
|
|
289
304
|
const script = suiteDetails.find(s => s.scriptName === fileName.replace('.js', ''));
|
|
290
305
|
console.log("Script Details:", script);
|
|
291
306
|
|