froth-webdriverio-framework 6.0.34 → 6.0.36

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,219 +0,0 @@
1
- async function swipeleft(selector, xoffset, speedinsec) {
2
- try {
3
- console.log('Swiping left');
4
-
5
- if (xoffset == null) {
6
- driver.swipeLeft(selector, speedinsec);
7
- } else {
8
- driver.swipeLeft(selector, xoffset, speedinsec);
9
- }
10
- } catch (error) {
11
- console.error(error.message);
12
- }
13
-
14
- }
15
-
16
- async function swiperight(selector, xoffset, speedinsec) {
17
- try {
18
- console.log('Swiping right');
19
-
20
- if (xoffset == null) {
21
- driver.swipeRight(selector, speedinsec);
22
- } else {
23
- driver.swipeRight(selector, xoffset, speedinsec);
24
- }
25
- } catch (error) {
26
- console.error(error.message);
27
- }
28
-
29
- }
30
-
31
- async function swipeup(selector, yoffset, speedinsec) {
32
- try {
33
- console.log('Swiping up');
34
-
35
- if (yoffset == null) {
36
- driver.swipeUp(selector, speedinsec);
37
- } else {
38
- driver.swipeUp(selector, yoffset, speedinsec);
39
- }
40
- } catch (error) {
41
- console.error(error.message);
42
- }
43
- }
44
-
45
- async function swipedown(selector, yoffset, speedinsec) {
46
- try {
47
- console.log('Swiping down');
48
-
49
- if (yoffset == null) {
50
- driver.swipeDown(selector, speedinsec);
51
- } else {
52
- driver.swipeDown(selector, yoffset, speedinsec);
53
- }
54
- } catch (error) {
55
- console.error(error.message);
56
- }
57
- }
58
-
59
- async function swipewithcoordinates(StartX, StartY, EndX, EndY) {
60
-
61
- await driver.performActions([
62
- {
63
- type: "pointer",
64
- id: "finger1",
65
- parameters: { pointerType: "touch" },
66
- actions: [
67
- { type: "pointerMove", duration: 0, x: StartX, y: StartY },
68
- { type: "pointerDown", button: 0 },
69
- { type: "pause", duration: 300 },
70
- { type: "pointerMove", duration: 1000, x: EndX, y: EndY },
71
- { type: "pointerUp", button: 0 }
72
- ],
73
- }
74
- ]);
75
- }
76
- async function swipetofit() {
77
- // Get screen size dynamically
78
- const screenSize = await driver.getWindowRect();
79
- const screenWidth = screenSize.width;
80
- const screenHeight = screenSize.height;
81
-
82
- console.log(`Screen Size: Width=${screenWidth}, Height=${screenHeight}`);
83
-
84
- // Define approximate positions for corners
85
- const topRightStartX = screenWidth * 0.88; // Top-right corner
86
- const topRightStartY = screenHeight * 0.44;
87
-
88
- const topRightEndX = screenWidth * 0.96; // Expand to the right
89
- const topRightEndY = screenHeight * 0.39; // Move upwards slightly
90
-
91
- const bottomLeftStartX = screenWidth * 0.12; // Bottom-left corner
92
- const bottomLeftStartY = screenHeight * 0.69;
93
-
94
- const bottomLeftEndX = screenWidth * 0.014; // Expand to the left
95
- const bottomLeftEndY = screenHeight * 0.73; // Move down slightly
96
-
97
- console.log(`Resizing top-right from (${topRightStartX}, ${topRightStartY}) to (${topRightEndX}, ${topRightEndY})`);
98
- console.log(`Resizing bottom-left from (${bottomLeftStartX}, ${bottomLeftStartY}) to (${bottomLeftEndX}, ${bottomLeftEndY})`);
99
-
100
- // Resize from top-right corner
101
- await driver.performActions([
102
- {
103
- type: "pointer",
104
- id: "finger1",
105
- parameters: { pointerType: "touch" },
106
- actions: [
107
- { type: "pointerMove", duration: 0, x: topRightStartX, y: topRightStartY },
108
- { type: "pointerDown", button: 0 },
109
- { type: "pause", duration: 300 },
110
- { type: "pointerMove", duration: 1000, x: topRightEndX, y: topRightEndY },
111
- { type: "pointerUp", button: 0 }
112
- ],
113
- }
114
- ]);
115
-
116
- // Resize from bottom-left corner
117
- await driver.performActions([
118
- {
119
- type: "pointer",
120
- id: "finger2",
121
- parameters: { pointerType: "touch" },
122
- actions: [
123
- { type: "pointerMove", duration: 0, x: bottomLeftStartX, y: bottomLeftStartY },
124
- { type: "pointerDown", button: 0 },
125
- { type: "pause", duration: 300 },
126
- { type: "pointerMove", duration: 1000, x: bottomLeftEndX, y: bottomLeftEndY },
127
- { type: "pointerUp", button: 0 }
128
- ],
129
- }
130
- ]);
131
-
132
- console.log("✅ Crop overlay resized from two corners successfully!");
133
- }
134
-
135
- // async function swipetofit(TopRStartXpct, TopRStartYpct, TopREndXpct, TopREndYpct, BottomLStartXpct, BottomLStartYpct, BottomLEndXpct, BottomLEndYpct) {
136
-
137
- // let topRightStartX; // Top-right corner
138
- // let topRightStartY;
139
-
140
- // let topRightEndX; // Expand to the right
141
- // let topRightEndY; // Move upwards slightly
142
-
143
- // let bottomLeftStartX; // Bottom-left corner
144
- // let bottomLeftStartY;
145
-
146
- // let bottomLeftEndX; // Expand to the left
147
- // let bottomLeftEndY;
148
-
149
- // // Get screen size dynamically
150
- // const screenSize = await driver.getWindowRect();
151
- // const screenWidth = screenSize.width;
152
- // const screenHeight = screenSize.height;
153
-
154
- // console.log(`Screen Size: Width=${screenWidth}, Height=${screenHeight}`);
155
- // // Define approximate positions for corners
156
-
157
- // if (TopRStartXpct === null) {// default calucaltion
158
- // topRightStartX = screenWidth * 0.88; // Top-right corner
159
- // topRightStartY = screenHeight * 0.44;
160
-
161
- // topRightEndX = screenWidth * 0.96; // Expand to the right
162
- // topRightEndY = screenHeight * 0.39; // Move upwards slightly
163
-
164
- // bottomLeftStartX = screenWidth * 0.12; // Bottom-left corner
165
- // bottomLeftStartY = screenHeight * 0.69;
166
-
167
- // bottomLeftEndX = screenWidth * 0.014; // Expand to the left
168
- // bottomLeftEndY = screenHeight * 0.73;
169
- // } else {
170
- // topRightStartX = screenWidth * (TopRStartXpct / 100); // Top-right corner
171
- // topRightStartY = screenHeight * (TopRStartYpct / 100);
172
-
173
- // topRightEndX = screenWidth * (TopREndXpct / 100); // Expand to the right
174
- // topRightEndY = screenHeight * (TopREndYpct / 100); // Move upwards slightly
175
-
176
- // bottomLeftStartX = screenWidth * (BottomLStartXpct / 100); // Bottom-left corner
177
- // bottomLeftStartY = screenHeight * (BottomLStartYpct / 100);
178
-
179
- // bottomLeftEndX = screenWidth * (BottomLEndXpct / 100); // Expand to the left
180
- // bottomLeftEndY = screenHeight * (BottomLEndYpct / 100); // Move down slightly
181
- // }
182
- // console.log(`Resizing top-right from (${topRightStartX}, ${topRightStartY}) to (${topRightEndX}, ${topRightEndY})`);
183
- // console.log(`Resizing bottom-left from (${bottomLeftStartX}, ${bottomLeftStartY}) to (${bottomLeftEndX}, ${bottomLeftEndY})`);
184
-
185
- // // Resize from top-right corner
186
- // await driver.performActions([
187
- // {
188
- // type: "pointer",
189
- // id: "finger1",
190
- // parameters: { pointerType: "touch" },
191
- // actions: [
192
- // { type: "pointerMove", duration: 0, x: topRightStartX, y: topRightStartY },
193
- // { type: "pointerDown", button: 0 },
194
- // { type: "pause", duration: 300 },
195
- // { type: "pointerMove", duration: 1000, x: topRightEndX, y: topRightEndY },
196
- // { type: "pointerUp", button: 0 }
197
- // ],
198
- // }
199
- // ]);
200
-
201
- // // Resize from bottom-left corner
202
- // await driver.performActions([
203
- // {
204
- // type: "pointer",
205
- // id: "finger2",
206
- // parameters: { pointerType: "touch" },
207
- // actions: [
208
- // { type: "pointerMove", duration: 0, x: bottomLeftStartX, y: bottomLeftStartY },
209
- // { type: "pointerDown", button: 0 },
210
- // { type: "pause", duration: 300 },
211
- // { type: "pointerMove", duration: 1000, x: bottomLeftEndX, y: bottomLeftEndY },
212
- // { type: "pointerUp", button: 0 }
213
- // ],
214
- // }
215
- // ]);
216
-
217
- // console.log("✅ Crop overlay resized from two corners successfully!");
218
- // }
219
- module.exports = { swipeleft, swipedown, swiperight, swipeup, swipetofit, swipewithcoordinates };
@@ -1,51 +0,0 @@
1
- const path = require('path');
2
- const SUITE_FILE = path.resolve(process.cwd(), process.env.SUITE);
3
- console.log('====>SUITE_FILE IN BASE CONFIG:', SUITE_FILE);
4
- const setAllDetails = require("./setallDatailinBuffer.js")
5
- //we have to set here the browserstack environment variables before the config export
6
- process.env.BROWSERSTACK_USERNAME='naveen_OSt3Pw'
7
- process.env.BROWSERSTACK_ACCESS_KEY= 'B9Rx28MTKFzRJ2QEVK1c'
8
- console.log('====BROWSERSTACK_APP_PATH before baseconfig ', process.env.BROWSERSTACK_APP_PATH);
9
- console.log('====BROWSERSTACK_USERNAME before baseconfig ', process.env.BROWSERSTACK_USERNAME);
10
- console.log('====BROWSERSTACK_ACCESS_KEY before baseconfig ', process.env.BROWSERSTACK_ACCESS_KEY);
11
-
12
- exports.config = {
13
- onPrepare: async function (config, capabilities) {
14
- try {
15
-
16
- console.log('==== ON PREPARE HOOK ====');
17
- // This code runs before the test suite starts
18
- await setAllDetails.setEnvVariables();
19
- await setAllDetails.setExecutionDetails();
20
- await setAllDetails.setSuiteDetails();
21
- await setAllDetails.setTestDataDetails();
22
- console.log("on prepare:", JSON.stringify(capabilities))
23
- console.log("BS USERNAME:", process.env.BROWSERSTACK_USERNAME)
24
- console.log("BS ACCESS KEY:", process.env.BROWSERSTACK_ACCESS_KEY)
25
- // console.log("ALL JSON DATA in env variable :" + JSON.stringify(process.env));
26
- } catch (e) {
27
- console.log("====> Error in onPrepare:", e);
28
-
29
- }
30
- },
31
-
32
-
33
- updateJob: false,
34
- specs: require(SUITE_FILE).tests,
35
- exclude: [],
36
-
37
- logLevel: 'warn',
38
- coloredLogs: true,
39
- screenshotPath: './errorShots/',
40
- baseUrl: '',
41
- waitforTimeout: 10000,
42
- connectionRetryTimeout: 120000,
43
- connectionRetryCount: 3,
44
- hostname: 'hub.browserstack.com',
45
- // services: [['browserstack']],
46
- framework: 'mocha',
47
- mochaOpts: {
48
- ui: 'bdd',
49
- timeout: 60000,
50
- },
51
- };
@@ -1,100 +0,0 @@
1
- const getLoginToken = require("../froth_api_calls/loginapi");
2
- const exeDetails = require("../froth_api_calls/getexecutionDetails")
3
- //const getintegrationdetails = require("../froth_api_calls/getintegrationDetails");
4
- const getSuiteDetails = require("../froth_api_calls/getsuiteDetails");
5
- const getDataById = require("../froth_api_calls/readTestdata");
6
-
7
- async function generateBuildNumber() {
8
- try {
9
- const now = await new Date();
10
- const timestamp = await formatDate(now); // Format date as needed
11
-
12
- // Construct the build number with timestamp and counter
13
- const buildNumber = `${timestamp}`;
14
- process.env.BUILD_NUMBER = buildNumber;
15
- console.log("Generated Build Number:", buildNumber);
16
- // Increment the counter for the next build
17
- } catch (error) {
18
- console.log("error in generateBuildNumber")
19
- }
20
- //return buildNumber;
21
- }
22
-
23
- async function formatDate(date) {
24
- const year = await date.getFullYear();
25
- const month = await padZero(date.getMonth() + 1); // Month is zero-indexed
26
- const day = await padZero(date.getDate());
27
- const hours = await padZero(date.getHours());
28
- const minutes = await padZero(date.getMinutes());
29
- const seconds =await padZero(date.getSeconds());
30
-
31
- return `${year}${month}${day}_${hours}${minutes}${seconds}`;
32
- }
33
-
34
- async function padZero(num) {
35
- return await num.toString().padStart(2, '0');
36
- }
37
-
38
- async function setEnvVariables() {
39
- await generateBuildNumber();
40
- await BUFFER.setItem("FROTH_TOTAL_DURATION", 0);
41
- await BUFFER.setItem("FROTH_EXECUTION_ID", process.env.EXECUTION_ID || 1);
42
- await BUFFER.setItem("ORGANISATION_DOMAIN_URL", process.env.ORGANISATION_DOMAIN_URL || "https://devapi.frothtestops.com");
43
- await BUFFER.setItem("FROTH_LOGIN_TOKEN", process.env.API_TOKEN)
44
- console.log("api token in set evn variable :" + BUFFER.getItem("FROTH_LOGIN_TOKEN"))
45
- console.log("CICD_RUN_ID in set evn variable :" + process.env.CICD_RUN_ID)
46
- }
47
-
48
- async function setLoginToken() {
49
- try {
50
-
51
- const getToken = await getLoginToken(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("SERVICE_USER"), BUFFER.getItem("SERVICE_PASSWORD"));
52
- process.env.FROTH_LOGIN_TOKEN = getToken;
53
- BUFFER.setItem("FROTH_LOGIN_TOKEN", getToken)
54
-
55
- } catch (error) {
56
- // console.error('Error in main function:', error);
57
- }
58
- }
59
-
60
- async function setExecutionDetails() {
61
- try {
62
- const getExeDetails = await exeDetails.getExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"));
63
- process.env.AUTOMATION_SUITE_ID = getExeDetails.automation_suite_id;
64
- process.env.BROWSERSTACK_LOCAL = getExeDetails.browser_stack_local;
65
- process.env.BROWSERSTACK_APP_PATH = getExeDetails.app_url;
66
- process.env.MEDIA_FILES = JSON.stringify(getExeDetails.mediaurls);
67
- console.log("Execution Details:", JSON.stringify(getExeDetails));
68
-
69
- } catch (error) {
70
- // console.error('Error in main function:', error);
71
- }
72
- }
73
-
74
-
75
- async function setSuiteDetails() {
76
- try {
77
- const getSuiteDetail = await getSuiteDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), process.env.AUTOMATION_SUITE_ID);
78
- BUFFER.setItem("FROTHE_SUITE_DETAILS", JSON.stringify(getSuiteDetail.script_details))
79
- process.env.TESTDATA_ID = getSuiteDetail.test_data_id;
80
- return getSuiteDetail;
81
-
82
- } catch (error) {
83
- // console.error('Error in main function:', error);
84
- }
85
- }
86
- async function setTestDataDetails() {
87
- try {
88
- const jsonobject = await getDataById(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), process.env.TESTDATA_ID);
89
-
90
- } catch (error) {
91
- // console.error('Error in main function:', error);
92
- }
93
- }
94
- module.exports = {
95
- setEnvVariables,
96
- setLoginToken,
97
- setExecutionDetails,
98
- setSuiteDetails,
99
- setTestDataDetails
100
- };
@@ -1,35 +0,0 @@
1
- const { config: baseConfig } = require('./baseconfig.js');
2
-
3
- const parallelConfig = {
4
- maxInstances: 10,
5
- commonCapabilities: {
6
- 'bstack:options': {
7
- buildName: 'browserstack build',
8
- source: 'webdriverio:sample-master:v1.2'
9
- }
10
- },
11
- services: [
12
- [
13
- 'browserstack',
14
- { buildIdentifier: '#${BUILD_NUMBER}' },
15
- ],
16
- ],
17
- capabilities: [
18
- {
19
- browserName: 'chrome',
20
- browserVersion: 'latest',
21
- 'bstack:options': {
22
- os: 'Windows',
23
- osVersion: '10',
24
- },
25
- }
26
- ],
27
- };
28
-
29
- exports.config = { ...baseConfig, ...parallelConfig };
30
-
31
- // Code to support common capabilities
32
- exports.config.capabilities.forEach(function (caps) {
33
- for (var i in exports.config.commonCapabilities)
34
- caps[i] = { ...caps[i], ...exports.config.commonCapabilities[i]};
35
- });
@@ -1,171 +0,0 @@
1
- const deepmerge = require('deepmerge')
2
- const fs = require('fs');
3
- const yaml = require('js-yaml');
4
- const path = require('path');
5
- const commonconfig = require('./commonconfig');
6
- console.log('=====wdios common config===== ');
7
- // Select platform at runtime
8
- const PLATFORM = process.env.PLATFORM || 'browserstack';
9
- console.log('====>PLATFORM:', PLATFORM);
10
-
11
- const configFile = process.env.YML_NAME;
12
-
13
- const resultdetails = {
14
- comments: [],
15
- excution_status: null, // Pass/Fail
16
- excution_time: null, // Execution time in milliseconds
17
- };
18
-
19
- // Load YAML file
20
- //const capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
21
-
22
- let capabilities;
23
-
24
- try {
25
- capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
26
- // Merge chrome-specific options if applicable
27
-
28
- } catch (e) {
29
- const errorMsg = `The capability file does not exist in the currently configured repository at path: ${path.resolve(process.cwd(), configFile)}: ${e.message},Please update the Capability by editing the file`;
30
- console.error(errorMsg);
31
- resultdetails.comments.push(errorMsg);
32
- resultdetails.excution_status = 'FAIL';
33
-
34
- try {
35
- exeDetails.updateExecuitonDetails(
36
- process.env.ORGANISATION_DOMAIN_URL,
37
- process.env.API_TOKEN,
38
- process.env.EXECUTION_ID,
39
- resultdetails
40
- );
41
- setTimeout(() => {
42
- console.log("30 seconds passed.");
43
- // You can call your API or exit the process here
44
- }, 30000);
45
- console.log('Execution details updated successfully.');
46
- } catch (err) {
47
- console.error('Failed to update execution details:', err.message);
48
- }
49
- process.exit(1);
50
- }
51
- console.log('====>capabilities:', capabilities);
52
-
53
- const SUITE_FILE = path.resolve(process.cwd(), process.env.SUITE);
54
- console.log('====>SUITE_FILE:', SUITE_FILE);
55
-
56
- if (!SUITE_FILE || !fs.existsSync(SUITE_FILE)) {
57
- let errorMsg = `The suite file does not exist in the currently configured repository at path: ${SUITE_FILE}. Please update the SUITE by editing the file`;
58
-
59
- console.error(errorMsg);
60
- resultdetails.comments.push(errorMsg);
61
- resultdetails.excution_status = 'FAIL';
62
-
63
- // Fire API call in background (non-blocking)
64
-
65
- try {
66
- exeDetails.updateExecuitonDetails(
67
- process.env.ORGANISATION_DOMAIN_URL,
68
- process.env.API_TOKEN,
69
- process.env.EXECUTION_ID,
70
- resultdetails
71
- );
72
- setTimeout(() => {
73
- console.log("30 seconds passed.");
74
- // You can call your API or exit the process here
75
- }, 30000);
76
- console.log('Execution details updated successfully.');
77
- } catch (err) {
78
- console.error('Failed to update execution details:', err.message);
79
- }
80
- process.exit(1);
81
- }
82
-
83
- function setupPrerequisites() {
84
- console.log("inside this fuction first ");
85
- if (PLATFORM === 'browserstack') {
86
- process.env.BROWSERSTACK_USERNAME = capabilities.userName;
87
- capabilities.accessKey = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
88
- process.env.BROWSERSTACK_ACCESS_KEY = capabilities.accessKey
89
-
90
- console.log('capabilities.platformName:', capabilities.platformName ?? 'web');
91
- process.env.BS_SESSION_TYPE = capabilities.platformName === 'android' || capabilities.platformName === 'ios' ? 'app-automate' : 'automate';
92
- capabilities.buildName = process.env.FROTH_TESTOPS_BUILD_NAME;
93
-
94
- }
95
-
96
- }
97
-
98
- const specificConfig = setupPrerequisites();
99
-
100
-
101
- exports.config = deepmerge(commonconfig,
102
-
103
- {
104
- user: process.env.BROWSERSTACK_USERNAME||'naveen_OSt3Pw',
105
- key: process.env.BROWSERSTACK_ACCESS_KEY||'B9Rx28MTKFzRJ2QEVK1c',
106
- // debug: true,
107
- // services: PLATFORM === 'browserstack'
108
- // ? ['browserstack']
109
- // : PLATFORM === 'saucelabs'
110
- // ? ['sauce']
111
- // : [],
112
-
113
- services: [
114
- [
115
- 'browserstack',
116
- {
117
- buildIdentifier: '${BUILD_NUMBER}',
118
- browserstackLocal: false,
119
- opts: { forcelocal: false, localIdentifier: "webdriverio-appium-app-browserstack-android-repo" },
120
- app: 'bs://0bfd506ea937c227cf29d0d5ef55f2520a8f7a29' || '/Users/subhrasubudhi/WORKSPACES/WEBDRIVERIO/SAMPLE_BS_LOCAL_PROJECT/android/examples/LocalSample.apk'
121
- }
122
- ]
123
- ],
124
-
125
- //runner: 'local',
126
- specs: require(SUITE_FILE).tests,
127
-
128
- maxInstances: 1,
129
- // capabilities: [capabilities],
130
- // capabilities: [{
131
- // // capabilities for local Appium web tests on an Android Emulator
132
- // platformName: 'Android',
133
- // browserName: 'Chrome',
134
- // 'appium:app': 'bs://30fdf3a163d0bad126f64a3d5713e9ab0086a41e',
135
- // 'appium:deviceName': 'Samsung Galaxy S22 Ultra',
136
- // 'appium:platformVersion': '12.0',
137
- // 'appium:automationName': 'UiAutomator2'
138
- // }],
139
-
140
- capabilities: [{
141
- 'bstack:options': {
142
- projectName: "BrowserStack Samples",
143
- buildName: 'browserstack build',
144
- sessionName: 'BStack local webdriverio-appium',
145
- deviceName: 'Samsung Galaxy S22 Ultra',
146
- osVersion: "12.0",
147
- debug: true,
148
- networkLogs: true,
149
- source: 'webdriverio:appium-sample-sdk:v1.0',
150
- interactiveDebugging: true,
151
- 'appium:autoWebview': false
152
- }
153
- }],
154
- logLevel: 'info',
155
- coloredLogs: true,
156
- screenshotPath: './errorShots/',
157
- bail: 0,
158
- //baseUrl: 'https://example.com',
159
- waitforTimeout: 90000,
160
- connectionRetryTimeout: 90000,
161
- connectionRetryCount: 3,
162
-
163
- framework: 'mocha',
164
- reporters: ['spec'],
165
- maxInstances: 10,
166
- updateJob: false,
167
- mochaOpts: {
168
- ui: 'bdd',
169
- timeout: 300000
170
- }
171
- });
package/local.log DELETED
@@ -1 +0,0 @@
1
-
File without changes