froth-webdriverio-framework 4.0.68 → 4.0.69

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.
@@ -41,6 +41,7 @@ let scrollIntoView = null;
41
41
  let api = null;
42
42
 
43
43
  let selectDropDownValue = null;
44
+ let selectDropDownText = null;
44
45
 
45
46
  let acceptAlert = null;
46
47
  let dismissAlert = null;
@@ -100,6 +101,7 @@ api = require(basepath + '/apicall').callapi;
100
101
  validate = require(basepath + '/apicall').validate;
101
102
 
102
103
  selectDropDownValue = require(basepath + '/dropDown').select4mDropDownValue;
104
+ selectDropDownText= require(basepath + '/dropDown').select4mDropDownText;
103
105
 
104
106
  acceptAlert = require(basepath + '/alert.js').acceptalert;
105
107
  dismissAlert = require(basepath + '/alert.js').dismissalert;
@@ -136,6 +138,7 @@ module.exports = {
136
138
  api,
137
139
  validate,
138
140
  selectDropDownValue,
141
+ selectDropDownText,
139
142
  acceptAlert,
140
143
  dismissAlert,
141
144
  swipeLeft,
@@ -1,14 +1,26 @@
1
1
  async function acceptalert() {
2
2
 
3
3
  try {
4
- await browser.waitUntil(async () => {
5
- return await browser.isAlertOpen();
6
- }, {
7
- timeout: 5000,
8
- timeoutMsg: 'Expected alert to appear but it did not'
9
- });
4
+ let alertFound = false;
5
+ for (let i = 0; i < 6; i++) {
6
+ if (await browser.isAlertOpen()) {
7
+ alertFound = true;
8
+ break;
9
+ }
10
+ await browser.pause(10000); // wait for 10 seconds
11
+ }
12
+ if (!alertFound) {
13
+ console.log('Expected alert to appear but it did not');
14
+ return;
15
+ }
16
+ // await browser.waitUntil(async () => {
17
+ // return await browser.isAlertOpen();
18
+ // }, {
19
+ // timeout: 5000,
20
+ // timeoutMsg: 'Expected alert to appear but it did not'
21
+ // });
10
22
  await browser.acceptAlert();
11
-
23
+
12
24
  } catch (e) {
13
25
  console.log("error occured while accepting alert", e)
14
26
  }
@@ -10,6 +10,15 @@ async function select4mDropDownValue(elementSelector, selectOption) {
10
10
  }
11
11
  }
12
12
 
13
+ async function select4mDropDownText(elementSelector, visibleText) {
14
+ try {
15
+ await $(elementSelector).selectByVisibleText(visibleText);
16
+ } catch (error) {
17
+ console.error('Error occurred while selecting the option by text:', error);
18
+ let annotationMessage = `Error occurred while selecting the option by text: ${error.message}.`;
19
+ await amendToBrowserstack(annotationMessage, "error");
20
+ }
21
+ }
13
22
 
14
23
  async function amendToBrowserstack(annotationMessage, level) {
15
24
  try {
@@ -20,4 +29,4 @@ async function amendToBrowserstack(annotationMessage, level) {
20
29
  // throw error;
21
30
  }
22
31
  }
23
- module.exports = { select4mDropDownValue };
32
+ module.exports = { select4mDropDownValue,select4mDropDownText };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "4.0.68",
3
+ "version": "4.0.69",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",