froth-webdriverio-framework 4.0.28 → 4.0.30
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Function to verify text in Android app
|
|
2
|
+
import { expect } from 'chai';
|
|
2
3
|
|
|
3
4
|
async function assertText(elementSelector, expectedText) {
|
|
4
5
|
|
|
@@ -17,6 +18,7 @@ async function assertText(elementSelector, expectedText) {
|
|
|
17
18
|
} catch (error) {
|
|
18
19
|
console.log(`Assertion failed. Expected text: ${expectedText}.`);
|
|
19
20
|
let annotationMessage = `Assertion failed. Expected text: ${expectedText}.`;
|
|
21
|
+
assert.fail(annotationMessage,"error: ",error.message);
|
|
20
22
|
browser.testError = annotationMessage
|
|
21
23
|
await amendToBrowserstack(annotationMessage, "error");
|
|
22
24
|
}
|
|
@@ -26,6 +28,7 @@ async function assertText(elementSelector, expectedText) {
|
|
|
26
28
|
console.error('Error occurred while verifying text:', error);
|
|
27
29
|
let annotationMessage = `Error occurred while verifying text: ${error.message}.`;
|
|
28
30
|
browser.testError = annotationMessage
|
|
31
|
+
assert.fail(annotationMessage,"error: ",error.message);
|
|
29
32
|
await amendToBrowserstack(annotationMessage, "error");
|
|
30
33
|
// throw error;
|
|
31
34
|
}
|
|
@@ -51,12 +54,14 @@ async function assertAttributeValue(elementSelector, attributeName, expectedText
|
|
|
51
54
|
console.warn("Assertion failed:", error.message);
|
|
52
55
|
let annotationMessage = `Assertion failed. Expected text: ${expectedText}. ,${error.message}`;
|
|
53
56
|
browser.testError = annotationMessage
|
|
57
|
+
assert.fail(annotationMessage,"error: ",error.message);
|
|
54
58
|
await amendToBrowserstack(annotationMessage, "error");
|
|
55
59
|
}
|
|
56
60
|
} catch (error) {
|
|
57
61
|
console.error('Error occurred while verifying text:', error);
|
|
58
62
|
let annotationMessage = `Error occurred while asserting Attribute: ${error.message}.`;
|
|
59
63
|
browser.testError = annotationMessage
|
|
64
|
+
assert.fail(annotationMessage,"error: ",error.message);
|
|
60
65
|
await amendToBrowserstack(annotationMessage, "error");
|
|
61
66
|
}
|
|
62
67
|
|
|
@@ -68,7 +73,7 @@ async function amendToBrowserstack(annotationMessage, level) {
|
|
|
68
73
|
await driver.execute('browserstack_executor: {"action": "annotate", "arguments": {"data":"' + annotationMessage + '","level": "' + level + '"}}');
|
|
69
74
|
|
|
70
75
|
} catch (error) {
|
|
71
|
-
console.error('Error occurred while
|
|
76
|
+
console.error('Error occurred while annoting into BS', error);
|
|
72
77
|
throw error;
|
|
73
78
|
}
|
|
74
79
|
}
|
|
@@ -171,34 +171,29 @@ const commonconfig = {
|
|
|
171
171
|
let scriptresult = "NOT RUN";
|
|
172
172
|
let localError = null;
|
|
173
173
|
|
|
174
|
-
if (browser.testError) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
if (passed
|
|
174
|
+
// if (browser.testError) {
|
|
175
|
+
// console.error("Test Error:", browser.testError);
|
|
176
|
+
// localError = browser.testError;
|
|
177
|
+
// resultdetails.comments.push(`${test.title} - failed: ${localError}`);
|
|
178
|
+
// browser.testError = null; // clear it
|
|
179
|
+
// scriptresult = "FAILED"
|
|
180
|
+
// passed = false; // Mark test as failed
|
|
181
|
+
// result = 1; // Update the result status
|
|
182
|
+
|
|
183
|
+
// // throw err; // causes test to fail after execution
|
|
184
|
+
// }
|
|
185
|
+
if (passed) {
|
|
186
186
|
scriptresult = "PASSED"
|
|
187
187
|
resultdetails.comments.push(`${test.title} - passed`);
|
|
188
188
|
}
|
|
189
|
-
else if (!passed) {
|
|
189
|
+
else if (!passed || error) {
|
|
190
190
|
scriptresult = "FAILED"
|
|
191
191
|
// if (!resultdetails.comments.some(comment => typeof comment === 'string' && comment.includes(test.title)))
|
|
192
|
-
console.log(
|
|
192
|
+
console.log(`====> Failed or error while executing the test: ${error ? error.message : "Test failed"}`);
|
|
193
193
|
resultdetails.comments.push(`${test.title} - failed: ${error ? error.message : "Test failed"}`);
|
|
194
194
|
|
|
195
195
|
}
|
|
196
|
-
|
|
197
|
-
console.error(`========= Failed or Error occured while executing the test: ${error.message === undefined ? "Test failed" : error.message}}`);
|
|
198
|
-
scriptresult = "FAILED"
|
|
199
|
-
// if (!resultdetails.comments.some(comment => typeof comment === 'string' && comment.includes(test.title)))
|
|
200
|
-
resultdetails.comments.push(`${test.title} - failed: ${error.message}`);
|
|
201
|
-
}
|
|
196
|
+
|
|
202
197
|
|
|
203
198
|
let scriptDetails = BUFFER.getItem("FROTHE_SUITE_DETAILS");
|
|
204
199
|
if (typeof scriptDetails === "string") {
|