froth-webdriverio-framework 7.0.97 → 7.0.98
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 +15 -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
|
|
|
@@ -181,6 +187,13 @@ const commonHooks = {
|
|
|
181
187
|
|
|
182
188
|
if (syntaxFailed) {
|
|
183
189
|
await failExecution('Syntax validation failed');
|
|
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
|
+
);
|
|
184
197
|
}
|
|
185
198
|
/** 2️⃣ BrowserStack capability normalization */
|
|
186
199
|
|
|
@@ -285,7 +298,7 @@ const commonHooks = {
|
|
|
285
298
|
|
|
286
299
|
}
|
|
287
300
|
|
|
288
|
-
|
|
301
|
+
|
|
289
302
|
const script = suiteDetails.find(s => s.scriptName === fileName.replace('.js', ''));
|
|
290
303
|
console.log("Script Details:", script);
|
|
291
304
|
|