froth-webdriverio-framework 6.0.35 → 6.0.37

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.
@@ -0,0 +1,202 @@
1
+ //const Util = require('../froth_common_actions/Utils.js');
2
+
3
+ describe('Yes Shop Prepaid Registration', () => {
4
+
5
+ it('Yes Shop Prepaid Registration', async () => {
6
+
7
+ // // File URLs from BrowserStack
8
+ // const links =await Util.F.extractEmailLinks.getEmailLinks('un','apppwd','subject','fromemail')
9
+ // const foundLink = await Util.F.extractEmailLinks.findLinks(links,'texttofind')
10
+
11
+ // const idCardFileUrl = "https://drive.google.com/file/d/1t5KZ7a6JLS97khFnuUS-_aOa6EY4a9H0/view?usp=sharing"; // Replace with actual file ID for ID card
12
+ // const videoFileUrl = "https://drive.google.com/file/d/1PYMY2LQ-GFFKJ1wC5yRNflcxfA3ATgvW/view?usp=sharing"; // Replace with actual file ID for video
13
+ const el1 = await driver.$("id:com.ytlcomms.ymca:id/yesLogoIv");
14
+ await el1.click();
15
+ await el1.click();
16
+ await el1.click();
17
+ await el1.click();
18
+ await el1.click();
19
+ await el1.click();
20
+ await el1.click();
21
+ await el1.click();
22
+ await el1.click();
23
+ await el1.click();
24
+ const el2 = await driver.$("id:com.ytlcomms.ymca:id/etBetaUserId");
25
+ await el2.addValue("alpha_login");
26
+ const el3 = await driver.$("id:com.ytlcomms.ymca:id/etBetaUserPass");
27
+ await el3.addValue("@45kj*3d");
28
+ const el411 = await driver.$("id:com.ytlcomms.ymca:id/btBetaSignIn");
29
+ await el411.click();
30
+ const el51 = await driver.$("id:com.ytlcomms.ymca:id/iotUrl");
31
+ await el51.click();
32
+ /*To scroll to the down of the screen until text is visible */
33
+ //await Util.scrollDownToView("GO BACK")
34
+
35
+ const el61 = await driver.$("id:com.ytlcomms.ymca:id/btGoBack");
36
+ await el61.click();
37
+ const el71 = await driver.$("id:com.ytlcomms.ymca:id/mUserId");
38
+ await el71.addValue("pdc_branch");
39
+ const el81 = await driver.$("id:com.ytlcomms.ymca:id/mPassword");
40
+ await el81.addValue("ytlc@xm1234");
41
+ const el91 = await driver.$("id:com.ytlcomms.ymca:id/btSignIn");
42
+ await el91.click();
43
+ // Start the automation script
44
+ const el4 = await driver.$("-android uiautomator:new UiSelector().text(\"Registration\")");
45
+ await el4.click();
46
+
47
+ const el5 = await driver.$("-android uiautomator:new UiSelector().text(\"Prepaid\")");
48
+ await el5.click();
49
+
50
+ // Trigger ID card upload
51
+ const el6 = await driver.$("id:com.ytlcomms.ymca:id/ekycMyKadBtn");
52
+ await el6.click();
53
+
54
+ const el7 = await driver.$("id:com.android.permissioncontroller:id/permission_allow_one_time_button");
55
+ await el7.click();
56
+
57
+ const el8 = await driver.$("id:com.ytlcomms.ymca:id/ekycMyKadBtn");
58
+ await el8.click();
59
+
60
+ const el9 = await driver.$("id:com.ytlcomms.ymca:id/skipBtn");
61
+ await el9.click();
62
+
63
+ const el10 = await driver.$("id:com.ytlcomms.ymca:id/selectCountryBtn");
64
+ await el10.click();
65
+
66
+ await driver.execute('browserstack_executor: {"action":"cameraImageInjection", "arguments": {"imageUrl" : "media://b44ff746563b5e458e2b5034d3cb25263ad24ebd"}}');
67
+
68
+ const el11 = await driver.$("id:com.ytlcomms.ymca:id/confirmBtn");
69
+ await el11.click();
70
+ await driver.pause(3000)
71
+
72
+ const el12 = await driver.$("id:com.sec.android.app.camera:id/bottom_background");
73
+ await el12.click();
74
+
75
+ await driver.pause(3000)
76
+
77
+ ////android.widget.Button[@resource-id="com.sec.android.app.camera:id/okay"]
78
+
79
+ const el13 = await driver.$("//android.widget.Button[@resource-id='com.sec.android.app.camera:id/okay']");
80
+ await el13.click();
81
+ // const el29 = await driver.$("id:com.ytlcomms.ymca:id/selectCountryBtn");
82
+ // await el29.click();
83
+
84
+ await driver.pause(10000)
85
+ try {
86
+ await driver.action('pointer')
87
+ .move({
88
+ duration: 0,
89
+ x: 937,
90
+ y: 905
91
+ })
92
+ .down({
93
+ button: 0
94
+ })
95
+ .move({
96
+ duration: 1000,
97
+ x: 1043,
98
+ y: 696
99
+ })
100
+ .up({
101
+ button: 0
102
+ })
103
+ .perform();
104
+
105
+
106
+ } catch (e) {
107
+ console.error('Error in right :', e);
108
+
109
+ }
110
+ try {
111
+ await driver.action('pointer')
112
+ .move({
113
+ duration: 0,
114
+ x: 134,
115
+ y: 1498
116
+ })
117
+ .down({
118
+ button: 0
119
+ })
120
+ .move({
121
+ duration: 1000,
122
+ x: 28,
123
+ y: 1723
124
+ })
125
+ .up({
126
+ button: 0
127
+ })
128
+ .perform();
129
+
130
+ //
131
+ } catch (e) {
132
+ console.error('Error in left:', e);
133
+
134
+ }
135
+ await driver.pause(10000) // Confirm upload
136
+
137
+ const el16 = await driver.$("//android.widget.TextView[@text='Done']");
138
+ await el16.click();
139
+
140
+ await driver.pause(30000)
141
+ const el17 = await driver.$("id:com.ytlcomms.ymca:id/newRb");
142
+ await el17.click();
143
+
144
+ // await Util.F.scrollDownToView("Facial Recognition")
145
+
146
+ const el18 = await driver.$("id:com.ytlcomms.ymca:id/frRecognitionBtn");
147
+ await el18.click();
148
+ const el19 = await driver.$("id:com.ytlcomms.ymca:id/skipBtn");
149
+ await el19.click();
150
+
151
+ await driver.execute('browserstack_executor: {"action":"cameraVideoInjection", "arguments": {"videoUrl" : "media://1920c80136e1c7e2278e15d820845ed64a676e92"}}');
152
+
153
+ const el20 = await driver.$("id:com.ytlcomms.ymca:id/startBtn");
154
+ await el20.click();
155
+
156
+ await driver.pause(3000)
157
+
158
+ const el21 = await driver.$("id:com.ytlcomms.ymca:id/captureVideo");
159
+ await el21.click();
160
+
161
+ await driver.pause(10000)
162
+
163
+ ////android.widget.Button[@resource-id="com.sec.android.app.camera:id/okay"]
164
+
165
+ // const el13 = await driver.$("//android.widget.Button[@resource-id='com.sec.android.app.camera:id/okay']");
166
+ // await el13.click();
167
+ //99999999
168
+
169
+
170
+ // Trigger video upload for face recognition
171
+ // const el18 = await driver.$("id:com.ytlcomms.ymca:id/frRecognitionBtn");
172
+ // await el18.click();
173
+ // await driver.execute("mobile: uploadFile", { file: videoFileUrl }); // Upload video
174
+
175
+ // Complete the remaining flow
176
+ const el25 = await driver.$("-android uiautomator:new UiSelector().text('-- PLAN --')");
177
+ await el25.click();
178
+
179
+ const el26 = await driver.$("-android uiautomator:new UiSelector().text('YES 5G Prepaid')");
180
+ await el26.click();
181
+
182
+ const el44 = await driver.$("id:com.ytlcomms.ymca:id/submitBtn");
183
+ await el44.click();
184
+
185
+ const el40 = await driver.$("id:com.ytlcomms.ymca:id/eSimRb");
186
+ await el40.click();
187
+ const el41 = await driver.$("id:com.ytlcomms.ymca:id/optionalMobTitleLabel");
188
+ await el41.click();
189
+ //add scroll here
190
+
191
+ const el42 = await driver.$("-android uiautomator:new UiSelector().text('01117242402')");
192
+ await el42.click();
193
+ const el43 = await driver.$("id:com.ytlcomms.ymca:id/md_buttonDefaultPositive");
194
+ await el43.click();
195
+ //add scroll to end here
196
+
197
+ const el45 = await driver.$("id:com.ytlcomms.ymca:id/submitBtn");
198
+ await el45.click();
199
+
200
+
201
+ });
202
+ });
@@ -0,0 +1,13 @@
1
+ const path = require('path');
2
+ const fileNames = ['samplescript_x.js']; // Maintain order
3
+ const androidFolder = path.resolve(process.cwd(), './android');
4
+
5
+ const selectedFiles = fileNames.map(file => path.resolve(androidFolder, file));
6
+
7
+ module.exports = {
8
+ tests: [
9
+ selectedFiles
10
+ ]
11
+ };
12
+
13
+
@@ -76,38 +76,38 @@ const commonconfig = {
76
76
  process.exit(1);
77
77
  }
