froth-webdriverio-framework 4.0.27 → 4.0.29
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
|
+
expect().toFail(annotationMessage, "Error : ",error.message);
|
|
20
22
|
browser.testError = annotationMessage
|
|
21
23
|
await amendToBrowserstack(annotationMessage, "error");
|
|
22
24
|
}
|
|
@@ -26,6 +28,8 @@ 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
|
+
expect().toFail(annotationMessage, "Error : ",error.message);
|
|
32
|
+
|
|
29
33
|
await amendToBrowserstack(annotationMessage, "error");
|
|
30
34
|
// throw error;
|
|
31
35
|
}
|
|
@@ -51,12 +55,14 @@ async function assertAttributeValue(elementSelector, attributeName, expectedText
|
|
|
51
55
|
console.warn("Assertion failed:", error.message);
|
|
52
56
|
let annotationMessage = `Assertion failed. Expected text: ${expectedText}. ,${error.message}`;
|
|
53
57
|
browser.testError = annotationMessage
|
|
58
|
+
expect().toFail(annotationMessage, "Error : ",error.message);
|
|
54
59
|
await amendToBrowserstack(annotationMessage, "error");
|
|
55
60
|
}
|
|
56
61
|
} catch (error) {
|
|
57
62
|
console.error('Error occurred while verifying text:', error);
|
|
58
63
|
let annotationMessage = `Error occurred while asserting Attribute: ${error.message}.`;
|
|
59
64
|
browser.testError = annotationMessage
|
|
65
|
+
expect().toFail(annotationMessage, "Error : ",error.message);
|
|
60
66
|
await amendToBrowserstack(annotationMessage, "error");
|
|
61
67
|
}
|
|
62
68
|
|
|
@@ -68,7 +74,7 @@ async function amendToBrowserstack(annotationMessage, level) {
|
|
|
68
74
|
await driver.execute('browserstack_executor: {"action": "annotate", "arguments": {"data":"' + annotationMessage + '","level": "' + level + '"}}');
|
|
69
75
|
|
|
70
76
|
} catch (error) {
|
|
71
|
-
console.error('Error occurred while
|
|
77
|
+
console.error('Error occurred while annoting into BS', error);
|
|
72
78
|
throw error;
|
|
73
79
|
}
|
|
74
80
|
}
|
|
@@ -171,33 +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){
|
|
190
|
-
scriptresult = "FAILED"
|
|
191
|
-
// if (!resultdetails.comments.some(comment => typeof comment === 'string' && comment.includes(test.title)))
|
|
192
|
-
resultdetails.comments.push(`${test.title} - failed: ${error.message === undefined ? "Test failed" : error.message}`);
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
else if(error) {
|
|
196
|
-
console.error(`========= Failed or Error occured while executing the test: ${error.message === undefined ? "Test failed" : error.message}}`);
|
|
189
|
+
else if (!passed || error) {
|
|
197
190
|
scriptresult = "FAILED"
|
|
198
191
|
// if (!resultdetails.comments.some(comment => typeof comment === 'string' && comment.includes(test.title)))
|
|
199
|
-
|
|
192
|
+
console.log(`====> Failed or error while executing the test: ${error ? error.message : "Test failed"}`);
|
|
193
|
+
resultdetails.comments.push(`${test.title} - failed: ${error ? error.message : "Test failed"}`);
|
|
194
|
+
|
|
200
195
|
}
|
|
196
|
+
|
|
201
197
|
|
|
202
198
|
let scriptDetails = BUFFER.getItem("FROTHE_SUITE_DETAILS");
|
|
203
199
|
if (typeof scriptDetails === "string") {
|