froth-webdriverio-framework 2.0.40 → 2.0.42

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.
@@ -9,6 +9,7 @@ let scrollDownToView = null;
9
9
  let scrollRightToView = null;
10
10
 
11
11
  let clickIfVisible = null;
12
+ let clickById = null;
12
13
 
13
14
  let assertText = null;
14
15
  let randomtext = null;
@@ -43,7 +44,8 @@ scrollDownToView = require(basepath + '/scroll').scrollDownToView;
43
44
  scrollRightToView = require(basepath + '/scroll').scrollRightToView;
44
45
  scrollIntoView = require(basepath + '/scroll').scrollIntoView;
45
46
 
46
- clickIfVisible = require(basepath + "/clickIfVisible");
47
+ clickIfVisible = require(basepath + "/click").clickIfVisible;
48
+ clickByIdWithExecute = require(basepath + "/click").clickByIdWithExecute;
47
49
 
48
50
  assertText = require(basepath + '/assert').assertText;
49
51
  assertAttributeValue = require(basepath + '/assert').assertAttributeValue;
@@ -73,6 +75,7 @@ module.exports = {
73
75
  scrollDownToView,
74
76
  scrollRightToView,
75
77
  clickIfVisible,
78
+ clickByIdWithExecute,
76
79
  assertText,
77
80
  assertAttributeValue,
78
81
  randomtext,
@@ -12,12 +12,23 @@ async function clickIfVisible(elementSelector) {
12
12
  const element = await $(elementSelector);
13
13
  await element.click();
14
14
  console.log("Element is clicked successfully.");
15
- return ;
16
- }
15
+ return;
16
+ }
17
17
  }, { timeout: 30000 });
18
18
  } catch (error) {
19
19
  console.error("Element not found or not visible within 30 seconds");
20
20
  }
21
21
  }
22
22
 
23
- module.exports = clickIfVisible;
23
+
24
+ async function clickByIdWithExecute(elementid) {
25
+ try {
26
+ await browser.execute(() => {
27
+ document.getElementById(elementid).click();
28
+ });
29
+ } catch (error) {
30
+ console.error("Failed to click on element with id:", elementid);
31
+ }
32
+ }
33
+
34
+ module.exports = { clickIfVisible, clickByIdWithExecute };
@@ -1,9 +1,5 @@
1
1
  const deepmerge = require('deepmerge')
2
2
  const commonmobileconfig = require('./common.mobile.conf');
