froth-webdriverio-framework 2.0.6 → 2.0.8

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.
@@ -70,7 +70,7 @@ async function getExecuitonScriptDetails(frothUrl, token, execution_id, script_i
70
70
  });
71
71
  if (response.ok) {
72
72
  const data = await response.json();
73
- console.log(data)
73
+ // console.log(data)
74
74
  id = data[0].id;
75
75
  console.log("ID is :" + id)
76
76
  // console.log("json data :" + JSON.stringify(jsondata));
@@ -2,19 +2,32 @@
2
2
 
3
3
  async function assertText(driver, elementSelector, expectedText) {
4
4
 
5
- // Wait for the element to be visible
6
- await driver.waitUntil(async () => {
5
+ try {
6
+ console.log("inside the assert text function")
7
+ // Wait for the element to be visible
8
+ await driver.waitUntil(async () => {
9
+ const element = await driver.$(elementSelector);
10
+ return await element.isDisplayed();
11
+ }, { timeout: 30000 });
12
+
13
+ // Get the actual text from the element
7
14
  const element = await driver.$(elementSelector);
8
- // return await element.isDisplayed();
9
- }, { timeout: 30000 });
10
-
11
- // Get the actual text from the element
12
- const actualText = await element.getText();
13
-
14
- console.log('Actual text:', actualText, 'Expected text:', expectedText);
15
-
16
- await expect(actualText).toBe(expectedText, `Expected text to be "${expectedText}", but found "${actualText}"`);
17
-
15
+ const actualText = await element.getText();
16
+
17
+ // Compare the actual text with the expected text
18
+ if (actualText == expectedText) {
19
+ console.log('Assertion passed. Actual text:', actualText, 'Expected text:', expectedText);
20
+ driver.execute('browserstack_executor: {"action": "annotate", "arguments": {"data":"Assertion passed. Actual text:'+actualText+'",Expected text:"'+expectedText+'","level": "info"}}');
21
+ return true;
22
+ } else {
23
+ driver.execute('browserstack_executor: {"action": "annotate", "arguments": {"data":"Assertion failed. Actual text:'+actualText+'",Expected text:"'+expectedText+'","level": "error"}}');
24
+ console.error('Assertion failed. Actual text:', actualText, 'Expected text:', expectedText);
25
+ throw error;
26
+ }
27
+ } catch (error) {
28
+ console.error('Error occurred while verifying text:', error);
29
+ throw error;
30
+ }
18
31
  }
19
32
 
20
33
  module.exports = assertText;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",