froth-webdriverio-framework 6.0.27 → 6.0.29

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,35 +1,171 @@
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'
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);
9
48
  }
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
- },
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);
25
79
  }
26
- ],
27
- };
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,
105
+ key: process.env.BROWSERSTACK_ACCESS_KEY,
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
+ // }],
28
139
 
29
- exports.config = { ...baseConfig, ...parallelConfig };
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,
30
162
 
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
- });
163
+ framework: 'mocha',
164
+ reporters: ['spec'],
165
+ maxInstances: 10,
166
+ updateJob: false,
167
+ mochaOpts: {
168
+ ui: 'bdd',
169
+ timeout: 300000
170
+ }
171
+ });
@@ -0,0 +1,35 @@
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
+ });
@@ -778,5 +778,45 @@
778
778
  "success": true,
779
779
  "failure": null,
780
780
  "worker": 54754
781
+ },
782
+ {
783
+ "name": "sdk:testhub",
784
+ "entryType": "measure",
785
+ "startTime": 714.3458049893379,
786
+ "duration": 1072.4630480408669,
787
+ "detail": null,
788
+ "success": true,
789
+ "failure": null,
790
+ "worker": 83388
791
+ },
792
+ {
793
+ "name": "sdk:percy",
794
+ "entryType": "measure",
795
+ "startTime": 1791.6393840312958,
796
+ "duration": 737.1757879853249,
797
+ "detail": null,
798
+ "success": false,
799
+ "failure": {},
800
+ "worker": 83388
801
+ },
802
+ {
803
+ "name": "sdk:automate:local",
804
+ "entryType": "measure",
805
+ "startTime": 2529.694791018963,
806
+ "duration": 0.2753220200538635,
807
+ "detail": null,
808
+ "success": true,
809
+ "failure": null,
810
+ "worker": 83388
811
+ },
812
+ {
813
+ "name": "sdk:automate:hub-management",
814
+ "entryType": "measure",
815
+ "startTime": 7639.939525008202,
816
+ "duration": 2239.9980480074883,
817
+ "detail": null,
818
+ "success": true,
819
+ "failure": null,
820
+ "worker": 83388
781
821
  }
782
822
  ]