froth-webdriverio-framework 3.0.112 → 3.0.114
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.
- package/.github/workflows/main.yml +23 -0
- package/{froth_api_calls → api}/browsersatckSessionInfo.js +4 -8
- package/{froth_api_calls → api}/getexecutionDetails.js +27 -40
- package/{froth_api_calls → api}/getsuiteDetails.js +13 -14
- package/{froth_api_calls → api}/loginapi.js +4 -2
- package/{froth_api_calls → api}/readTestdata.js +4 -6
- package/{froth_common_actions → commonMethods}/Utils.js +9 -21
- package/{froth_common_actions → commonMethods}/alert.js +3 -3
- package/{froth_common_actions → commonMethods}/apicall.js +5 -17
- package/{froth_common_actions → commonMethods}/click.js +1 -24
- package/{froth_common_actions → commonMethods}/jwt.js +1 -1
- package/{froth_common_actions → commonMethods}/scroll.js +1 -23
- package/commonMethods/swipe.js +59 -0
- package/config/android.conf.js +49 -0
- package/config/api.conf.bs.js +76 -0
- package/config/api.conf.js +77 -0
- package/config/common.mobile.conf.js +45 -0
- package/{froth_configs → config}/commonconfig.js +45 -59
- package/config/injectimage.js +4 -0
- package/config/ios.conf.js +47 -0
- package/{froth_configs → config}/setallDatailinBuffer.js +16 -19
- package/config/web.conf.bs.js +76 -0
- package/config/web.conf.js +70 -0
- package/package.json +6 -5
- package/froth_common_actions/swipe.js +0 -219
- package/froth_configs/wdio.common.conf.js +0 -74
- /package/{froth_api_calls → api}/aesEncryption.js +0 -0
- /package/{froth_common_actions → commonMethods}/assert.js +0 -0
- /package/{froth_common_actions → commonMethods}/dropDown.js +0 -0
- /package/{froth_common_actions → commonMethods}/random.js +0 -0
- /package/{froth_common_actions → commonMethods}/storeToBuffer.js +0 -0
|
@@ -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,32 +1,32 @@
|
|
|
1
|
-
const
|
|
1
|
+
const setAllDetails = require("./setallDatailinBuffer")
|
|
2
2
|
const { LocalStorage } = require('node-localstorage');
|
|
3
3
|
global.BUFFER = new LocalStorage('./storage');
|
|
4
|
-
const
|
|
5
|
-
const exeDetails = require("../
|
|
6
|
-
const getBSSessionDetails = require("../
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const exeDetails = require("../api/getexecutionDetails")
|
|
6
|
+
const getBSSessionDetails = require("../api/browsersatckSessionInfo").getBSSessionDetails;
|
|
7
7
|
const { fail } = require("assert");
|
|
8
|
-
|
|
8
|
+
const isBrowserStackEnabled = process.env.BROWSERSTACK;
|
|
9
9
|
let starttime;
|
|
10
10
|
let endtime;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const resultdetails = {
|
|
12
|
+
comments: [],
|
|
13
|
+
status: '', // Pass/Fail
|
|
14
|
+
timeduration: 0, // Execution time in milliseconds
|
|
15
|
+
};
|
|
13
16
|
// Description: This file contains the common configuration for the webdriverio framework.
|
|
14
17
|
const commonconfig = {
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
onPrepare: async function (capabilities, specs) {
|
|
18
21
|
try {
|
|
19
|
-
console.log('==== ON PREPARE HOOK ====');
|
|
20
22
|
// This code runs before the test suite starts
|
|
21
23
|
await setAllDetails.setEnvVariables();
|
|
22
|
-
|
|
23
|
-
FROTH_LOGIN_TOKEN
|
|
24
|
+
await setAllDetails.setLoginToken();
|
|
24
25
|
await setAllDetails.setExecutionDetails();
|
|
25
|
-
|
|
26
26
|
// await setAllDetails.setIntegrationsDetails();
|
|
27
27
|
await setAllDetails.setSuiteDetails();
|
|
28
28
|
await setAllDetails.setTestDataDetails();
|
|
29
|
-
console.log(
|
|
29
|
+
// console.log(JSON.stringify(capabilities))
|
|
30
30
|
// console.log("ALL JSON DATA in env variable :" + JSON.stringify(process.env));
|
|
31
31
|
} catch (e) {
|
|
32
32
|
console.log("====> Error in onPrepare:", e);
|
|
@@ -36,29 +36,21 @@ const commonconfig = {
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
beforeSession: async function (config, capabilities, specs) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (process.env.MEDIA_FILES) {
|
|
55
|
-
console.log("Media Files:", JSON.parse(process.env.MEDIA_FILES));
|
|
56
|
-
console.log("Size of Media Files:", process.env.MEDIA_FILES.length);
|
|
57
|
-
if (process.env.MEDIA_FILES.length > 0)
|
|
58
|
-
capabilities['browserstack.uploadMedia'] = JSON.parse(process.env.MEDIA_FILES);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
console.log(`Running tests on after app,bslocal,mediafiles: ${JSON.stringify(capabilities)}`);
|
|
39
|
+
try {
|
|
40
|
+
console.log('====> This is the beforesession hook');
|
|
41
|
+
// Perform any setup or pre-test actions here
|
|
42
|
+
// console.log("Capabilities:", capabilities);
|
|
43
|
+
console.log("Specs:", specs.length);
|
|
44
|
+
const specdat = specs
|
|
45
|
+
console.log("specdat:", specdat);
|
|
46
|
+
console.log("length:", specdat.length);
|
|
47
|
+
// console.log("Config:", config);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error('🚨 Error in beforeSession:', error.message);
|
|
50
|
+
resultdetails.excution_status = 'FAILED' ;
|
|
51
|
+
resultdetails.comments.push( error.message);
|
|
52
|
+
await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
|
|
53
|
+
throw new Error(`Session creation failed: ${error.message}`);
|
|
62
54
|
}
|
|
63
55
|
|
|
64
56
|
},
|
|
@@ -68,17 +60,16 @@ const commonconfig = {
|
|
|
68
60
|
*/
|
|
69
61
|
beforeSuite: async function (suite) {
|
|
70
62
|
try {
|
|
71
|
-
console.log('==== BEFORE SUITE HOOK ====');
|
|
72
|
-
|
|
73
63
|
console.log(`====> Test suite has been started ' ${suite.title}' `,);
|
|
74
64
|
|
|
75
65
|
starttime = new Date().getTime();
|
|
76
66
|
|
|
77
|
-
if (
|
|
67
|
+
if (isBrowserStackEnabled) {
|
|
68
|
+
console.log("BrowserStack is enabled");
|
|
78
69
|
await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, process.env.BROWSERSTACK_ACCESS_KEY);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
70
|
+
}
|
|
71
|
+
// const resultdetails = {};
|
|
72
|
+
exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
|
|
82
73
|
|
|
83
74
|
} catch (e) {
|
|
84
75
|
console.log("Error in beforeSuite:", e);
|
|
@@ -91,7 +82,6 @@ const commonconfig = {
|
|
|
91
82
|
* @param {object} context scope object the test was executed with
|
|
92
83
|
*/
|
|
93
84
|
beforeTest: function (test, context) {
|
|
94
|
-
console.log('==== BEFORE TEST HOOK ====');
|
|
95
85
|
console.log(`====> Test Started '${test.title}'`);
|
|
96
86
|
|
|
97
87
|
// console.log("File Name:", test.file);
|
|
@@ -110,8 +100,6 @@ const commonconfig = {
|
|
|
110
100
|
* @param {object} result.retries information about spec related retries, e.g. `{ attempts: 0, limit: 0 }`
|
|
111
101
|
*/
|
|
112
102
|
afterTest: async function (test, context, { error, result, duration, passed, retries }) {
|
|
113
|
-
console.log('==== AFTER TEST HOOK ====');
|
|
114
|
-
|
|
115
103
|
console.log(`====> Test name finished '${test.title}'`);
|
|
116
104
|
|
|
117
105
|
const fileName = path.basename(test.file);
|
|
@@ -124,12 +112,16 @@ const commonconfig = {
|
|
|
124
112
|
|
|
125
113
|
if (passed) {
|
|
126
114
|
scriptresult = "PASSED"
|
|
115
|
+
resultdetails.comments.push( `${test.title} - passed`);
|
|
127
116
|
}
|
|
128
117
|
else {
|
|
129
118
|
scriptresult = "FAILED"
|
|
119
|
+
resultdetails.comments.push( `${test.title} - failed: ${error.message}`);
|
|
130
120
|
}
|
|
131
121
|
if (error) {
|
|
132
122
|
console.error(`========= Error occured while executing the test: ${error.message}`);
|
|
123
|
+
resultdetails.comments.push( `${test.title} - error occured: ${error.message}`);
|
|
124
|
+
|
|
133
125
|
// scriptresult = "FAILED"
|
|
134
126
|
}
|
|
135
127
|
let scriptid = BUFFER.getItem(fileName.replace(".js", ""))
|
|
@@ -148,8 +140,6 @@ const commonconfig = {
|
|
|
148
140
|
* @param {object} suite suite details
|
|
149
141
|
*/
|
|
150
142
|
afterSuite: function (suite) {
|
|
151
|
-
console.log('==== AFTER SUITE HOOK ====');
|
|
152
|
-
|
|
153
143
|
console.log(`====> Test suite has completed '${suite.title}'`);
|
|
154
144
|
},
|
|
155
145
|
/**
|
|
@@ -160,14 +150,12 @@ const commonconfig = {
|
|
|
160
150
|
* @param {Array.<String>} specs List of spec file paths that ran
|
|
161
151
|
*/
|
|
162
152
|
after: async function (result, config, capabilities, specs) {
|
|
163
|
-
console.log('==== AFTER HOOK ====');
|
|
164
|
-
|
|
165
153
|
console.log('====> All tests are completed.' + result);
|
|
166
154
|
|
|
167
155
|
BUFFER.setItem("RESULT_DATA", result);
|
|
168
156
|
console.log("====> Result data :" + BUFFER.getItem("RESULT_DATA"))
|
|
169
157
|
|
|
170
|
-
|
|
158
|
+
/// const resultdetails = {}
|
|
171
159
|
resultdetails.excution_status = BUFFER.getItem("RESULT_DATA") == 0 ? 'PASSED' : 'FAILED'
|
|
172
160
|
console.log("====> Total Duration taken for the suite:" + BUFFER.getItem("FROTH_TOTAL_DURATION"));
|
|
173
161
|
console.log("====> Execution Status from results" + resultdetails.excution_status);
|
|
@@ -178,11 +166,9 @@ const commonconfig = {
|
|
|
178
166
|
},
|
|
179
167
|
|
|
180
168
|
afterSession: async function (config, capabilities, specs) {
|
|
181
|
-
console.log('==== AFTER SESSION HOOK ====');
|
|
182
|
-
|
|
183
169
|
console.log('====> This is the aftersession hook');
|
|
184
170
|
// Perform any cleanup or post-test actions here
|
|
185
|
-
|
|
171
|
+
console.log("Capabilities:", capabilities);
|
|
186
172
|
console.log("Specs:", specs);
|
|
187
173
|
console.log("Config:", config);
|
|
188
174
|
|
|
@@ -190,13 +176,11 @@ const commonconfig = {
|
|
|
190
176
|
let totalDuration = endtime - starttime;
|
|
191
177
|
console.log("====> Total Duration in after session based on start time and end time:" + totalDuration);
|
|
192
178
|
|
|
193
|
-
if (
|
|
179
|
+
if (isBrowserStackEnabled)
|
|
194
180
|
await getBSSessionDetails(process.env.BS_SESSION_TYPE, process.env.BROWSERSTACK_USERNAME, process.env.BROWSERSTACK_ACCESS_KEY);
|
|
195
181
|
|
|
196
|
-
const resultdetails = {}
|
|
197
182
|
resultdetails.excution_status = BUFFER.getItem("RESULT_DATA") == 0 ? 'PASSED' : 'FAILED'
|
|
198
183
|
console.log("====> Total Duration calculation:" + BUFFER.getItem("FROTH_TOTAL_DURATION") === 0 ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION")));
|
|
199
|
-
|
|
200
184
|
resultdetails.excution_time = BUFFER.getItem("FROTH_TOTAL_DURATION") === 0 ? await convertTimetoHHMMSS(totalDuration) : await secondsToTime(BUFFER.getItem("FROTH_TOTAL_DURATION"))
|
|
201
185
|
await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails)
|
|
202
186
|
BUFFER.clear();
|
|
@@ -206,18 +190,20 @@ const commonconfig = {
|
|
|
206
190
|
},
|
|
207
191
|
|
|
208
192
|
onComplete: async function (exitCode, config, capabilities, results) {
|
|
209
|
-
console.log('==== ON COMPLETE HOOK ====');
|
|
210
193
|
|
|
211
|
-
console.log('====>
|
|
194
|
+
console.log('====> This is the onComplete hook', results);
|
|
195
|
+
|
|
196
|
+
console.log('====> Test Results Summary ');
|
|
197
|
+
console.log('----------------------------');
|
|
212
198
|
|
|
213
|
-
console.log('==== Test Results Summary ======');
|
|
214
199
|
console.log('Total Tests:', results.total);
|
|
215
200
|
console.log('Passed:', results.passed);
|
|
216
201
|
console.log('Failed:', results.failed);
|
|
217
202
|
console.log('Skipped:', results.skipped);
|
|
218
203
|
console.log('Execution Time:', results.duration);
|
|
219
204
|
console.log('Exit Code:', exitCode);
|
|
220
|
-
|
|
205
|
+
|
|
206
|
+
console.log('====> All tests are done, exiting the browser session.');
|
|
221
207
|
|
|
222
208
|
}
|
|
223
209
|
|
|
@@ -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
|
+
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
const getLoginToken = require("../
|
|
2
|
-
const exeDetails = require("../
|
|
3
|
-
//const getintegrationdetails = require("../
|
|
4
|
-
const getSuiteDetails = require("../
|
|
5
|
-
const getDataById = require("../
|
|
1
|
+
const getLoginToken = require("../api/loginapi");
|
|
2
|
+
const exeDetails = require("../api/getexecutionDetails")
|
|
3
|
+
//const getintegrationdetails = require("../api/getintegrationDetails");
|
|
4
|
+
const getSuiteDetails = require("../api/getsuiteDetails");
|
|
5
|
+
const getDataById = require("../api/readTestdata");
|
|
6
|
+
|
|
6
7
|
|
|
7
8
|
async function generateBuildNumber() {
|
|
8
9
|
try {
|
|
@@ -41,17 +42,16 @@ async function setEnvVariables() {
|
|
|
41
42
|
BUFFER.setItem("FROTH_EXECUTION_ID", process.env.EXECUTION_ID || 1);
|
|
42
43
|
BUFFER.setItem("FROTH_INTEGRATION_ID", process.env.INTEGRATION_ID || 1);
|
|
43
44
|
BUFFER.setItem("ORGANISATION_DOMAIN_URL", process.env.ORGANISATION_DOMAIN_URL || "https://devapi.frothtestops.com");
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
console.log("api token in set evn variable :" + BUFFER.getItem("FROTH_LOGIN_TOKEN"))
|
|
45
|
+
BUFFER.setItem("SERVICE_USER", "frothbot@roboticodigital.com");
|
|
46
|
+
BUFFER.setItem("SERVICE_PASSWORD", "WVUVh7fZ+zMyJqtoe846cEHL0gXJWUk99KzUPu7d6AQUBIw0Ytn01QYObWMDMPma");
|
|
47
|
+
|
|
48
48
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
async function setLoginToken() {
|
|
52
52
|
try {
|
|
53
53
|
|
|
54
|
-
const getToken = await getLoginToken(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD"));
|
|
54
|
+
const getToken = await getLoginToken(BUFFER.getItem("ORGANISATION_DOMAIN_URL") , BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD"));
|
|
55
55
|
process.env.FROTH_LOGIN_TOKEN = getToken;
|
|
56
56
|
BUFFER.setItem("FROTH_LOGIN_TOKEN", getToken)
|
|
57
57
|
|
|
@@ -63,11 +63,7 @@ async function setLoginToken() {
|
|
|
63
63
|
async function setExecutionDetails() {
|
|
64
64
|
try {
|
|
65
65
|
const getExeDetails = await exeDetails.getExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"));
|
|
66
|
-
|
|
67
|
-
process.env.BROWSERSTACK_LOCAL = getExeDetails.browser_stack_local;
|
|
68
|
-
process.env.BROWSERSTACK_APP_PATH = getExeDetails.app_url;
|
|
69
|
-
process.env.MEDIA_FILES = JSON.stringify(getExeDetails.mediaurls);
|
|
70
|
-
console.log("Execution Details:", JSON.stringify(getExeDetails));
|
|
66
|
+
BUFFER.setItem("AUTOMATION_SUITE_ID", getExeDetails.automation_suite_id);
|
|
71
67
|
|
|
72
68
|
} catch (error) {
|
|
73
69
|
// console.error('Error in main function:', error);
|
|
@@ -77,9 +73,9 @@ async function setExecutionDetails() {
|
|
|
77
73
|
|
|
78
74
|
async function setSuiteDetails() {
|
|
79
75
|
try {
|
|
80
|
-
const getSuiteDetail = await getSuiteDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"),
|
|
81
|
-
|
|
82
|
-
|
|
76
|
+
const getSuiteDetail = await getSuiteDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("AUTOMATION_SUITE_ID"));
|
|
77
|
+
process.env.BROWSERSTACK_APP_PATH = getSuiteDetail.browser_stack_urls;
|
|
78
|
+
BUFFER.setItem("TESTDATA_ID", getSuiteDetail.test_data_id);
|
|
83
79
|
|
|
84
80
|
|
|
85
81
|
} catch (error) {
|
|
@@ -88,7 +84,7 @@ async function setSuiteDetails() {
|
|
|
88
84
|
}
|
|
89
85
|
async function setTestDataDetails() {
|
|
90
86
|
try {
|
|
91
|
-
const jsonobject = await getDataById(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"),
|
|
87
|
+
const jsonobject = await getDataById(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("TESTDATA_ID"));
|
|
92
88
|
|
|
93
89
|
} catch (error) {
|
|
94
90
|
// console.error('Error in main function:', error);
|
|
@@ -98,6 +94,7 @@ module.exports = {
|
|
|
98
94
|
setEnvVariables,
|
|
99
95
|
setLoginToken,
|
|
100
96
|
setExecutionDetails,
|
|
97
|
+
//setIntegrationsDetails,
|
|
101
98
|
setSuiteDetails,
|
|
102
99
|
setTestDataDetails
|
|
103
100
|
};
|