froth-webdriverio-framework 2.0.22 → 2.0.25
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.
|
@@ -7,22 +7,23 @@ async function assertText(driver, elementSelector, expectedText) {
|
|
|
7
7
|
// Wait for the element to be visible
|
|
8
8
|
|
|
9
9
|
// Get the actual text from the element
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
// const element = await driver.$(elementSelector);
|
|
11
|
+
// console.log("actual text is:" + element)
|
|
12
|
+
const element = await driver.$(elementSelector)
|
|
13
|
+
// const actualText = await element.getText();
|
|
14
|
+
await expect(element).toHaveText(expectedText)
|
|
15
15
|
|
|
16
|
+
//console.log("actual text is:" + actualText)
|
|
16
17
|
|
|
17
18
|
// Compare the actual text with the expected text
|
|
18
19
|
if (actualText == expectedText) {
|
|
19
20
|
let annotationMessage = `Assertion pass. Actual text: ${actualText}, Expected text: ${expectedText}.`;
|
|
20
21
|
console.log(`Assertion pass. Actual text: ${actualText}, Expected text: ${expectedText}.`);
|
|
21
|
-
|
|
22
|
+
// await driver.execute(`browserstack_executor: {"action": "annotate", "arguments": {"data":"${annotationMessage}","level": "info"}}`);
|
|
22
23
|
} else {
|
|
23
24
|
let annotationMessage = `Assertion fail. Actual text: ${actualText}, Expected text: ${expectedText}.`;
|
|
24
25
|
console.log(`Assertion fail. Actual text: ${actualText}, Expected text: ${expectedText}.`);
|
|
25
|
-
|
|
26
|
+
// await driver.execute(`browserstack_executor: {"action": "annotate", "arguments": {"data":"${annotationMessage}","level": "info"}}`);
|
|
26
27
|
}
|
|
27
28
|
} catch (error) {
|
|
28
29
|
console.error('Error occurred while verifying text:', error);
|