froth-webdriverio-framework 3.0.87 → 3.0.89

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.
@@ -0,0 +1,23 @@
1
+ name: npm_package
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ release:
8
+ name: release
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Checkout code
12
+ uses: actions/checkout@v2
13
+ - name: Setup Node.js
14
+ uses: actions/setup-node@v2
15
+ with:
16
+ node-version: '12.x'
17
+ registry-url: https://registry.npmjs.org
18
+
19
+ - name: Publish to npm
20
+ run: npm publish --access public
21
+ env:
22
+ NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
23
+
@@ -5,13 +5,12 @@ async function getBSBuildDetails(sessiontype, bs_username, bs_pwd) {
5
5
  console.log("sessiontype:" + sessiontype)
6
6
  const username = bs_username;
7
7
  const accessKey = bs_pwd;
8
- console.log("accessKey:" + accessKey)
9
8
  const basicAuth = btoa(`${username}:${accessKey}`);
10
9
 
11
10
  let hashed_id = null;
12
11
 
13
12
  // const sessionid= BUFFER.getItem("SESSION_ID");
14
- console.log("Browsersatck build name :" + process.env.BROWSERSTACK_BUILD_NAME)
13
+
15
14
  const url = `https://api.browserstack.com/${sessiontype}/builds.json?name=${process.env.BROWSERSTACK_BUILD_NAME}`;
16
15
 
17
16
  console.log("url:" + url)
@@ -36,7 +35,6 @@ async function getBSBuildDetails(sessiontype, bs_username, bs_pwd) {
36
35
  } else {
37
36
  const errorText = await response.text();
38
37
  console.error(`Data fetch failed response in getBSBuildDetails:${response.status}`);
39
- // console.error(`Data fetch failed response in getBSBuildDetails:${errorText}`);
40
38
  // throw new Error(`HTTP error! status: ${response.status}`);
41
39
  }
42
40
 
@@ -54,9 +52,7 @@ async function getBSSessionDetails(sessiontype, bs_username, bs_pwd) {
54
52
  try {
55
53
  // const sessionId = sessionIdd;
56
54
  const username = bs_username;
57
- // const accessKey = Buffer.from(bs_pwd, 'base64').toString('utf-8');
58
- const accessKey = bs_pwd;
59
-
55
+ const accessKey = Buffer.from(bs_pwd, 'base64').toString('utf-8');
60
56
  const basicAuth = btoa(`${username}:${accessKey}`);
61
57
 
62
58
  const hash_id = await getBSBuildDetails(sessiontype, bs_username, accessKey)
@@ -81,7 +77,7 @@ async function getBSSessionDetails(sessiontype, bs_username, bs_pwd) {
81
77
  const duration = data[0].automation_session.duration;
82
78
  BUFFER.setItem("REPORT_URL", publicUrl)
83
79
  BUFFER.setItem("FROTH_TOTAL_DURATION", duration)
84
- console.log("public url:" + publicUrl)
80
+
85
81
  //return jsondata;
86
82
  } else if (response.status === 401) { //
87
83
  console.log("Unauthorized, token expired")
@@ -12,8 +12,7 @@ let swipeRight = null;
12
12
  let swipeLeft = null;
13
13
  let swipeUp = null;
14
14
  let swipeDown = null;
15
- let swipetoFit = null;
16
- let swipeWithCoordinates = null;
15
+
17
16
 
18
17
  let clickIfVisible = null;
19
18
 
@@ -41,7 +40,7 @@ let dismissalert = null;
41
40
 
42
41
  let generateJWT=null;
43
42
 
44
- if (process.env.LOCATION ==null || process.env.LOCATION == 'local') {
43
+ if (process.env.LOCATION == 'local') {
45
44
  basepath = ".";
46
45
  } else {
47
46
  basepath = "froth-webdriverio-framework/commonMethods";
@@ -59,8 +58,6 @@ swipeDown = require(basepath + '/swipe').swipedown;
59
58
  swipeLeft = require(basepath + '/swipe').swipeleft;
60
59
  swipeRight = require(basepath + '/swipe').swiperight;
61
60
  swipeUp = require(basepath + '/swipe').swipeup;
62
- swipetoFit= require(basepath + '/swipe').swipetofit;
63
- swipeWithCoordinates = require(basepath + '/swipe').swipewithcoordinates;
64
61
 
65
62
  clickIfVisible = require(basepath + "/click").clickIfVisible;
66
63
  clickByIdWithExecute = require(basepath + "/click").clickByIdWithExecute;
@@ -122,7 +119,5 @@ module.exports = {
122
119
  swipeRight,
123
120
  swipeDown,
124
121
  swipeUp,
125
- swipetoFit,
126
- swipeWithCoordinates,
127
122
  generateJWT
128
123
  };
@@ -20,29 +20,6 @@ async function clickIfVisible(elementSelector) {
20
20
  }
21
21
  }
22
22
 
23
- async function dobubleClick(elementSelector) {
24
- try {
25
- let isDisplayed;
26
- // Wait for the element to be visible
27
- await driver.waitUntil(async () => {
28
- console.log("Waiting for element to be visible");
29
- const element = await $(elementSelector);
30
- isDisplayed = await element.isDisplayed();
31
- console.log("Element is displayed:", isDisplayed);
32
- if (isDisplayed) {
33
- // Get the actual text from the element
34
- const element = await $(elementSelector);
35
- await element.doubleClick();
36
- console.log("Element is double clicked successfully.");
37
- return;
38
- }
39
- }, { timeout: 30000 });
40
- } catch (error) {
41
- console.error("Element not found or not visible within 30 seconds");
42
- }
43
- }
44
-
45
-
46
23
 
47
24
  async function clickByIdWithExecute(elementid) {
48
25
  try {
@@ -54,7 +54,7 @@ function main() {
54
54
  iat: currentTimestamp, // Issued at
55
55
  exp: currentTimestamp + 200, // Expiry time: 30 seconds from issuance
56
56
  user_agent: {
57
- id: "janga.reddy@ytl.com"
57
+ id: "janga.reddy@ytlcomms.my"
58
58
  }
59
59
  };
60
60
 
@@ -0,0 +1,59 @@
1
+ async function swipeleft(selector, xoffset, speedinsec) {
2
+ try {
3
+ console.log('Swiping left');
4
+
5
+ if (xoffset == null) {
6
+ driver.swipeLeft(selector, speedinsec);
7
+ } else {
8
+ driver.swipeLeft(selector, xoffset, speedinsec);
9
+ }
10
+ } catch (error) {
11
+ console.error(error.message);
12
+ }
13
+
14
+ }
15
+
16
+ async function swiperight(selector, xoffset, speedinsec) {
17
+ try {
18
+ console.log('Swiping right');
19
+
20
+ if (xoffset == null) {
21
+ driver.swipeRight(selector, speedinsec);
22
+ } else {
23
+ driver.swipeRight(selector, xoffset, speedinsec);
24
+ }
25
+ } catch (error) {
26
+ console.error(error.message);
27
+ }
28
+
29
+ }
30
+
31
+ async function swipeup(selector, yoffset, speedinsec) {
32
+ try {
33
+ console.log('Swiping up');
34
+
35
+ if (yoffset == null) {
36
+ driver.swipeUp(selector, speedinsec);
37
+ } else {
38
+ driver.swipeUp(selector, yoffset, speedinsec);
39
+ }
40
+ } catch (error) {
41
+ console.error(error.message);
42
+ }
43
+ }
44
+
45
+ async function swipedown(selector, yoffset, speedinsec) {
46
+ try {
47
+ console.log('Swiping down');
48
+
49
+ if (yoffset == null) {
50
+ driver.swipeDown(selector, speedinsec);
51
+ } else {
52
+ driver.swipeDown(selector, yoffset, speedinsec);
53
+ }
54
+ } catch (error) {
55
+ console.error(error.message);
56
+ }
57
+ }
58
+
59
+ module.exports = { swipeleft, swipedown, swiperight, swipeup };
@@ -0,0 +1,49 @@
1
+ const deepmerge = require('deepmerge')
2
+ process.env.BROWSERSTACK = true;
3
+ const commonmobileconfig = require('./common.mobile.conf');
4
+
5
+ const androidConfig = deepmerge.all([commonmobileconfig, {
6
+ services: [
7
+ [
8
+ 'browserstack',
9
+ {
10
+ // testObservability: true,
11
+ // buildName: "ANDROID BUILD",
12
+ // buildIdentifier: "ANDROID BUILD_" + process.env.BUILD_NUMBER,
13
+ browserstackLocal: process.env.BROWSERSTACK_LOCAL || false,
14
+ opts: {
15
+ forcelocal: false
16
+ },
17
+ app: process.env.BROWSERSTACK_APP_PATH
18
+ }
19
+ ]
20
+ ],
21
+
22
+ capabilities: [{
23
+ 'bstack:options': {
24
+ projectName: process.env.PROJECTNAME || "roboticodigital",
25
+
26
+ deviceName: process.env.DEVICENAME || 'Samsung Galaxy S23 Ultra',
27
+ platformVersion: process.env.OSVERSION || '13.0',
28
+ platformName: 'android',
29
+ interactiveDebugging: true,
30
+ buildName: process.env.BROWSERSTACK_BUILD_NAME || 'Android_Build',
31
+ networkLogs: "true",
32
+ debug: "true",
33
+ appProfiling: "true",
34
+ //enableCameraImageInjection: true,
35
+ // enableCameraVideoInjection: true,
36
+ deviceOrientation: process.env.DEVICENAME.toLowerCase().includes('tab') ? 'landscape' : 'portrait',
37
+ }
38
+ }],
39
+ before: function (capabilities, specs) {
40
+ process.env.BS_SESSION_TYPE = "app-automate";
41
+ },
42
+
43
+ }]);
44
+
45
+
46
+
47
+ module.exports = androidConfig;
48
+
49
+
@@ -0,0 +1,76 @@
1
+ const deepmerge = require('deepmerge')
2
+ const commonmobileconfig = require('./common.mobile.conf');
3
+
4
+ const apiconfig = deepmerge.all([commonmobileconfig, {
5
+
6
+
7
+ services: [
8
+ ['browserstack', {
9
+
10
+ browserstackLocal: process.env.BROWSERSTACK_LOCAL || false,
11
+ opts: {
12
+ forcelocal: false,
13
+ // localIdentifier: "webdriverio-appium"
14
+ },
15
+
16
+ }]
17
+ ],
18
+ // ====================
19
+ // Capabilities
20
+ // ====================
21
+ capabilities: [
22
+ {
23
+ 'bstack:options': {
24
+ projectName: process.env.PROJECTNAME || "roboticodigital",
25
+
26
+ browserName: process.env.BROWSERSTACK_BROWSER || 'chrome', // Choose the browser you want to test
27
+ browserVersion: process.env.BROWSERSTACK_BROWSER_VERSION || '129', // Specify the browser version
28
+ os: 'Windows', // Specify the operating system
29
+ os_version: '10', // Specify the operating system version
30
+ interactiveDebugging: true,
31
+ buildName: process.env.BROWSERSTACK_BUILD_NAME || 'WEB_Build',
32
+ networkLogs: "true",
33
+ debug: "true",
34
+ }
35
+ },
36
+ // Add more capabilities for other browsers or devices as needed
37
+ ],
38
+
39
+ // ====================
40
+ // Test Configurations
41
+ // ====================
42
+ // logLevel: 'info', // Set the log level
43
+ // bail: 0, // Set to 1 to stop the test suite after the first test failure
44
+ // baseUrl: '', // Specify the base URL of your application
45
+ // waitforTimeout: 90000, // Set the timeout for all waitFor* commands
46
+ // connectionRetryTimeout: 90000, // Set the timeout in milliseconds for test retries
47
+ // connectionRetryCount: 2, // Set the number of times to retry the entire spec file
48
+
49
+ // ====================
50
+ // Framework
51
+ // ====================
52
+ // framework: 'mocha', // Use the Mocha framework
53
+ // reporters: ['spec'
54
+
55
+ // ], // Use the spec reporter
56
+
57
+ // ====================
58
+ // Hooks
59
+ // ====================
60
+ before: function (capabilities, specs) {
61
+ browser.maximizeWindow()
62
+ process.env.BS_SESSION_TYPE = "automate";
63
+ },
64
+
65
+
66
+
67
+ // // ====================
68
+ // // Mocha Options
69
+ // // ====================
70
+ // mochaOpts: {
71
+ // ui: 'bdd', // Set the test interface to BDD
72
+ // timeout: 90000, // Set the timeout for test cases in milliseconds
73
+ // },
74
+ }]);
75
+
76
+ module.exports = apiconfig;
@@ -0,0 +1,77 @@
1
+ const deepmerge = require('deepmerge')
2
+ process.env.BROWSERSTACK = true;
3
+ const commonmobileconfig = require('./common.mobile.conf');
4
+
5
+ const apiconfig = deepmerge.all([commonmobileconfig, {
6
+
7
+
8
+ services: [
9
+ ['browserstack', {
10
+
11
+ browserstackLocal: process.env.BROWSERSTACK_LOCAL || false,
12
+ opts: {
13
+ forcelocal: false,
14
+ // localIdentifier: "webdriverio-appium"
15
+ },
16
+
17
+ }]
18
+ ],
19
+ // ====================
20
+ // Capabilities
21
+ // ====================
22
+ capabilities: [
23
+ {
24
+ 'bstack:options': {
25
+ projectName: process.env.PROJECTNAME || "roboticodigital",
26
+
27
+ browserName: 'chrome', // Choose the browser you want to test
28
+ // browserVersion: '129', // Specify the browser version
29
+ os: 'Windows', // Specify the operating system
30
+ // os_version: '10', // Specify the operating system version
31
+ interactiveDebugging: true,
32
+ buildName: process.env.BROWSERSTACK_BUILD_NAME || 'WEB_Build',
33
+ networkLogs: "true",
34
+ debug: "true",
35
+ }
36
+ },
37
+ // Add more capabilities for other browsers or devices as needed
38
+ ],
39
+
40
+ // ====================
41
+ // Test Configurations
42
+ // ====================
43
+ // logLevel: 'info', // Set the log level
44
+ // bail: 0, // Set to 1 to stop the test suite after the first test failure
45
+ // baseUrl: '', // Specify the base URL of your application
46
+ // waitforTimeout: 90000, // Set the timeout for all waitFor* commands
47
+ // connectionRetryTimeout: 90000, // Set the timeout in milliseconds for test retries
48
+ // connectionRetryCount: 2, // Set the number of times to retry the entire spec file
49
+
50
+ // ====================
51
+ // Framework
52
+ // ====================
53
+ // framework: 'mocha', // Use the Mocha framework
54
+ // reporters: ['spec'
55
+
56
+ // ], // Use the spec reporter
57
+
58
+ // ====================
59
+ // Hooks
60
+ // ====================
61
+ before: function (capabilities, specs) {
62
+ browser.maximizeWindow()
63
+ process.env.BS_SESSION_TYPE = "automate";
64
+ },
65
+
66
+
67
+
68
+ // // ====================
69
+ // // Mocha Options
70
+ // // ====================
71
+ // mochaOpts: {
72
+ // ui: 'bdd', // Set the test interface to BDD
73
+ // timeout: 90000, // Set the timeout for test cases in milliseconds
74
+ // },
75
+ }]);
76
+
77
+ module.exports = apiconfig;
@@ -0,0 +1,45 @@
1
+ const deepmerge = require('deepmerge')
2
+ const commonconfig = require('./commonconfig');
3
+ const isBrowserStackEnabled = process.env.BROWSERSTACK;
4
+ console.log("isBrowserStackEnabled", isBrowserStackEnabled);
5
+
6
+ const browserStackConfig = isBrowserStackEnabled === 'true' ? {
7
+ user: process.env.BROWSERSTACK_USERNAME,
8
+ key: Buffer.from(process.env.BROWSERSTACK_ACCESS_KEY, 'base64').toString('utf-8'),
9
+ commonCapabilities: {
10
+ 'bstack:options': {
11
+ projectName: process.env.PROJECTNAME || "roboticodigital",
12
+ sessionName: 'Automation test session',
13
+ debug: true,
14
+ networkLogs: true
15
+ }
16
+ }
17
+ }: {};
18
+
19
+ const commonmobconfig = deepmerge.all([
20
+
21
+ {
22
+ logLevel: 'info',
23
+ coloredLogs: true,
24
+ screenshotPath: './errorShots/',
25
+ baseUrl: '',
26
+ waitforTimeout: 90000,
27
+ connectionRetryTimeout: 90000,
28
+ connectionRetryCount: 2,
29
+
30
+ framework: 'mocha',
31
+ mochaOpts: {
32
+ ui: 'bdd',
33
+ timeout: 300000
34
+ },
35
+
36
+ maxInstances: 10,
37
+
38
+ updateJob: false,
39
+ reporters: ['spec'],
40
+ },
41
+ browserStackConfig,
42
+ commonconfig,
43
+ ]);
44
+
45
+ module.exports = commonmobconfig;
@@ -1,12 +1,11 @@
1
- const path = require('path');
1
+ const setAllDetails = require("./setallDatailinBuffer")
2
2
  const { LocalStorage } = require('node-localstorage');
3
3
  global.BUFFER = new LocalStorage('./storage');
4
- const setAllDetails = require("./setallDatailinBuffer")
4
+ const path = require('path');
5
5
  const exeDetails = require("../api/getexecutionDetails")
6
6
  const getBSSessionDetails = require("../api/browsersatckSessionInfo").getBSSessionDetails;
7
7
  const { fail } = require("assert");
8
- const { platform } = require("os");
9
- //const isBrowserStackEnabled = process.env.BROWSERSTACK;
8
+ const isBrowserStackEnabled = process.env.BROWSERSTACK;
10
9
  let starttime;
11
10
  let endtime;
12
11
 
@@ -15,40 +14,32 @@ const commonconfig = {
15
14
 
16
15
 
17
16
  onPrepare: async function (capabilities, specs) {
18
- try {
19
- console.log('====> This is the onPrepare hook');
20
- // This code runs before the test suite starts
21
- await setAllDetails.setEnvVariables();
22
- await setAllDetails.setLoginToken();
23
- await setAllDetails.setExecutionDetails();
24
- // await setAllDetails.setIntegrationsDetails();
25
- await setAllDetails.setSuiteDetails();
26
- await setAllDetails.setTestDataDetails();
27
- console.log("on prepare:", JSON.stringify(capabilities))
28
- // console.log("ALL JSON DATA in env variable :" + JSON.stringify(process.env));
29
- } catch (e) {
30
- console.log("====> Error in onPrepare:", e);
17
+ try{
18
+ // This code runs before the test suite starts
19
+ await setAllDetails.setEnvVariables();
20
+ await setAllDetails.setLoginToken();
21
+ await setAllDetails.setExecutionDetails();
22
+ // await setAllDetails.setIntegrationsDetails();
23
+ await setAllDetails.setSuiteDetails();
24
+ await setAllDetails.setTestDataDetails();
25
+ // console.log(JSON.stringify(capabilities))
26
+ // console.log("ALL JSON DATA in env variable :" + JSON.stringify(process.env));
27
+ }catch(e){
28
+ console.log("====> Error in onPrepare:",e);
31
29
 
32
30
  }
33
31
  },
34
32
 
35
33
 
36
- beforeSession: async function (config, capabilities, specs) {
34
+ beforeSession: async function (config, capabilities,specs ) {
37
35
  console.log('====> This is the beforesession hook');
38
36
  // Perform any setup or pre-test actions here
39
- // console.log("Capabilities:", capabilities);
40
-
41
- console.log("specdat:", specs);
42
- console.log("length:", specs.length);
43
- // console.log("capabilities:", capabilities);
44
- // capabilities.app = process.env.BROWSERSTACK_APP_PATH;
45
- // capabilities['browserstack.uploadMedia'] = process.env.MEDIA_FILES;
46
- // console.log("====>",capabilities)
47
- console.log(`Running tests on: ${capabilities.platformName} ${capabilities.browserName} ${capabilities.browserVersion}`);
48
-
49
-
50
- // console.log('specs:', specs);
51
- // console.log("Config:", config);
37
+ // console.log("Capabilities:", capabilities);
38
+ console.log("Specs:", specs.length);
39
+ const specdat=specs
40
+ console.log("specdat:", specdat);
41
+ console.log("length:", specdat.length);
42
+ // console.log("Config:", config);
52
43
  },
53
44
  /**
54
45
  * Gets executed before the suite starts (in Mocha/Jasmine only).
@@ -60,9 +51,10 @@ const commonconfig = {
60
51
 
61
52
  starttime = new Date().getTime();
62
53
 
63
- if (platform === 'browserstack')
64
- await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, process.env.BROWSERSTACK_ACCESS_KEY);
65
-
54
+ if (isBrowserStackEnabled) {
55
+ console.log("BrowserStack is enabled");
56
+ await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, process.env.BROWSERSTACK_ACCESS_KEY);
57
+ }
66
58
  const resultdetails = {};
67
59
  exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
68
60
 
@@ -116,7 +108,7 @@ const commonconfig = {
116
108
  // scriptresult = "FAILED"
117
109
  }
118
110
  let scriptid = BUFFER.getItem(fileName.replace(".js", ""))
119
- let script_platform = BUFFER.getItem(fileName.replace(".js", "") + "_PLATFORM")
111
+ let script_platform = BUFFER.getItem(fileName.replace(".js", "")+"_PLATFORM")
120
112
 
121
113
  await exeDetails.updateScriptExecutionStatus(
122
114
  BUFFER.getItem("ORGANISATION_DOMAIN_URL"),
@@ -159,7 +151,7 @@ const commonconfig = {
159
151
  afterSession: async function (config, capabilities, specs) {
160
152
  console.log('====> This is the aftersession hook');
161
153
  // Perform any cleanup or post-test actions here
162
- // console.log("Capabilities:", capabilities);
154
+ console.log("Capabilities:", capabilities);
163
155
  console.log("Specs:", specs);
164
156
  console.log("Config:", config);
165
157
 
@@ -167,7 +159,7 @@ const commonconfig = {
167
159
  let totalDuration = endtime - starttime;
168
160
  console.log("====> Total Duration in after session based on start time and end time:" + totalDuration);
169
161
 
170
- if (platform === 'browserstack')
162
+ if (isBrowserStackEnabled)
171
163
  await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, process.env.BROWSERSTACK_ACCESS_KEY);
172
164
 
173
165
  const resultdetails = {}
@@ -179,39 +171,39 @@ const commonconfig = {
179
171
  BUFFER.clear();
180
172
 
181
173
 
182
- // Perform any cleanup or post-test actions here
183
- },
184
-
185
- onComplete: async function (exitCode, config, capabilities, results) {
174
+ // Perform any cleanup or post-test actions here
175
+ },
186
176
 
187
- console.log('====> This is the onComplete hook', results);
177
+ onComplete: async function (exitCode, config, capabilities, results) {
178
+
179
+ console.log('====> This is the onComplete hook', results);
188
180
 
189
- console.log('====> Test Results Summary ');
190
- console.log('----------------------------');
181
+ console.log('====> Test Results Summary ');
182
+ console.log('----------------------------');
191
183
 
192
- console.log('Total Tests:', results.total);
193
- console.log('Passed:', results.passed);
194
- console.log('Failed:', results.failed);
195
- console.log('Skipped:', results.skipped);
196
- console.log('Execution Time:', results.duration);
197
- console.log('Exit Code:', exitCode);
198
- console.log('====> All tests are done, exiting the browser session.');
184
+ console.log('Total Tests:', results.total);
185
+ console.log('Passed:', results.passed);
186
+ console.log('Failed:', results.failed);
187
+ console.log('Skipped:', results.skipped);
188
+ console.log('Execution Time:', results.duration);
189
+ console.log('Exit Code:', exitCode);
190
+ console.log('====> All tests are done, exiting the browser session.');
199
191
 
200
- }
192
+ }
201
193
 
202
- };
194
+ };
203
195
 
204
- async function secondsToTime(secs) {
205
- let hours = Math.floor(secs / 3600);
206
- let minutes = Math.floor((secs % 3600) / 60);
207
- let seconds = secs % 60;
196
+ async function secondsToTime(secs) {
197
+ let hours = Math.floor(secs / 3600);
198
+ let minutes = Math.floor((secs % 3600) / 60);
199
+ let seconds = secs % 60;
208
200
 
209
- // Adding leading zeros if the value is less than 10
210
- if (hours < 10) hours = '0' + hours;
211
- if (minutes < 10) minutes = '0' + minutes;
212
- if (seconds < 10) seconds = '0' + seconds;
213
- console.log("Time:" + hours + ':' + minutes + ':' + seconds);
214
- return hours + ':' + minutes + ':' + seconds;
201
+ // Adding leading zeros if the value is less than 10
202
+ if (hours < 10) hours = '0' + hours;
203
+ if (minutes < 10) minutes = '0' + minutes;
204
+ if (seconds < 10) seconds = '0' + seconds;
205
+ console.log("Time:" + hours + ':' + minutes + ':' + seconds);
206
+ return hours + ':' + minutes + ':' + seconds;
215
207
  }
216
208
 
217
209
  async function convertTimetoHHMMSS(time) {
@@ -0,0 +1,4 @@
1
+
2
+ await driver.execute('browserstack_executor: {"action":"cameraImageInjection", "arguments": {"imageUrl" : "media://1965674f959d00128d4fb649dcc6823bd00b00cb"}}');
3
+
4
+ await driver.execute('browserstack_executor: {"action":"cameraVideoInjection", "arguments": {"videoUrl" : "media://1920c80136e1c7e2278e15d820845ed64a676e92"}}')
@@ -0,0 +1,47 @@
1
+ // This is the configuration file for iOS devices
2
+ const deepmerge = require('deepmerge')
3
+ process.env.BROWSERSTACK = true;
4
+ const commonmobileconfig = require('./common.mobile.conf');
5
+
6
+ const iosconfig = deepmerge.all([commonmobileconfig, {
7
+ services: [
8
+ [
9
+ 'browserstack',
10
+ {
11
+ // testObservability: true,
12
+ // buildIdentifier: `#${process.env.BUILD_NUMBER}`,
13
+ browserstackLocal: process.env.BROWSERSTACK_LOCAL || false,
14
+ opts: {
15
+ forcelocal: false,
16
+ // localIdentifier: "webdriverio-appium"
17
+ },
18
+ app: process.env.BROWSERSTACK_APP_PATH || 'bs://d6588d0899a2ac5c485d4784af9ad28d06b98c44'
19
+ }
20
+ ]
21
+ ],
22
+
23
+ capabilities: [{
24
+ 'bstack:options': {
25
+ projectName: process.env.PROJECTNAME || "roboticodigital",
26
+ deviceName: process.env.DEVICENAME || "iPhone 15 Pro Max",
27
+ osVersion: process.env.OSVERSION || "17",
28
+ platformName: 'iOS',
29
+ interactiveDebugging: true,
30
+ buildName: process.env.BROWSERSTACK_BUILD_NAME || 'IOS_Build',
31
+ networkLogs: "true",
32
+ debug: "true",
33
+ appProfiling: "true",
34
+ //enableCameraImageInjection: "true",
35
+ deviceOrientation: process.env.DEVICENAME.toLowerCase().includes('tab') ? 'landscape' : 'portrait',
36
+
37
+ }
38
+ }],
39
+
40
+ before: function (capabilities, specs) {
41
+ // browser.maximizeWindow()
42
+ process.env.BS_SESSION_TYPE = "app-automate";
43
+ },
44
+ }]);
45
+
46
+ module.exports = iosconfig;
47
+
@@ -0,0 +1,76 @@
1
+ const deepmerge = require('deepmerge')
2
+ process.env.BROWSERSTACK = true;
3
+ const commonmobileconfig = require('./common.mobile.conf');
4
+
5
+ const webbsconfig = deepmerge.all([commonmobileconfig, {
6
+
7
+
8
+ services: [
9
+ ['browserstack', {
10
+
11
+ browserstackLocal: process.env.BROWSERSTACK_LOCAL || false,
12
+ opts: {
13
+ forcelocal: false,
14
+ // localIdentifier: "webdriverio-appium"
15
+ },
16
+
17
+ }]
18
+ ],
19
+ // ====================
20
+ // Capabilities
21
+ // ====================
22
+ capabilities: [
23
+ {
24
+ 'bstack:options': {
25
+ projectName: process.env.PROJECTNAME || "roboticodigital",
26
+ browserName: process.env.BROWSERSTACK_BROWSER || 'chrome', // Choose the browser you want to test
27
+ browserVersion: process.env.BROWSERSTACK_BROWSER_VERSION || '129', // Specify the browser version
28
+ os: 'Windows', // Specify the operating system
29
+ osVersion: '10', // Specify the operating system version
30
+ interactiveDebugging: true,
31
+ buildName: process.env.BROWSERSTACK_BUILD_NAME || 'WEB_Build',
32
+ networkLogs: "true",
33
+ debug: "true",
34
+ }
35
+ },
36
+ // Add more capabilities for other browsers or devices as needed
37
+ ],
38
+
39
+ // ====================
40
+ // Test Configurations
41
+ // ====================
42
+ // logLevel: 'info', // Set the log level
43
+ // bail: 0, // Set to 1 to stop the test suite after the first test failure
44
+ // baseUrl: '', // Specify the base URL of your application
45
+ // waitforTimeout: 90000, // Set the timeout for all waitFor* commands
46
+ // connectionRetryTimeout: 90000, // Set the timeout in milliseconds for test retries
47
+ // connectionRetryCount: 2, // Set the number of times to retry the entire spec file
48
+
49
+ // ====================
50
+ // Framework
51
+ // ====================
52
+ // framework: 'mocha', // Use the Mocha framework
53
+ // reporters: ['spec'
54
+
55
+ // ], // Use the spec reporter
56
+
57
+ // ====================
58
+ // Hooks
59
+ // ====================
60
+ before: function (capabilities, specs) {
61
+ browser.maximizeWindow()
62
+ process.env.BS_SESSION_TYPE = "automate";
63
+ },
64
+
65
+
66
+
67
+ // // ====================
68
+ // // Mocha Options
69
+ // // ====================
70
+ // mochaOpts: {
71
+ // ui: 'bdd', // Set the test interface to BDD
72
+ // timeout: 90000, // Set the timeout for test cases in milliseconds
73
+ // },
74
+ }]);
75
+
76
+ module.exports = webbsconfig;
@@ -0,0 +1,70 @@
1
+
2
+
3
+ const config = {
4
+
5
+ // ====================
6
+ // Capabilities
7
+ // ====================
8
+ capabilities: [{
9
+ maxInstances: 5,
10
+ browserName: 'chrome',
11
+ acceptInsecureCerts: true,
12
+ }],
13
+
14
+ // ====================
15
+ // Test Configurations
16
+ // ====================
17
+ logLevel: 'info', // Set the log level
18
+ bail: 0, // Set to 1 to stop the test suite after the first test failure
19
+ baseUrl: '', // Specify the base URL of your application
20
+ waitforTimeout: 60000, // Set the timeout for all waitFor* commands
21
+ connectionRetryTimeout: 90000, // Set the timeout in milliseconds for test retries
22
+ connectionRetryCount: 3, // Set the number of times to retry the entire spec file
23
+
24
+ // ====================
25
+ // Framework
26
+ // ====================
27
+ framework: 'mocha', // Use the Mocha framework
28
+ reporters: ['spec'], // Use the spec reporter
29
+ // reporterOptions: {
30
+ // allure: {
31
+ // outputDir: 'allure-results',
32
+ // disableWebdriverStepsReporting: true,
33
+ // disableWebdriverScreenshotsReporting: false,
34
+ // }
35
+ //},
36
+ // ====================
37
+ // Hooks
38
+ // ====================
39
+ before: function (capabilities, specs) {
40
+ // Code to run before the first test
41
+ const currentDate = new Date();
42
+ const timestamp = currentDate.toISOString().replace(/[:.]/g, '');
43
+ browser.saveScreenshot('./screenshot_' + timestamp + '.png');
44
+
45
+ },
46
+ after: function (capabilities, specs) {
47
+ // Code to run to take screenshots
48
+ const currentDate = new Date();
49
+ const timestamp = currentDate.toISOString().replace(/[:.]/g, '');
50
+ browser.saveScreenshot('./screenshot_' + timestamp + '.png');
51
+
52
+
53
+ },
54
+
55
+ // ====================
56
+ // BrowserStack Options
57
+ // ====================
58
+ browserstackOpts: {
59
+ // BrowserStack-specific options
60
+ },
61
+
62
+ // ====================
63
+ // Mocha Options
64
+ // ====================
65
+ mochaOpts: {
66
+ ui: 'bdd', // Set the test interface to BDD
67
+ timeout: 60000, // Set the timeout for test cases in milliseconds
68
+ },
69
+ };
70
+ module.exports = config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "3.0.87",
3
+ "version": "3.0.89",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",
@@ -31,20 +31,21 @@
31
31
  "@wdio/local-runner": "^9.0.9",
32
32
  "@wdio/mocha-framework": "^8.36.1",
33
33
  "@wdio/spec-reporter": "^8.36.1",
34
- "appium": "^2.15.0",
35
- "appium-uiautomator2-driver": "^4.0.1",
34
+ "appium": "^1.22.3",
35
+ "appium-uiautomator2-driver": "^2.2.0",
36
36
  "assert": "^2.1.0",
37
37
  "axios": "^1.7.7",
38
38
  "browserstack-local": "^1.5.5",
39
39
  "chai": "^5.1.1",
40
+ "crypto": "^1.0.1",
40
41
  "crypto-js": "^4.2.0",
41
42
  "deepmerge": "^4.3.1",
42
43
  "form-data": "^4.0.0",
43
- "fs": "^0.0.1-security",
44
- "js-yaml": "^4.1.0",
45
44
  "mysql2": "^3.10.2",
46
45
  "node-fetch": "^3.3.2",
47
46
  "node-localstorage": "^3.0.5",
47
+ "pg": "^8.12.0",
48
+ "pg-promise": "^11.9.0",
48
49
  "randexp": "^0.5.3",
49
50
  "ts-node": "^10.9.2",
50
51
  "typescript": "^5.4.5"
@@ -1,193 +0,0 @@
1
- async function swipeleft(selector, xoffset, speedinsec) {
2
- try {
3
- console.log('Swiping left');
4
-
5
- if (xoffset == null) {
6
- driver.swipeLeft(selector, speedinsec);
7
- } else {
8
- driver.swipeLeft(selector, xoffset, speedinsec);
9
- }
10
- } catch (error) {
11
- console.error(error.message);
12
- }
13
-
14
- }
15
-
16
- async function swiperight(selector, xoffset, speedinsec) {
17
- try {
18
- console.log('Swiping right');
19
-
20
- if (xoffset == null) {
21
- driver.swipeRight(selector, speedinsec);
22
- } else {
23
- driver.swipeRight(selector, xoffset, speedinsec);
24
- }
25
- } catch (error) {
26
- console.error(error.message);
27
- }
28
-
29
- }
30
-
31
- async function swipeup(selector, yoffset, speedinsec) {
32
- try {
33
- console.log('Swiping up');
34
-
35
- if (yoffset == null) {
36
- driver.swipeUp(selector, speedinsec);
37
- } else {
38
- driver.swipeUp(selector, yoffset, speedinsec);
39
- }
40
- } catch (error) {
41
- console.error(error.message);
42
- }
43
- }
44
-
45
- async function swipedown(selector, yoffset, speedinsec) {
46
- try {
47
- console.log('Swiping down');
48
-
49
- if (yoffset == null) {
50
- driver.swipeDown(selector, speedinsec);
51
- } else {
52
- driver.swipeDown(selector, yoffset, speedinsec);
53
- }
54
- } catch (error) {
55
- console.error(error.message);
56
- }
57
- }
58
-
59
- async function swipewithcoordinates(StartX, StartY, EndX, EndY) {
60
-
61
- await driver.performActions([
62
- {
63
- type: "pointer",
64
- id: "finger1",
65
- parameters: { pointerType: "touch" },
66
- actions: [
67
- { type: "pointerMove", duration: 0, x: StartX, y: StartY },
68
- { type: "pointerDown", button: 0 },
69
- { type: "pause", duration: 300 },
70
- { type: "pointerMove", duration: 1000, x: EndX, y: EndY },
71
- { type: "pointerUp", button: 0 }
72
- ],
73
- }
74
- ]);
75
- }
76
- async function swipetofit() {
77
- // Get screen size dynamically
78
- const screenSize = await driver.getWindowRect();
79
- const screenWidth = screenSize.width;
80
- const screenHeight = screenSize.height;
81
-
82
- console.log(`Screen Size: Width=${screenWidth}, Height=${screenHeight}`);
83
-
84
- // Define approximate positions for corners
85
- const topRightStartX = screenWidth * 0.88; // Top-right corner
86
- const topRightStartY = screenHeight * 0.44;
87
-
88
- const topRightEndX = screenWidth * 0.96; // Expand to the right
89
- const topRightEndY = screenHeight * 0.39; // Move upwards slightly
90
-
91
- const bottomLeftStartX = screenWidth * 0.12; // Bottom-left corner
92
- const bottomLeftStartY = screenHeight * 0.69;
93
-
94
- const bottomLeftEndX = screenWidth * 0.014; // Expand to the left
95
- const bottomLeftEndY = screenHeight * 0.73; // Move down slightly
96
-
97
- console.log(`Resizing top-right from (${topRightStartX}, ${topRightStartY}) to (${topRightEndX}, ${topRightEndY})`);
98
- console.log(`Resizing bottom-left from (${bottomLeftStartX}, ${bottomLeftStartY}) to (${bottomLeftEndX}, ${bottomLeftEndY})`);
99
-
100
- // Resize from top-right corner
101
- await driver.performActions([
102
- {
103
- type: "pointer",
104
- id: "finger1",
105
- parameters: { pointerType: "touch" },
106
- actions: [
107
- { type: "pointerMove", duration: 0, x: topRightStartX, y: topRightStartY },
108
- { type: "pointerDown", button: 0 },
109
- { type: "pause", duration: 300 },
110
- { type: "pointerMove", duration: 1000, x: topRightEndX, y: topRightEndY },
111
- { type: "pointerUp", button: 0 }
112
- ],
113
- }
114
- ]);
115
-
116
- // Resize from bottom-left corner
117
- await driver.performActions([
118
- {
119
- type: "pointer",
120
- id: "finger2",
121
- parameters: { pointerType: "touch" },
122
- actions: [
123
- { type: "pointerMove", duration: 0, x: bottomLeftStartX, y: bottomLeftStartY },
124
- { type: "pointerDown", button: 0 },
125
- { type: "pause", duration: 300 },
126
- { type: "pointerMove", duration: 1000, x: bottomLeftEndX, y: bottomLeftEndY },
127
- { type: "pointerUp", button: 0 }
128
- ],
129
- }
130
- ]);
131
-
132
- console.log("✅ Crop overlay resized from two corners successfully!");
133
- }
134
-
135
- async function swipetofit(TopRStartXpct, TopRStartYpct, TopREndXpct, TopREndYpct, BottomLStartXpct, BottomLStartYpct, BottomLEndXpct, BottomLEndYpct) {
136
- // Get screen size dynamically
137
- const screenSize = await driver.getWindowRect();
138
- const screenWidth = screenSize.width;
139
- const screenHeight = screenSize.height;
140
-
141
- console.log(`Screen Size: Width=${screenWidth}, Height=${screenHeight}`);
142
-
143
- // Define approximate positions for corners
144
- const topRightStartX = screenWidth * (TopRStartXpct/100); // Top-right corner
145
- const topRightStartY = screenHeight * (TopRStartYpct/100);
146
-
147
- const topRightEndX = screenWidth * (TopREndXpct/100); // Expand to the right
148
- const topRightEndY = screenHeight * (TopREndYpct/100); // Move upwards slightly
149
-
150
- const bottomLeftStartX = screenWidth * (BottomLStartXpct/100); // Bottom-left corner
151
- const bottomLeftStartY = screenHeight * (BottomLStartYpct/100);
152
-
153
- const bottomLeftEndX = screenWidth * (BottomLEndXpct/100); // Expand to the left
154
- const bottomLeftEndY = screenHeight * (BottomLEndYpct/100); // Move down slightly
155
-
156
- console.log(`Resizing top-right from (${topRightStartX}, ${topRightStartY}) to (${topRightEndX}, ${topRightEndY})`);
157
- console.log(`Resizing bottom-left from (${bottomLeftStartX}, ${bottomLeftStartY}) to (${bottomLeftEndX}, ${bottomLeftEndY})`);
158
-
159
- // Resize from top-right corner
160
- await driver.performActions([
161
- {
162
- type: "pointer",
163
- id: "finger1",
164
- parameters: { pointerType: "touch" },
165
- actions: [
166
- { type: "pointerMove", duration: 0, x: topRightStartX, y: topRightStartY },
167
- { type: "pointerDown", button: 0 },
168
- { type: "pause", duration: 300 },
169
- { type: "pointerMove", duration: 1000, x: topRightEndX, y: topRightEndY },
170
- { type: "pointerUp", button: 0 }
171
- ],
172
- }
173
- ]);
174
-
175
- // Resize from bottom-left corner
176
- await driver.performActions([
177
- {
178
- type: "pointer",
179
- id: "finger2",
180
- parameters: { pointerType: "touch" },
181
- actions: [
182
- { type: "pointerMove", duration: 0, x: bottomLeftStartX, y: bottomLeftStartY },
183
- { type: "pointerDown", button: 0 },
184
- { type: "pause", duration: 300 },
185
- { type: "pointerMove", duration: 1000, x: bottomLeftEndX, y: bottomLeftEndY },
186
- { type: "pointerUp", button: 0 }
187
- ],
188
- }
189
- ]);
190
-
191
- console.log("✅ Crop overlay resized from two corners successfully!");
192
- }
193
- module.exports = { swipeleft, swipedown, swiperight, swipeup, swipetofit ,swipewithcoordinates};
@@ -1,66 +0,0 @@
1
- const deepmerge = require('deepmerge')
2
- const fs = require('fs');
3
- const yaml = require('js-yaml');
4
- const path = require('path');
5
- const commonconfig = require('./commonconfig');
6
-
7
- // Select platform at runtime
8
- const PLATFORM = process.env.PLATFORM || 'browserstack';
9
- const configFile = PLATFORM === 'browserstack' ? './ymls/browserstack/' + process.env.YML_NAME : './ymls/saucelab/' + process.env.YML_NAME;
10
- console.log('PLATFORM:', PLATFORM);
11
- // Load YAML file
12
- const capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(),configFile)), 'utf8'));
13
- const SUITE_FILE = path.resolve(process.cwd(), process.env.SUITE);
14
-
15
- console.log('SUITE_FILE:', SUITE_FILE);
16
-
17
- capabilities.buildName = process.env.BROWSERSTACK_BUILD_NAME;
18
-
19
-
20
- if (PLATFORM === 'browserstack') {
21
- process.env.BROWSERSTACK_USERNAME = capabilities.userName;
22
- process.env.BROWSERSTACK_ACCESS_KEY = capabilities.accessKey;
23
- console.log('capabilities.platformName:', capabilities.platformName);
24
- process.env.BS_SESSION_TYPE = capabilities.platformName === 'android' || capabilities.platformName === 'ios' ? 'app-automate' : 'automate';
25
-
26
- }
27
-
28
- exports.config = deepmerge(commonconfig,
29
-
30
- {
31
- user: capabilities.userName,
32
- key: capabilities.accessKey,
33
- // debug: true,
34
- // execArgv: ['--inspect-brk'],
35
- services: PLATFORM === 'browserstack'
36
- ? ['browserstack']
37
- : PLATFORM === 'saucelabs'
38
- ? ['sauce']
39
- : [],
40
-
41
- //runner: 'local',
42
- specs: require(SUITE_FILE).tests,
43
-
44
- maxInstances: 1,
45
- capabilities: [capabilities],
46
-
47
- logLevel: 'info',
48
- coloredLogs: true,
49
- screenshotPath: './errorShots/',
50
- bail: 0,
51
- //baseUrl: 'https://example.com',
52
- waitforTimeout: 90000,
53
- connectionRetryTimeout: 90000,
54
- connectionRetryCount: 3,
55
-
56
- framework: 'mocha',
57
- reporters: ['spec'],
58
- maxInstances: 10,
59
- updateJob: false,
60
- mochaOpts: {
61
- ui: 'bdd',
62
- timeout: 300000
63
- }
64
- });
65
-
66
-