78
78
  // set the capability like media and app and bs local
79
- if (process.env.PLATFORM === 'browserstack') {
80
- /// console.log("capabilities:", capabilities);
81
- capabilities.browserstackLocal = process.env.BROWSERSTACK_LOCAL;
82
- // capabilities.accessKey = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
83
- if (capabilities.platformName === 'android' || capabilities.platformName === 'ios') {
84
- capabilities.app = process.env.BROWSERSTACK_APP_PATH;
85
- if (capabilities.app === undefined || capabilities.app === null || capabilities.app === '') {
86
- console.error("🚨 Error: BROWSERSTACK_APP_PATH is not defined or empty.");
87
- resultdetails.excution_status = 'FAILED';
88
- resultdetails.comments.push("BROWSERSTACK_APP_PATH is not defined or empty.");
89
- await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails);
90
- process.exit(1); // Stop execution if app path is not set
91
- } else {
92
- console.log("App Path:", capabilities.app);
93
- console.log("Browserstack Local:", capabilities.browserstackLocal);
94
- }
95
- }
96
-
97
- try {
98
- let mediaFiles = process.env.MEDIA_FILES ? JSON.parse(process.env.MEDIA_FILES) : [];
99
- console.log("Size of Media Files:", Array.isArray(mediaFiles) ? mediaFiles.length : "Invalid data");
100
-
101
- if (Array.isArray(mediaFiles) && mediaFiles.length > 0) {
102
- console.log("Media Files:", JSON.parse(process.env.MEDIA_FILES));
103
- capabilities['browserstack.uploadMedia'] = JSON.parse(process.env.MEDIA_FILES);
104
- }
105
- } catch (error) {
106
- console.error("Error parsing MEDIA_FILES:", error);
107
- }
108
-
109
- console.log(`Running tests on after app,bslocal,mediafiles: ${JSON.stringify(capabilities)}`);
110
- }
79
+ // if (process.env.PLATFORM === 'browserstack') {
80
+ // /// console.log("capabilities:", capabilities);
81
+ // capabilities.browserstackLocal = process.env.BROWSERSTACK_LOCAL;
82
+ // // capabilities.accessKey = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
83
+ // if (capabilities.platformName === 'android' || capabilities.platformName === 'ios') {
84
+ // capabilities.app = process.env.BROWSERSTACK_APP_PATH;
85
+ // if (capabilities.app === undefined || capabilities.app === null || capabilities.app === '') {
86
+ // console.error("🚨 Error: BROWSERSTACK_APP_PATH is not defined or empty.");
87
+ // resultdetails.excution_status = 'FAILED';
88
+ // resultdetails.comments.push("BROWSERSTACK_APP_PATH is not defined or empty.");
89
+ // await exeDetails.updateExecuitonDetails(BUFFER.getItem("ORGANISATION_DOMAIN_URL"), BUFFER.getItem("FROTH_LOGIN_TOKEN"), BUFFER.getItem("FROTH_EXECUTION_ID"), resultdetails);
90
+ // process.exit(1); // Stop execution if app path is not set
91
+ // } else {
92
+ // console.log("App Path:", capabilities.app);
93
+ // console.log("Browserstack Local:", capabilities.browserstackLocal);
94
+ // }
95
+ // }
96
+
97
+ // try {
98
+ // let mediaFiles = process.env.MEDIA_FILES ? JSON.parse(process.env.MEDIA_FILES) : [];
99
+ // console.log("Size of Media Files:", Array.isArray(mediaFiles) ? mediaFiles.length : "Invalid data");
100
+
101
+ // if (Array.isArray(mediaFiles) && mediaFiles.length > 0) {
102
+ // console.log("Media Files:", JSON.parse(process.env.MEDIA_FILES));
103
+ // capabilities['browserstack.uploadMedia'] = JSON.parse(process.env.MEDIA_FILES);
104
+ // }
105
+ // } catch (error) {
106
+ // console.error("Error parsing MEDIA_FILES:", error);
107
+ // }
108
+
109
+ // console.log(`Running tests on after app,bslocal,mediafiles: ${JSON.stringify(capabilities)}`);
110
+ // }
111
111
 
