froth-webdriverio-framework 3.0.99 → 3.0.101

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('====> This is the onPrepare hook');
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('====> This is the beforesession hook');
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,7 +44,7 @@ const commonconfig = {
43
44
 
44
45
  if (process.env.PLATFORM === 'browserstack') {
45
46
  /// console.log("capabilities:", capabilities);
46
- capabilities.accessKey = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
47
+ // capabilities.accessKey = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
47
48
  capabilities.app = process.env.BROWSERSTACK_APP_PATH;
48
49
  capabilities.browserstackLocal = process.env.BROWSERSTACK_LOCAL;
49
50
  if (process.env.MEDIA_FILES)
@@ -59,6 +60,8 @@ const commonconfig = {
59
60
  */
60
61
  beforeSuite: async function (suite) {
61
62
  try {
63
+ console.log('==== BEFORE SUITE HOOK ====');
64
+
62
65
  console.log(`====> Test suite has been started ' ${suite.title}' `,);
63
66
 
64
67
  starttime = new Date().getTime();
@@ -80,6 +83,7 @@ const commonconfig = {
80
83
  * @param {object} context scope object the test was executed with
81
84
  */
82
85
  beforeTest: function (test, context) {
86
+ console.log('==== BEFORE TEST HOOK ====');
83
87
  console.log(`====> Test Started '${test.title}'`);
84
88
 
85
89
  // console.log("File Name:", test.file);
@@ -98,6 +102,8 @@ const commonconfig = {
98
102
  * @param {object} result.retries information about spec related retries, e.g. `{ attempts: 0, limit: 0 }`
99
103
  */
100
104
  afterTest: async function (test, context, { error, result, duration, passed, retries }) {
105
+ console.log('==== AFTER TEST HOOK ====');
106
+
101
107
  console.log(`====> Test name finished '${test.title}'`);
102
108
 
103
109
  const fileName = path.basename(test.file);
@@ -134,6 +140,8 @@ const commonconfig = {
134
140
  * @param {object} suite suite details
135
141
  */
136
142
  afterSuite: function (suite) {
143
+ console.log('==== AFTER SUITE HOOK ====');
144
+
137
145
  console.log(`====> Test suite has completed '${suite.title}'`);
138
146
  },
139
147
  /**
@@ -144,6 +152,8 @@ const commonconfig = {
144
152
  * @param {Array.<String>} specs List of spec file paths that ran
145
153
  */
146
154
  after: async function (result, config, capabilities, specs) {
155
+ console.log('==== AFTER HOOK ====');
156
+
147
157
  console.log('====> All tests are completed.' + result);
148
158
 
149
159
  BUFFER.setItem("RESULT_DATA", result);
@@ -160,6 +170,8 @@ const commonconfig = {
160
170
  },
161
171
 
162
172
  afterSession: async function (config, capabilities, specs) {
173
+ console.log('==== AFTER SESSION HOOK ====');
174
+
163
175
  console.log('====> This is the aftersession hook');
164
176
  // Perform any cleanup or post-test actions here
165
177
  // console.log("Capabilities:", capabilities);
@@ -186,19 +198,18 @@ const commonconfig = {
186
198
  },
187
199
 
188
200
  onComplete: async function (exitCode, config, capabilities, results) {
201
+ console.log('==== ON COMPLETE HOOK ====');
189
202
 
190
- console.log('====> This is the onComplete hook', results);
191
-
192
- console.log('====> Test Results Summary ');
193
- console.log('----------------------------');
203
+ console.log('====> Results:', results);
194
204
 
205
+ console.log('==== Test Results Summary ======');
195
206
  console.log('Total Tests:', results.total);
196
207
  console.log('Passed:', results.passed);
197
208
  console.log('Failed:', results.failed);
198
209
  console.log('Skipped:', results.skipped);
199
210
  console.log('Execution Time:', results.duration);
200
211
  console.log('Exit Code:', exitCode);
201
- console.log('====> All tests are done, exiting the browser session.');
212
+ console.log('==== ALL TESTS ARE COMPLETED ====');
202
213
 
203
214
  }
204
215
 
@@ -3,36 +3,41 @@ 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 = process.env.YML_NAME || '../ymls/browserstack/android/android_caps.yml';
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
-
13
+ const capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
14
+ console.log('====>capabilities:', capabilities);
15
15
  const SUITE_FILE = path.resolve(process.cwd(), process.env.SUITE);
16
+ console.log('====>SUITE_FILE:', SUITE_FILE);
16
17
 
17
- console.log('SUITE_FILE:', SUITE_FILE);
18
18
 
19
- capabilities.buildName = process.env.BROWSERSTACK_BUILD_NAME;
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;
20
28
 
29
+ }
30
+
31
+ }
21
32
 
22
- if (PLATFORM === 'browserstack') {
23
- console.log("i m inside this if condition first")
24
- process.env.BROWSERSTACK_USERNAME = capabilities.userName;
25
- process.env.BROWSERSTACK_ACCESS_KEY = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
26
- console.log('capabilities.platformName:', capabilities.platformName);
27
- process.env.BS_SESSION_TYPE = capabilities.platformName === 'android' || capabilities.platformName === 'ios' ? 'app-automate' : 'automate';
33
+ const specificConfig = setupPrerequisites();
28
34
 
29
- }
30
35
 
31
36
  exports.config = deepmerge(commonconfig,
32
37
 
33
38
  {
34
- user: capabilities.userName,
35
- key: capabilities.accessKey,
39
+ user: process.env.BROWSERSTACK_USERNAME,
40
+ key: process.env.BROWSERSTACK_ACCESS_KEY ,
36
41
  // debug: true,
37
42
  // execArgv: ['--inspect-brk'],
38
43
  services: PLATFORM === 'browserstack'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "froth-webdriverio-framework",
3
- "version": "3.0.99",
3
+ "version": "3.0.101",
4
4
  "readme": "WebdriverIO Integration",
5
5
  "description": "WebdriverIO and BrowserStack App Automate",
6
6
  "license": "MIT",