froth-webdriverio-framework 3.0.98 → 3.0.100
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.
|
@@ -8,6 +8,7 @@ const { fail } = require("assert");
|
|
|
8
8
|
//const isBrowserStackEnabled = process.env.BROWSERSTACK;
|
|
9
9
|
let starttime;
|
|
10
10
|
let endtime;
|
|
11
|
+
console.log('===== common config===== ');
|
|
11
12
|
|
|
12
13
|
// Description: This file contains the common configuration for the webdriverio framework.
|
|
13
14
|
const commonconfig = {
|
|
@@ -15,7 +16,7 @@ const commonconfig = {
|
|
|
15
16
|
|
|
16
17
|
onPrepare: async function (capabilities, specs) {
|
|
17
18
|
try {
|
|
18
|
-
console.log('
|
|
19
|
+
console.log('==== ON PREPARE HOOK ====');
|
|
19
20
|
// This code runs before the test suite starts
|
|
20
21
|
await setAllDetails.setEnvVariables();
|
|
21
22
|
await setAllDetails.setLoginToken();
|
|
@@ -34,7 +35,7 @@ const commonconfig = {
|
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
beforeSession: async function (config, capabilities, specs) {
|
|
37
|
-
console.log('
|
|
38
|
+
console.log('==== BEFORE SESSION HOOK ====');
|
|
38
39
|
// Perform any setup or pre-test actions here
|
|
39
40
|
// console.log("Capabilities:", capabilities);
|
|
40
41
|
|
|
@@ -43,6 +44,7 @@ const commonconfig = {
|
|
|
43
44
|
|
|
44
45
|
if (process.env.PLATFORM === 'browserstack') {
|
|
45
46
|
/// console.log("capabilities:", capabilities);
|
|
47
|
+
// capabilities.accessKey = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
|
|
46
48
|
capabilities.app = process.env.BROWSERSTACK_APP_PATH;
|
|
47
49
|
capabilities.browserstackLocal = process.env.BROWSERSTACK_LOCAL;
|
|
48
50
|
if (process.env.MEDIA_FILES)
|
|
@@ -58,6 +60,8 @@ const commonconfig = {
|
|
|
58
60
|
*/
|
|
59
61
|
beforeSuite: async function (suite) {
|
|
60
62
|
try {
|
|
63
|
+
console.log('==== BEFORE SUITE HOOK ====');
|
|
64
|
+
|
|
61
65
|
console.log(`====> Test suite has been started ' ${suite.title}' `,);
|
|
62
66
|
|
|
63
67
|
starttime = new Date().getTime();
|
|
@@ -79,6 +83,7 @@ const commonconfig = {
|
|
|
79
83
|
* @param {object} context scope object the test was executed with
|
|
80
84
|
*/
|
|
81
85
|
beforeTest: function (test, context) {
|
|
86
|
+
console.log('==== BEFORE TEST HOOK ====');
|
|
82
87
|
console.log(`====> Test Started '${test.title}'`);
|
|
83
88
|
|
|
84
89
|
// console.log("File Name:", test.file);
|
|
@@ -97,6 +102,8 @@ const commonconfig = {
|
|
|
97
102
|
* @param {object} result.retries information about spec related retries, e.g. `{ attempts: 0, limit: 0 }`
|
|
98
103
|
*/
|
|
99
104
|
afterTest: async function (test, context, { error, result, duration, passed, retries }) {
|
|
105
|
+
console.log('==== AFTER TEST HOOK ====');
|
|
106
|
+
|
|
100
107
|
console.log(`====> Test name finished '${test.title}'`);
|
|
101
108
|
|
|
102
109
|
const fileName = path.basename(test.file);
|
|
@@ -133,6 +140,8 @@ const commonconfig = {
|
|
|
133
140
|
* @param {object} suite suite details
|
|
134
141
|
*/
|
|
135
142
|
afterSuite: function (suite) {
|
|
143
|
+
console.log('==== AFTER SUITE HOOK ====');
|
|
144
|
+
|
|
136
145
|
console.log(`====> Test suite has completed '${suite.title}'`);
|
|
137
146
|
},
|
|
138
147
|
/**
|
|
@@ -143,6 +152,8 @@ const commonconfig = {
|
|
|
143
152
|
* @param {Array.<String>} specs List of spec file paths that ran
|
|
144
153
|
*/
|
|
145
154
|
after: async function (result, config, capabilities, specs) {
|
|
155
|
+
console.log('==== AFTER HOOK ====');
|
|
156
|
+
|
|
146
157
|
console.log('====> All tests are completed.' + result);
|
|
147
158
|
|
|
148
159
|
BUFFER.setItem("RESULT_DATA", result);
|
|
@@ -159,6 +170,8 @@ const commonconfig = {
|
|
|
159
170
|
},
|
|
160
171
|
|
|
161
172
|
afterSession: async function (config, capabilities, specs) {
|
|
173
|
+
console.log('==== AFTER SESSION HOOK ====');
|
|
174
|
+
|
|
162
175
|
console.log('====> This is the aftersession hook');
|
|
163
176
|
// Perform any cleanup or post-test actions here
|
|
164
177
|
// console.log("Capabilities:", capabilities);
|
|
@@ -185,19 +198,18 @@ const commonconfig = {
|
|
|
185
198
|
},
|
|
186
199
|
|
|
187
200
|
onComplete: async function (exitCode, config, capabilities, results) {
|
|
201
|
+
console.log('==== ON COMPLETE HOOK ====');
|
|
188
202
|
|
|
189
|
-
console.log('====>
|
|
190
|
-
|
|
191
|
-
console.log('====> Test Results Summary ');
|
|
192
|
-
console.log('----------------------------');
|
|
203
|
+
console.log('====> Results:', results);
|
|
193
204
|
|
|
205
|
+
console.log('==== Test Results Summary ======');
|
|
194
206
|
console.log('Total Tests:', results.total);
|
|
195
207
|
console.log('Passed:', results.passed);
|
|
196
208
|
console.log('Failed:', results.failed);
|
|
197
209
|
console.log('Skipped:', results.skipped);
|
|
198
210
|
console.log('Execution Time:', results.duration);
|
|
199
211
|
console.log('Exit Code:', exitCode);
|
|
200
|
-
console.log('
|
|
212
|
+
console.log('==== ALL TESTS ARE COMPLETED ====');
|
|
201
213
|
|
|
202
214
|
}
|
|
203
215
|
|
|
@@ -67,6 +67,8 @@ async function setExecutionDetails() {
|
|
|
67
67
|
BUFFER.setItem("BROWSERSTACK_LOCAL", getExeDetails.browser_stack_local);
|
|
68
68
|
BUFFER.setItem("BROWSERSTACK_APP_PATH", getExeDetails.app_url);
|
|
69
69
|
BUFFER.setItem("MEDIA_FILES", getExeDetails.mediaurls);
|
|
70
|
+
console.log("Execution Details:", JSON.stringify(getExeDetails));
|
|
71
|
+
console.log("Execution Details:", JSON.stringify(BUFFER));
|
|
70
72
|
|
|
71
73
|
} catch (error) {
|
|
72
74
|
// console.error('Error in main function:', error);
|
|
@@ -3,39 +3,40 @@ const fs = require('fs');
|
|
|
3
3
|
const yaml = require('js-yaml');
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const commonconfig = require('./commonconfig');
|
|
6
|
+
console.log('=====wdios common config===== ');
|
|
6
7
|
|
|
7
8
|
// Select platform at runtime
|
|
8
9
|
const PLATFORM = process.env.PLATFORM || 'browserstack';
|
|
9
|
-
const configFile =
|
|
10
|
-
console.log('PLATFORM:', PLATFORM);
|
|
10
|
+
const configFile = process.env.YML_NAME || '../ymls/browserstack/android/android_caps.yml';
|
|
11
|
+
console.log('====>PLATFORM:', PLATFORM);
|
|
11
12
|
// Load YAML file
|
|
12
|
-
const capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(),configFile)), 'utf8'));
|
|
13
|
-
console.log('capabilities:', capabilities);
|
|
14
|
-
console.log('capabilities.userName:', capabilities.userName);
|
|
15
|
-
console.log('capabilities.accessKey:',Buffer.from(capabilities.accessKey, 'base64').toString('utf-8'));
|
|
16
|
-
const acesskey = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
|
|
17
|
-
console.log('acesskey:', acesskey);
|
|
13
|
+
const capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
|
|
14
|
+
console.log('====>capabilities:', capabilities);
|
|
18
15
|
const SUITE_FILE = path.resolve(process.cwd(), process.env.SUITE);
|
|
16
|
+
console.log('====>SUITE_FILE:', SUITE_FILE);
|
|
19
17
|
|
|
20
|
-
console.log('SUITE_FILE:', SUITE_FILE);
|
|
21
18
|
|
|
22
|
-
|
|
19
|
+
function setupPrerequisites() {
|
|
20
|
+
console.log("inside this fuction first ");
|
|
21
|
+
if (PLATFORM === 'browserstack') {
|
|
22
|
+
process.env.BROWSERSTACK_USERNAME = capabilities.userName;
|
|
23
|
+
capabilities.accessKey = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
|
|
24
|
+
process.env.BROWSERSTACK_ACCESS_KEY = capabilities.accessKey
|
|
25
|
+
console.log('capabilities.platformName:', capabilities.platformName);
|
|
26
|
+
process.env.BS_SESSION_TYPE = capabilities.platformName === 'android' || capabilities.platformName === 'ios' ? 'app-automate' : 'automate';
|
|
27
|
+
capabilities.buildName = process.env.BROWSERSTACK_BUILD_NAME;
|
|
23
28
|
|
|
29
|
+
}
|
|
30
|
+
}
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
console.log("i m inside this if condition first")
|
|
27
|
-
process.env.BROWSERSTACK_USERNAME = capabilities.userName;
|
|
28
|
-
process.env.BROWSERSTACK_ACCESS_KEY = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
|
|
29
|
-
console.log('capabilities.platformName:', capabilities.platformName);
|
|
30
|
-
process.env.BS_SESSION_TYPE = capabilities.platformName === 'android' || capabilities.platformName === 'ios' ? 'app-automate' : 'automate';
|
|
32
|
+
const specificConfig = setupPrerequisites();
|
|
31
33
|
|
|
32
|
-
}
|
|
33
34
|
|
|
34
|
-
exports.config = deepmerge(commonconfig,
|
|
35
|
+
exports.config = deepmerge.all([commonconfig, specificConfig,
|
|
35
36
|
|
|
36
37
|
{
|
|
37
38
|
user: capabilities.userName,
|
|
38
|
-
key:
|
|
39
|
+
key: capabilities.accessKey,
|
|
39
40
|
// debug: true,
|
|
40
41
|
// execArgv: ['--inspect-brk'],
|
|
41
42
|
services: PLATFORM === 'browserstack'
|
|
@@ -67,6 +68,6 @@ exports.config = deepmerge(commonconfig,
|
|
|
67
68
|
ui: 'bdd',
|
|
68
69
|
timeout: 300000
|
|
69
70
|
}
|
|
70
|
-
});
|
|
71
|
+
}]);
|
|
71
72
|
|
|
72
73
|
|