froth-webdriverio-framework 6.0.51 → 6.0.57

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.
@@ -1,6 +1,8 @@
1
1
  const path = require('path');
2
2
  const SUITE_FILE = path.resolve(process.cwd(), process.env.SUITE);
3
3
  console.log('====>SUITE_FILE:', SUITE_FILE);
4
+ const { LocalStorage } = require('node-localstorage');
5
+ global.BUFFER = new LocalStorage('./buffer_storage');
4
6
 
5
7
  module.exports = {
6
8
  specs: require(SUITE_FILE).tests,
@@ -1,39 +1,56 @@
1
1
 
2
- const commonHooks = require('../commonhook');
3
- module.exports = (bsCaps) => ({
4
-
5
- //...commonHooks,
6
- user: bsCaps.userName,
7
- key: Buffer.from(bsCaps.accessKey, 'base64').toString('utf-8'),
8
-
9
- services: [
10
- [
11
- 'browserstack',
12
- {
13
- buildIdentifier: process.env.BROWSERSTACK_BUILD_NAME || 'local-build',
14
- browserstackLocal: false,
15
- opts: {
16
- forcelocal: false,
17
- localIdentifier: `wdio-${process.pid}`,
2
+ //const commonHooks = require('../commonhook');
3
+ const setAllDetails = require('../setallDatailinBuffer');
4
+
5
+ function preRequisite() {
6
+ setAllDetails.setEnvVariables();
7
+ const getExeDetails = setAllDetails.setExecutionDetails();
8
+ // console.log("app url in prerequisite;" + getExeDetails.app_url)
9
+ const appurl = process.env.BROWSERSTACK_APP_PATH || getExeDetails.app_url
10
+ console.log("app utl is" + appurl)
11
+ // getExeDetails.app_url=process.env.BROWSERSTACK_APP_PATH
12
+ return appurl
13
+ }
14
+
15
+ module.exports = (bsCaps) => {
16
+ const appPath = preRequisite();
17
+ return {
18
+ //...commonHooks,
19
+ user: bsCaps.userName,
20
+ key: Buffer.from(bsCaps.accessKey, 'base64').toString('utf-8'),
21
+
22
+ services: [
23
+ [
24
+ 'browserstack',
25
+ {
26
+ buildIdentifier: process.env.BROWSERSTACK_BUILD_NAME || 'local-build',
27
+ browserstackLocal: false,
28
+ opts: {
29
+ forcelocal: false,
30
+ localIdentifier: `wdio-${process.pid}`,
31
+ },
32
+ app: appPath,
18
33
  },
19
- app: process.env.BROWSERSTACK_APP_PATH||'bs://30fdf3a163d0bad126f64a3d5713e9ab0086a41e',
20
- },
34
+ ],
21
35
  ],
22
- ],
23
-
24
-
25
- capabilities: [{
26
- 'bstack:options': {
27
- projectName: 'BrowserStack Samples',
28
- buildName: 'browserstack build',
29
- sessionName: 'Mobile Test',
30
- deviceName: bsCaps.deviceName || 'Samsung Galaxy S22 Ultra',
31
- osVersion: bsCaps.platformVersion || '12.0',
32
- debug: bsCaps.debug,
33
- networkLogs: bsCaps.networkLogs,
34
- interactiveDebugging: bsCaps.interactiveDebugging
35
- }
36
- }],
37
-
38
- updateJob: false
39
- });
36
+
37
+
38
+ capabilities: [{
39
+ platformName: bsCaps.platformName || 'Android',
40
+ //'appium:app': appPath,
41
+ 'bstack:options': {
42
+ projectName: 'BrowserStack Samples',
43
+ buildName: 'browserstack build',
44
+ sessionName: 'Mobile Test',
45
+ deviceName: bsCaps.deviceName || 'Samsung Galaxy S22 Ultra',
46
+ osVersion: bsCaps.platformVersion || '12.0',
47
+ debug: bsCaps.debug,
48
+ networkLogs: bsCaps.networkLogs,
49
+ interactiveDebugging: bsCaps.interactiveDebugging,
50
+
51
+ }
52
+ }],
53
+
54
+ updateJob: false
55
+ };
56
+ }
@@ -2,7 +2,12 @@ const getLoginToken = require("../froth_api_calls/loginapi");
2
2
  const exeDetails = require("../froth_api_calls/getexecutionDetails")
3
3
  const getSuiteDetails = require("../froth_api_calls/getsuiteDetails");
4
4
  const getDataById = require("../froth_api_calls/readTestdata");
5
-
5
+ BUFFER.setItem("FROTH_TOTAL_DURATION", 0);
6
+ BUFFER.setItem("FROTH_EXECUTION_ID", process.env.EXECUTION_ID || 1);
7
+ BUFFER.setItem("ORGANISATION_DOMAIN_URL", process.env.ORGANISATION_DOMAIN_URL || "https://devapi.frothtestops.com");
8
+ BUFFER.setItem("FROTH_LOGIN_TOKEN", process.env.API_TOKEN)
9
+ console.log("api token in set evn variable :" + BUFFER.getItem("FROTH_LOGIN_TOKEN"))
10
+ console.log("CICD_RUN_ID in set evn variable :" + process.env.CICD_RUN_ID)
6
11
  async function generateBuildNumber() {
7
12
  try {
8
13
  const now = await new Date();
@@ -63,7 +68,7 @@ async function setExecutionDetails() {
63
68
  process.env.AUTOMATION_SUITE_ID = getExeDetails.automation_suite_id;
64
69
  // process.env.EXEC_BROWSERSTACK_LOCAL =
65
70
  // String(getExeDetails.browser_stack_local);
66
- process.env.BROWSERSTACK_APP_PATH = getExeDetails.app_url;
71
+ process.env.BROWSERSTACK_APP_PATH = getExeDetails.app_url == undefined ? '' : getExeDetails.app_url;
67
72
  process.env.MEDIA_FILES = JSON.stringify(getExeDetails.mediaurls);
68
73
  console.log("Execution Details:", JSON.stringify(getExeDetails));
69
74
 
@@ -5,8 +5,8 @@ const path = require('path');
5
5
  const fs = require('fs');
6
6
  const yaml = require('js-yaml');
7
7
  const setAllDetails = require('./setallDatailinBuffer');
8
- const { LocalStorage } = require('node-localstorage');
9
- global.BUFFER = new LocalStorage('./buffer_storage');
8
+
9
+
10
10
  let envConfig;
11
11
  let bsCaps;
12
12
 
@@ -68,3 +68,28 @@ if (PLATFORM === 'browserstack') {
68
68
 
69
69
  exports.config = deepmerge(baseConfig, envConfig(bsCaps));
70
70
 
71
+ // Merge base + env config
72
+ //const finalConfig = deepmerge(baseConfig, envConfig(bsCaps));
73
+
74
+ // --------------------
75
+ // Before session hook to dynamically update app
76
+ // --------------------
77
+ // finalConfig.beforeSession = async function (config, capabilities, specs) {
78
+ // if (OS === 'mobile') {
79
+ // console.log('====> Updating app before session');
80
+ // await setAllDetails.setEnvVariables();
81
+ // getExeDetails = await setAllDetails.setExecutionDetails();
82
+ // await setAllDetails.setSuiteDetails();
83
+ // await setAllDetails.setTestDataDetails();
84
+
85
+ // // const appPath = process.env.BROWSERSTACK_APP_PATH || bsCaps.app;
86
+ // // // Find the browserstack service object
87
+ // // const bsService = config.services.find(s => Array.isArray(s) && s[0] === 'browserstack');
88
+ // // if (bsService && bsService[1]) {
89
+ // // bsService[1].app = process.env.BROWSERSTACK_APP_PATH || bsCaps.app;
90
+ // // console.log('====> App path set to:', bsService[1].app);
91
+ // // }
92
+ // };
93
+ // }
94
+
95
+ //exports.config = finalConfig;