112
112
  } catch (error) {
113
113
  console.error('🚨 Error in beforeSession:', error);
@@ -1,138 +1,50 @@
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
-
8
- // Select platform at runtime
9
- const PLATFORM = process.env.PLATFORM || 'browserstack';
10
- console.log('====>PLATFORM:', PLATFORM);
11
-
12
- const configFile = process.env.YML_NAME;
13
-
14
- const resultdetails = {
15
- comments: [],
16
- excution_status: null, // Pass/Fail
17
- excution_time: null, // Execution time in milliseconds
18
- };
19
-
20
- // Load YAML file
21
- //const capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
22
-
23
- let capabilities;
24
-
25
- try {
26
- capabilities = yaml.load(fs.readFileSync(path.join(path.resolve(process.cwd(), configFile)), 'utf8'));
27
- // Merge chrome-specific options if applicable
28
-
29
- } catch (e) {
30
- 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`;
31
- console.error(errorMsg);
32
- resultdetails.comments.push(errorMsg);
33
- resultdetails.excution_status = 'FAIL';
34
-
35
- try {
36
- exeDetails.updateExecuitonDetails(
37
- process.env.ORGANISATION_DOMAIN_URL,
38
- process.env.API_TOKEN,
39
- process.env.EXECUTION_ID,
40
- resultdetails
41
- );
42
- setTimeout(() => {
43
- console.log("30 seconds passed.");
44
- // You can call your API or exit the process here
45
- }, 30000);
46
- console.log('Execution details updated successfully.');
47
- } catch (err) {
48
- console.error('Failed to update execution details:', err.message);
49
- }
50
- process.exit(1);
51
- }
52
- console.log('====>capabilities:', capabilities);
53
-
54
- const SUITE_FILE = path.resolve(process.cwd(), process.env.SUITE);
55
- console.log('====>SUITE_FILE:', SUITE_FILE);
56
-
57
- if (!SUITE_FILE || !fs.existsSync(SUITE_FILE)) {
58
- 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`;
59
-
60
- console.error(errorMsg);
61
- resultdetails.comments.push(errorMsg);
62
- resultdetails.excution_status = 'FAIL';
63
-
64
- // Fire API call in background (non-blocking)
65
-
66
- try {
67
- exeDetails.updateExecuitonDetails(
68
- process.env.ORGANISATION_DOMAIN_URL,
69
- process.env.API_TOKEN,
70
- process.env.EXECUTION_ID,
71
- resultdetails
72
- );
73
- setTimeout(() => {
74
- console.log("30 seconds passed.");
75
- // You can call your API or exit the process here
76
- }, 30000);
77
- console.log('Execution details updated successfully.');
78
- } catch (err) {
79
- console.error('Failed to update execution details:', err.message);
1
+ exports.config = {
2
+ user: process.env.BROWSERSTACK_USERNAME || 'naveen_OSt3Pw',
3
+ key: process.env.BROWSERSTACK_ACCESS_KEY || 'B9Rx28MTKFzRJ2QEVK1c',
4
+ services: [
5
+ [
6
+ 'browserstack',
7
+ {
8
+ buildIdentifier: '${BUILD_NUMBER}',
9
+ browserstackLocal: false,
10
+ opts: { forcelocal: false, localIdentifier: "webdriverio-appium-app-browserstack-android-repo" },
11
+ app: process.env.BROWSERSTACK_APP_PATH || '/Users/subhrasubudhi/WORKSPACES/WEBDRIVERIO/SAMPLE_BS_LOCAL_PROJECT/android/examples/LocalSample.apk'
12
+ }
13
+ ]
14
+ ],
15
+
16
+ capabilities: [{
17
+ 'bstack:options': {
18
+ projectName: "BrowserStack Samples",
19
+ buildName: 'browserstack build',
20
+ sessionName: 'BStack local webdriverio-appium',
21
+ deviceName: 'Samsung Galaxy S22 Ultra',
22
+ osVersion: "12.0",
23
+ debug: true,
24
+ networkLogs: true,
25
+ source: 'webdriverio:appium-sample-sdk:v1.0',
26
+ interactiveDebugging: true,
27
+ 'appium:autoWebview': false
80
28
  }
81
- process.exit(1);
82
- }
83
-
84
- function setupPrerequisites() {
85
- console.log("inside this fuction first ");
86
- if (PLATFORM === 'browserstack') {
87
- process.env.BROWSERSTACK_USERNAME = capabilities.userName;
88
- capabilities.accessKey = Buffer.from(capabilities.accessKey, 'base64').toString('utf-8');
89
- process.env.BROWSERSTACK_ACCESS_KEY = capabilities.accessKey
90
-
91
- console.log('capabilities.platformName:', capabilities.platformName ?? 'web');
92
- process.env.BS_SESSION_TYPE = capabilities.platformName === 'android' || capabilities.platformName === 'ios' ? 'app-automate' : 'automate';
93
- capabilities.buildName = process.env.FROTH_TESTOPS_BUILD_NAME;
94
-
95
- }
96
-
97
- }
98
-
99
- const specificConfig = setupPrerequisites();
100
-
101
-
102
- exports.config = deepmerge(commonconfig,
103
-
104
- {
105
- user: process.env.BROWSERSTACK_USERNAME,
106
- key: process.env.BROWSERSTACK_ACCESS_KEY,
107
- // debug: true,
108
- // execArgv: ['--inspect-brk'],
109
- services: PLATFORM === 'browserstack'
110
- ? ['browserstack']
111
- : PLATFORM === 'saucelabs'
112
- ? ['sauce']
113
- : [],
114
-
115
- //runner: 'local',
116
- specs: require(SUITE_FILE).tests,
117
-
118
- maxInstances: 1,
119
- capabilities: [capabilities],
120
-
121
- logLevel: 'info',
122
- coloredLogs: true,
123
- screenshotPath: './errorShots/',
124
- bail: 0,
125
- //baseUrl: 'https://example.com',
126
- waitforTimeout: 90000,
127
- connectionRetryTimeout: 90000,
128
- connectionRetryCount: 3,
129
-
130
- framework: 'mocha',
131
- reporters: ['spec'],
132
- maxInstances: 10,
133
- updateJob: false,
134
- mochaOpts: {
135
- ui: 'bdd',
136
- timeout: 300000
137
- }
138
- });
29
+ }],
30
+
31
+ updateJob: false,
32
+ specs: [
33
+ '/Users/subhrasubudhi/WORKSPACES/WEBDRIVERIO/SAMPLE_BS_LOCAL_PROJECT/android/examples/run-local-test/specs/local_test.js'
34
+ ],
35
+ exclude: [],
36
+
37
+ logLevel: 'info',
38
+ coloredLogs: true,
39
+ screenshotPath: './errorShots/',
40
+ baseUrl: '',
41
+ waitforTimeout: 10000,
42
+ connectionRetryTimeout: 90000,
43
+ connectionRetryCount: 3,
44
+
45
+ framework: 'mocha',
46
+ mochaOpts: {
47
+ ui: 'bdd',
48
+ timeout: 20000
49
+ }
50
+ };