froth-webdriverio-framework 0.1.41 → 0.1.43
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/api/readTestdata.js +2 -0
- package/config/commonconfig.js +11 -3
- package/package.json +1 -1
package/api/readTestdata.js
CHANGED
|
@@ -48,6 +48,8 @@ async function getDataById(frothUrl, id) {
|
|
|
48
48
|
} else {
|
|
49
49
|
console.error('Error fetching data: Invalid ID');
|
|
50
50
|
process.env.BUFFER = '{"sdsf":"vlaue1","schbsaxa":"xbsahxash"}';
|
|
51
|
+
const jsonobject = {"abc":"valueabc","def":"valuedef"};
|
|
52
|
+
return jsonobject;
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
}
|
package/config/commonconfig.js
CHANGED
|
@@ -13,16 +13,24 @@ const commonconfig = {
|
|
|
13
13
|
* @param {Object} config wdio configuration object
|
|
14
14
|
* @param {Array.<Object>} capabilities list of capabilities details
|
|
15
15
|
*/
|
|
16
|
-
onPrepare: function (capabilities, specs) {
|
|
16
|
+
onPrepare: async function (capabilities, specs) {
|
|
17
17
|
// This code runs before the test suite starts
|
|
18
18
|
console.log('Preparing for tests... IN ONPREPARE HOOK');
|
|
19
19
|
console.log("organisation url" + process.env.organisation_url);
|
|
20
20
|
console.log("test data id" + process.env.testdata_id);
|
|
21
21
|
process.env.BUFFER = null;
|
|
22
22
|
console.log("process.env.BUFFER in before " + process.env.BUFFER);
|
|
23
|
-
getDataById(process.env.organisation_url, process.env.testdata_id);
|
|
23
|
+
const jsonobject = await getDataById(process.env.organisation_url, process.env.testdata_id);
|
|
24
24
|
// You can perform any setup tasks here
|
|
25
|
-
global.myGlobalVariable =
|
|
25
|
+
global.myGlobalVariable = jsonobject;
|
|
26
|
+
|
|
27
|
+
console.log("global variable: " + JSON.stringify(global.myGlobalVariable));
|
|
28
|
+
if (global.myGlobalVariable) {
|
|
29
|
+
console.log("global variable2: " + global.myGlobalVariable.abc);
|
|
30
|
+
} else {
|
|
31
|
+
console.log("Global variable is not set.");
|
|
32
|
+
}
|
|
33
|
+
|
|
26
34
|
|
|
27
35
|
// If you need to perform asynchronous actions, use the 'beforeSession' hook instead
|
|
28
36
|
},
|