3
- console.log("device name in android:", process.env.DEVICENAME);
4
- console.log("BUILD_NUMBER:", process.env.BUILD_NUMBER);
5
- console.log("device name in BROWSERSTACK_APP_PATH:", process.env.BROWSERSTACK_APP_PATH);
6
-
7
3
  const androidConfig = deepmerge.all([commonmobileconfig, {
8
4
  services: [
9
5
  [
@@ -23,16 +19,19 @@ const androidConfig = deepmerge.all([commonmobileconfig, {
23
19
 
24
20
  capabilities: [{
25
21
  'bstack:options': {
22
+ projectName: process.env.PROJECTNAME || "roboticodigital",
23
+
26
24
  deviceName: process.env.DEVICENAME || 'Samsung Galaxy S23 Ultra',
27
25
  platformVersion: process.env.OSVERSION || '13.0',
28
26
  platformName: 'android',
29
27
  interactiveDebugging: true,
30
28
  buildName: process.env.BROWSERSTACK_BUILD_NAME || 'Android_Build',
31
- enableCameraImageInjection: "true",
32
29
  networkLogs: "true",
33
30
  debug: "true",
34
31
  appProfiling: "true",
35
- deviceOrientation: process.env.DEVICENAME.toLowerCase().includes('tab')? 'landscape': 'portrait',
32
+ enableCameraImageInjection: "true",
33
+
34
+ deviceOrientation: process.env.DEVICENAME.toLowerCase().includes('tab') ? 'landscape' : 'portrait',
36
35
  }
37
36
  }],
38
37
  before: function (capabilities, specs) {
@@ -41,16 +40,7 @@ const androidConfig = deepmerge.all([commonmobileconfig, {
41
40
 
42
41
  }]);
43
42
 
44
- // console.log("Merged Android Config:", JSON.stringify(androidConfig, null, 2));
45
43
 
46
- // androidConfig.capabilities.forEach(function (caps) {
47
- // for (var i in androidConfig.commonCapabilities) {
48
- // console.log("i:", i);
49
- // console.log("caps[i]:", caps[i]);
50
- // console.log("androidConfig.commonCapabilities[i]:", androidConfig.commonCapabilities[i]);
51
- // caps[i] = caps[i] || androidConfig.commonCapabilities[i];
52
- // }
53
- // });
54
44
 
55
45
  module.exports = androidConfig;
56
46
 
@@ -0,0 +1,75 @@
1
+ const deepmerge = require('deepmerge')
2
+ const commonmobileconfig = require('./common.mobile.conf');
3
+ const apiconfig = deepmerge.all([commonmobileconfig, {
4
+
5
+
6
+ services: [
7
+ ['browserstack', {
8
+
9
+ browserstackLocal: process.env.BROWSERSTACK_LOCAL || false,
10
+ opts: {
11
+ forcelocal: false,
12
+ // localIdentifier: "webdriverio-appium"
13
+ },
14
+
15
+ }]
16
+ ],
17
+ // ====================
18
+ // Capabilities
19
+ // ====================
20
+ capabilities: [
21
+ {
22
+ 'bstack:options': {
23
+ projectName: process.env.PROJECTNAME || "roboticodigital",
24
+
25
+ browserName: process.env.BROWSERSTACK_BROWSER || 'chrome', // Choose the browser you want to test
26
+ browserVersion: process.env.BROWSERSTACK_BROWSER_VERSION || '129', // Specify the browser version
27
+ os: 'Windows', // Specify the operating system
28
+ os_version: '10', // Specify the operating system version
29
+ interactiveDebugging: true,
30
+ buildName: process.env.BROWSERSTACK_BUILD_NAME || 'WEB_Build',
31
+ networkLogs: "true",
32
+ debug: "true",
33
+ }
34
+ },
35
+ // Add more capabilities for other browsers or devices as needed
36
+ ],
37
+
38
+ // ====================
39
+ // Test Configurations
40
+ // ====================
41
+ // logLevel: 'info', // Set the log level
42
+ // bail: 0, // Set to 1 to stop the test suite after the first test failure
43
+ // baseUrl: '', // Specify the base URL of your application
44
+ // waitforTimeout: 90000, // Set the timeout for all waitFor* commands
45
+ // connectionRetryTimeout: 90000, // Set the timeout in milliseconds for test retries
46
+ // connectionRetryCount: 2, // Set the number of times to retry the entire spec file
47
+
48
+ // ====================
49
+ // Framework
50
+ // ====================
51
+ // framework: 'mocha', // Use the Mocha framework
52
+ // reporters: ['spec'
53
+
54
+ // ], // Use the spec reporter
55
+
56
+ // ====================
57
+ // Hooks
58
+ // ====================
59
+ before: function (capabilities, specs) {
60
+ browser.maximizeWindow()
61
+ process.env.BS_SESSION_TYPE = "automate";
62
+ },
63
+
64
+
65
+
66
+ // // ====================
67
+ // // Mocha Options
68
+ // // ====================
69
+ // mochaOpts: {
70
+ // ui: 'bdd', // Set the test interface to BDD
71
+ // timeout: 90000, // Set the timeout for test cases in milliseconds
72
+ // },
73
+ }]);
74
+
75
+ module.exports = apiconfig;
@@ -1,6 +1,6 @@
1
1
  const deepmerge = require('deepmerge')
2
- const commonconfig = require('./commonconfig');
3
- const apiconfig = deepmerge.all([commonconfig, {
2
+ const commonmobileconfig = require('./common.mobile.conf');
3
+ const apiconfig = deepmerge.all([commonmobileconfig, {
4
4
 
5
5
  // ====================
6
6
  // Capabilities
@@ -12,57 +12,12 @@ const apiconfig = deepmerge.all([commonconfig, {
12
12
  }],
13
13
  runner: 'local',
14
14
 
15
- // ====================
16
- // Test Configurations
17
- // ====================
18
- logLevel: 'info', // Set the log level
19
- bail: 0, // Set to 1 to stop the test suite after the first test failure
20
- baseUrl: '', // Specify the base URL of your application
21
- waitforTimeout: 60000, // Set the timeout for all waitFor* commands
22
- connectionRetryTimeout: 90000, // Set the timeout in milliseconds for test retries
23
- connectionRetryCount: 3, // Set the number of times to retry the entire spec file
24
-
25
- // ====================
26
- // Framework
27
- // ====================
28
- framework: 'mocha', // Use the Mocha framework
29
- reporters: ['spec'], // Use the spec reporter
30
- // reporterOptions: {
31
- // allure: {
32
- // outputDir: 'allure-results',
33
- // disableWebdriverStepsReporting: true,
34
- // disableWebdriverScreenshotsReporting: false,
35
- // }
36
- //},
37
- // ====================
38
- // Hooks
39
- // ====================
40
15
  before: function (capabilities, specs) {
41
- // Code to run before the first test
42
-
43
-
44
- },
45
- after: function (capabilities, specs) {
46
- // Code to run to take screenshots
47
-
48
-
49
-
50
- },
51
-
52
- // ====================
53
- // BrowserStack Options
54
- // ====================
55
- browserstackOpts: {
56
- // BrowserStack-specific options
16
+ // browser.maximizeWindow()
17
+ process.env.BS_SESSION_TYPE = "app-automate";
57
18
  },
19
+
58
20
 
59
- // ====================
60
- // Mocha Options
61
- // ====================
62
- mochaOpts: {
63
- ui: 'bdd', // Set the test interface to BDD
64
- timeout: 60000, // Set the timeout for test cases in milliseconds
65
- },
66
21
  }]);
67
22
 
68
23
  module.exports = apiconfig;
File without changes
@@ -3,8 +3,13 @@ const commonconfig = require('./commonconfig');
3
3
 
4
4
  const commonmobconfig = deepmerge.all([commonconfig, {
5
5
 
6
- user: process.env.BROWSERSTACK_USERNAME,
7
- key: Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8'),
6
+ ...(process.env.BROWSERSTACK_USERNAME && { user: process.env.BROWSERSTACK_USERNAME }),
7
+ ...(process.env.BROWSERSTACK_ACCESS_KEY && {
8
+ key: Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8')
9
+ }),
10
+
11
+ // user: process.env.BROWSERSTACK_USERNAME,
12
+ // key: Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8'),
8
13
 
9
14
  logLevel: 'info',
10
15
  coloredLogs: true,
@@ -26,15 +31,15 @@ const commonmobconfig = deepmerge.all([commonconfig, {
26
31
  reporters: [
27
32
  'spec'
28
33
  ],
29
- commonCapabilities: {
30
- 'bstack:options': {
31
- projectName: process.env.PROJECTNAME || "roboticodigital",
32
- // buildName: "Automation Build",
33
- sessionName: 'Automation test session',
34
- debug: true,
35
- networkLogs: true
36
- }
37
- },
34
+ // commonCapabilities: {
35
+ // 'bstack:options': {
36
+ // projectName: process.env.PROJECTNAME || "roboticodigital",
37
+ // // buildName: "Automation Build",
38
+ // sessionName: 'Automation test session',
39
+ // debug: true,
40
+ // networkLogs: true
41
+ // }
42
+ // },
38
43
 
39
44
 
40
45
  }]);
@@ -6,12 +6,12 @@ const iosconfig = deepmerge.all([commonmobileconfig, {
6
6
  [
7
7
  'browserstack',
8
8
  {
9
- // testObservability: true,
10
- // buildIdentifier: `#${process.env.BUILD_NUMBER}`,
9
+ // testObservability: true,
10
+ // buildIdentifier: `#${process.env.BUILD_NUMBER}`,
11
11
  browserstackLocal: process.env.BROWSERSTACK_LOCAL || false,
12
12
  opts: {
13
13
  forcelocal: false,
14
- // localIdentifier: "webdriverio-appium"
14
+ // localIdentifier: "webdriverio-appium"
15
15
  },
16
16
  app: process.env.BROWSERSTACK_APP_PATH || 'bs://d6588d0899a2ac5c485d4784af9ad28d06b98c44'
17
17
  }
@@ -20,12 +20,16 @@ const iosconfig = deepmerge.all([commonmobileconfig, {
20
20
 
21
21
  capabilities: [{
22
22
  'bstack:options': {
23
+ projectName: process.env.PROJECTNAME || "roboticodigital",
23
24
  deviceName: process.env.DEVICENAME || "iPhone 15 Pro Max",
24
25
  osVersion: process.env.OSVERSION || "17",
25
26
  platformName: 'iOS',
26
27
  interactiveDebugging: true,
27
28
  buildName: process.env.BROWSERSTACK_BUILD_NAME || 'IOS_Build',
28
- enableCameraImageInjection : "true",
29
+ networkLogs: "true",
30
+ debug: "true",
31
+ appProfiling: "true", enableCameraImageInjection: "true",
32
+ deviceOrientation: process.env.DEVICENAME.toLowerCase().includes('tab') ? 'landscape' : 'portrait',
29
33
 
30
34
  }
31
35
  }],
@@ -1,28 +1,17 @@
1
1
  const deepmerge = require('deepmerge')
2
- const commonconfig = require('./commonconfig');
2
+ const commonmobileconfig = require('./common.mobile.conf');
3
+ const webbsconfig = deepmerge.all([commonmobileconfig, {
3
4
 
4
- const webbsconfig = deepmerge.all([commonconfig, {
5
- // ====================
6
- // BrowserStack Configuration
7
- // ====================
8
- user: process.env.BROWSERSTACK_USERNAME || 'prabathkumar_qavxGX',
9
- key: Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8') || 'RvqEi62rhwa5QwGJtweZ',
10
- browserstackLocal: false, // Set to true if using BrowserStack Local Testing
11
- opts: { forceLocal: true },
12
- // ====================
13
- // Specify Test Files
14
- // ====================
15
5
 
16
6
  services: [
17
7
  ['browserstack', {
18
- // testObservability: true,
19
- // testObservabilityOptions: {
20
- // // user: 'prabathkumar_qavxGX' || process.env.BROWSERSTACK_USERNAME,
21
- // // key: 'RvqEi62rhwa5QwGJtweZ' || process.env.BROWSERSTACK_ACCESS_KEY,
22
- // projectName: process.env.PROJECTNAME || "roboticodigital",
23
- // // buildName: 'WEB BUILD',
24
- // buildTag: 'WEB BUILD',
25
- // },
8
+
9
+ browserstackLocal: process.env.BROWSERSTACK_LOCAL || false,
10
+ opts: {
11
+ forcelocal: false,
12
+ // localIdentifier: "webdriverio-appium"
13
+ },
14
+
26
15
  }]
27
16
  ],
28
17
  // ====================
@@ -30,15 +19,18 @@ const webbsconfig = deepmerge.all([commonconfig, {
30
19
  // ====================
31
20
  capabilities: [
32
21
  {
33
- browserName: process.env.BROWSERSTACK_BROWSER || 'chrome', // Choose the browser you want to test
34
- browserVersion: process.env.BROWSERSTACK_BROWSER_VERSION || '129', // Specify the browser version
35
- os: 'Windows', // Specify the operating system
36
- os_version: '10', // Specify the operating system version
37
- resolution: '1920x1080', // Specify the screen resolution
38
- 'browserstack.networkLogs': true, // Enable network logs
39
- 'browserstack.video': true, // Enable video recording
40
- buildName: process.env.BROWSERSTACK_BUILD_NAME || 'default-build-name',
22
+ 'bstack:options': {
23
+ projectName: process.env.PROJECTNAME || "roboticodigital",
41
24
 
25
+ browserName: process.env.BROWSERSTACK_BROWSER || 'chrome', // Choose the browser you want to test
26
+ browserVersion: process.env.BROWSERSTACK_BROWSER_VERSION || '129', // Specify the browser version
27
+ os: 'Windows', // Specify the operating system
28
+ os_version: '10', // Specify the operating system version
29
+ interactiveDebugging: true,
30
+ buildName: process.env.BROWSERSTACK_BUILD_NAME || 'WEB_Build',
31
+ networkLogs: "true",
32
+ debug: "true",
33
+ }
42
34
  },
43
35
  // Add more capabilities for other browsers or devices as needed
44
36
  ],
@@ -46,44 +38,38 @@ const webbsconfig = deepmerge.all([commonconfig, {
46
38
  // ====================
47
39
  // Test Configurations
48
40
  // ====================
49
- logLevel: 'info', // Set the log level
50
- bail: 0, // Set to 1 to stop the test suite after the first test failure
51
- baseUrl: '', // Specify the base URL of your application
52
- waitforTimeout: 90000, // Set the timeout for all waitFor* commands
53
- connectionRetryTimeout: 90000, // Set the timeout in milliseconds for test retries
54
- connectionRetryCount: 2, // Set the number of times to retry the entire spec file
41
+ // logLevel: 'info', // Set the log level
42
+ // bail: 0, // Set to 1 to stop the test suite after the first test failure
43
+ // baseUrl: '', // Specify the base URL of your application
44
+ // waitforTimeout: 90000, // Set the timeout for all waitFor* commands
45
+ // connectionRetryTimeout: 90000, // Set the timeout in milliseconds for test retries
46
+ // connectionRetryCount: 2, // Set the number of times to retry the entire spec file
55
47
 
56
48
  // ====================
57
49
  // Framework
58
50
  // ====================
59
- framework: 'mocha', // Use the Mocha framework
60
- reporters: ['spec'
51
+ // framework: 'mocha', // Use the Mocha framework
52
+ // reporters: ['spec'
61
53
 
62
- ], // Use the spec reporter
54
+ // ], // Use the spec reporter
63
55
 
64
56
  // ====================
65
57
  // Hooks
66
58
  // ====================
67
59
  before: function (capabilities, specs) {
68
60
  browser.maximizeWindow()
69
- process.env.BS_SESSION_TYPE="automate";
61
+ process.env.BS_SESSION_TYPE = "automate";
70
62
  },
71
-
72
63
 
73
- // ====================
74
- // BrowserStack Options
75
- // ====================
76
- browserstackOpts: {
77
- // BrowserStack-specific options
78
- },
79
64
 
80
- // ====================
81
- // Mocha Options
82
- // ====================
83
- mochaOpts: {
84
- ui: 'bdd', // Set the test interface to BDD
85
- timeout: 90000, // Set the timeout for test cases in milliseconds
86
- },
65
+
66
+ // // ====================
67
+ // // Mocha Options
68
+ // // ====================
69
+ // mochaOpts: {
70
+ // ui: 'bdd', // Set the test interface to BDD
71
+ // timeout: 90000, // Set the timeout for test cases in milliseconds
72
+ // },
87
73
  }]);
88
74
 
89
75
  module.exports = webbsconfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "2.0.40",
3
+ "version": "2.0.42",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",