browserstack-cypress-cli 1.31.9 → 1.32.0
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/bin/accessibility-automation/cypress/index.js +274 -276
- package/bin/accessibility-automation/helper.js +41 -27
- package/bin/accessibility-automation/plugin/index.js +2 -3
- package/bin/commands/generateReport.js +7 -8
- package/bin/commands/info.js +39 -38
- package/bin/commands/runs.js +9 -11
- package/bin/commands/stop.js +0 -1
- package/bin/helpers/atsHelper.js +48 -39
- package/bin/helpers/build.js +39 -31
- package/bin/helpers/buildArtifacts.js +91 -71
- package/bin/helpers/capabilityHelper.js +4 -0
- package/bin/helpers/checkUploaded.js +43 -33
- package/bin/helpers/downloadBuildStacktrace.js +23 -14
- package/bin/helpers/getInitialDetails.js +33 -22
- package/bin/helpers/helper.js +10 -2
- package/bin/helpers/reporterHTML.js +57 -39
- package/bin/helpers/sync/syncSpecsLogs.js +36 -23
- package/bin/helpers/usageReporting.js +52 -34
- package/bin/helpers/utils.js +96 -77
- package/bin/helpers/zipUpload.js +61 -85
- package/bin/testObservability/crashReporter/index.js +23 -14
- package/bin/testObservability/cypress/index.js +7 -7
- package/bin/testObservability/helper/helper.js +59 -43
- package/bin/testObservability/helper/requestQueueHandler.js +2 -2
- package/bin/testObservability/plugin/ipcServer.js +6 -6
- package/bin/testObservability/reporter/index.js +8 -10
- package/package.json +5 -4
package/bin/helpers/zipUpload.js
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
fs = require("fs");
|
|
3
|
+
const fs = require("fs");
|
|
5
4
|
|
|
6
5
|
const cliProgress = require('cli-progress');
|
|
6
|
+
const { default: axios } = require("axios");
|
|
7
|
+
const FormData = require("form-data");
|
|
7
8
|
|
|
8
9
|
const config = require("./config"),
|
|
9
10
|
logger = require("./logger").winstonLogger,
|
|
10
11
|
Constants = require("./constants"),
|
|
11
12
|
utils = require("./utils");
|
|
12
13
|
|
|
14
|
+
const { setAxiosProxy } = require('./helper');
|
|
13
15
|
|
|
14
16
|
const purgeUploadBar = (obj) => {
|
|
15
17
|
obj.bar1.update(100, {
|
|
16
18
|
speed: ((obj.size / (Date.now() - obj.startTime)) / 125).toFixed(2) //kbits per sec
|
|
17
19
|
});
|
|
18
20
|
obj.bar1.stop();
|
|
19
|
-
clearInterval(obj.zipInterval);
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
const uploadSuits = (bsConfig, filePath, opts, obj) => {
|
|
23
|
-
return new Promise(function (resolve, reject) {
|
|
24
|
+
return new Promise(async function (resolve, reject) {
|
|
24
25
|
let uploadProgressBarErrorFlags = {
|
|
25
26
|
noConnectionReportSent: false,
|
|
26
27
|
unknownErrorReportSent: false
|
|
@@ -54,94 +55,69 @@ const uploadSuits = (bsConfig, filePath, opts, obj) => {
|
|
|
54
55
|
|
|
55
56
|
let options = utils.generateUploadParams(bsConfig, filePath, opts.md5Data, opts.fileDetails)
|
|
56
57
|
let responseData = null;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
58
|
+
try {
|
|
59
|
+
const formData = new FormData();
|
|
60
|
+
formData.append("file", fs.createReadStream(filePath));
|
|
61
|
+
formData.append("filetype", opts.fileDetails.filetype);
|
|
62
|
+
formData.append("filename", opts.fileDetails.filename);
|
|
63
|
+
formData.append("zipMd5sum", opts.md5Data ? opts.md5Data : '');
|
|
64
|
+
|
|
65
|
+
const axiosConfig = {
|
|
66
|
+
auth: {
|
|
67
|
+
username: options.auth.user,
|
|
68
|
+
password: options.auth.password
|
|
69
|
+
},
|
|
70
|
+
headers: options.headers,
|
|
71
|
+
onUploadProgress: (progressEvent) => {
|
|
72
|
+
let percent = parseInt(Math.floor((progressEvent.loaded * 100) / progressEvent.total));
|
|
73
|
+
obj.bar1.update(percent, {
|
|
74
|
+
speed: ((progressEvent.bytes / (Date.now() - obj.startTime)) / 125).toFixed(2) //kbits per sec
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
setAxiosProxy(axiosConfig);
|
|
79
|
+
|
|
80
|
+
const response = await axios.post(options.url, formData, axiosConfig);
|
|
81
|
+
responseData = response.data;
|
|
82
|
+
purgeUploadBar(obj)
|
|
83
|
+
logger.info(`${opts.messages.uploadingSuccess} (${responseData[opts.md5ReturnKey]})`);
|
|
84
|
+
opts.cleanupMethod();
|
|
85
|
+
responseData["time"] = Date.now() - obj.startTime;
|
|
86
|
+
resolve(responseData);
|
|
87
|
+
} catch (error) {
|
|
88
|
+
let responseData = null;
|
|
89
|
+
if(error.response){
|
|
90
|
+
responseData = error.response.data;
|
|
91
|
+
if (error.response.status === 401) {
|
|
92
|
+
if (responseData && responseData.error) {
|
|
93
|
+
responseData.time = Date.now() - obj.startTime;
|
|
94
|
+
return reject({message: responseData.error, stacktrace: utils.formatRequest(responseData.error, error.response, responseData)});
|
|
86
95
|
} else {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
} else {
|
|
96
|
+
return reject({message: Constants.validationMessages.INVALID_DEFAULT_AUTH_PARAMS, stacktrace: utils.formatRequest(error.response.statusText, error.response, responseData)});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (!opts.propogateError){
|
|
94
100
|
purgeUploadBar(obj);
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
resolve(
|
|
101
|
+
if (error.response.status === 413) {
|
|
102
|
+
return resolve({warn: Constants.userMessages.NODE_MODULES_LIMIT_EXCEEDED.replace("%SIZE%", (size / 1000000).toFixed(2))});
|
|
103
|
+
}
|
|
104
|
+
return resolve({})
|
|
99
105
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
obj.zipInterval = setInterval(function () {
|
|
104
|
-
const errorCode = 'update_upload_progress_bar_failed';
|
|
105
|
-
try {
|
|
106
|
-
if (r && r.req && r.req.connection) {
|
|
107
|
-
let dispatched = r.req.connection._bytesDispatched;
|
|
108
|
-
let percent = dispatched * 100.0 / size;
|
|
109
|
-
obj.bar1.update(percent, {
|
|
110
|
-
speed: ((dispatched / (Date.now() - obj.startTime)) / 125).toFixed(2) //kbits per sec
|
|
111
|
-
});
|
|
106
|
+
if(responseData && responseData["error"]){
|
|
107
|
+
responseData["time"] = Date.now() - obj.startTime;
|
|
108
|
+
reject({message: responseData["error"], stacktrace: utils.formatRequest(error.response.statusText, error.response, responseData)});
|
|
112
109
|
} else {
|
|
113
|
-
if (
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
null,
|
|
118
|
-
Constants.userMessages.NO_CONNECTION_WHILE_UPDATING_UPLOAD_PROGRESS_BAR,
|
|
119
|
-
Constants.messageTypes.WARNING,
|
|
120
|
-
errorCode,
|
|
121
|
-
null,
|
|
122
|
-
null
|
|
123
|
-
);
|
|
124
|
-
uploadProgressBarErrorFlags.noConnectionReportSent = true;
|
|
110
|
+
if (error.response.status === 413) {
|
|
111
|
+
reject({message: Constants.userMessages.ZIP_UPLOAD_LIMIT_EXCEEDED, stacktrace: utils.formatRequest(error.response.statusText, error.response, responseData)});
|
|
112
|
+
} else {
|
|
113
|
+
reject({message: Constants.userMessages.ZIP_UPLOADER_NOT_REACHABLE, stacktrace: utils.formatRequest(error.response.statusText, error.response, responseData)});
|
|
125
114
|
}
|
|
126
115
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
logger.debug(error);
|
|
131
|
-
utils.sendUsageReport(
|
|
132
|
-
bsConfig,
|
|
133
|
-
null,
|
|
134
|
-
error.stack,
|
|
135
|
-
Constants.messageTypes.WARNING,
|
|
136
|
-
errorCode,
|
|
137
|
-
null,
|
|
138
|
-
null
|
|
139
|
-
);
|
|
140
|
-
uploadProgressBarErrorFlags.unknownErrorReportSent = true;
|
|
141
|
-
}
|
|
116
|
+
reject({message: error.response, stacktrace: utils.formatRequest(error.response.statusText, error.response, error.response.data)});
|
|
117
|
+
} else {
|
|
118
|
+
reject({})
|
|
142
119
|
}
|
|
143
|
-
}
|
|
144
|
-
|
|
120
|
+
}
|
|
145
121
|
});
|
|
146
122
|
}
|
|
147
123
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
|
-
const
|
|
4
|
-
const http = require('http');
|
|
3
|
+
const axios = require('axios');
|
|
5
4
|
const https = require('https');
|
|
5
|
+
const HttpsProxyAgent = require('https-proxy-agent');
|
|
6
6
|
|
|
7
7
|
const logger = require("../../helpers/logger").winstonLogger;
|
|
8
8
|
const utils = require('../../helpers/utils');
|
|
@@ -126,7 +126,7 @@ class CrashReporter {
|
|
|
126
126
|
if (!this.credentialsForCrashReportUpload.username || !this.credentialsForCrashReportUpload.password) {
|
|
127
127
|
return debug('[Crash_Report_Upload] Failed to parse user credentials while reporting crash')
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
|
|
130
130
|
const data = {
|
|
131
131
|
hashed_id: process.env.BS_TESTOPS_BUILD_HASHED_ID,
|
|
132
132
|
observability_version: {
|
|
@@ -140,7 +140,7 @@ class CrashReporter {
|
|
|
140
140
|
},
|
|
141
141
|
config: this.userConfigForReporting
|
|
142
142
|
}
|
|
143
|
-
|
|
143
|
+
|
|
144
144
|
const options = {
|
|
145
145
|
auth: {
|
|
146
146
|
...this.credentialsForCrashReportUpload
|
|
@@ -151,20 +151,29 @@ class CrashReporter {
|
|
|
151
151
|
},
|
|
152
152
|
method: 'POST',
|
|
153
153
|
url: `${API_URL}/api/v1/analytics`,
|
|
154
|
-
|
|
154
|
+
data: data,
|
|
155
155
|
json: true,
|
|
156
156
|
agent: httpsKeepAliveAgent
|
|
157
157
|
};
|
|
158
|
+
|
|
159
|
+
if(process.env.HTTP_PROXY){
|
|
160
|
+
options.proxy = false
|
|
161
|
+
options.httpsAgent = new HttpsProxyAgent(process.env.HTTP_PROXY);
|
|
162
|
+
} else if (process.env.HTTPS_PROXY){
|
|
163
|
+
options.proxy = false
|
|
164
|
+
options.httpsAgent = new HttpsProxyAgent(process.env.HTTPS_PROXY);
|
|
165
|
+
}
|
|
158
166
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
167
|
+
axios(options)
|
|
168
|
+
.then(response => {
|
|
169
|
+
|
|
170
|
+
if(response.status != 200) {
|
|
171
|
+
debug(`[Crash_Report_Upload] Failed due to ${response && response.data ? response.data : `Received response from BrowserStack Server with status : ${response.status}`}`);
|
|
172
|
+
} else {
|
|
173
|
+
debug(`[Crash_Report_Upload] Success response: ${JSON.stringify({status: response.status, body: response.data})}`)
|
|
174
|
+
}
|
|
175
|
+
})
|
|
176
|
+
.catch(error => debug(`[Crash_Report_Upload] Failed due to ${error}`));
|
|
168
177
|
} catch(e) {
|
|
169
178
|
debug(`[Crash_Report_Upload] Processing failed due to ${e && e.stack}`);
|
|
170
179
|
}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
/* Used to detect Gherkin steps */
|
|
4
4
|
Cypress.on('log:added', (log) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
11
|
-
|
|
5
|
+
return () => {
|
|
6
|
+
return cy.now('task', 'test_observability_step', {
|
|
7
|
+
log
|
|
8
|
+
}, {log: false})
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
|
|
12
12
|
Cypress.on('command:start', (command) => {
|
|
13
13
|
if(!command || !command.attributes) return;
|
|
14
14
|
if(command.attributes.name == 'log' || (command.attributes.name == 'task' && (command.attributes.args.includes('test_observability_command') || command.attributes.args.includes('test_observability_log')))) {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
|
-
const http = require('http');
|
|
4
3
|
const https = require('https');
|
|
5
|
-
const request = require('requestretry');
|
|
6
4
|
const { v4: uuidv4 } = require('uuid');
|
|
7
5
|
const os = require('os');
|
|
8
6
|
const { promisify } = require('util');
|
|
@@ -10,6 +8,8 @@ const gitconfig = require('gitconfiglocal');
|
|
|
10
8
|
const { spawn, execSync } = require('child_process');
|
|
11
9
|
const glob = require('glob');
|
|
12
10
|
const util = require('util');
|
|
11
|
+
const axios = require('axios');
|
|
12
|
+
const HttpsProxyAgent = require('https-proxy-agent');
|
|
13
13
|
|
|
14
14
|
const { runOptions } = require('../../helpers/runnerArgs')
|
|
15
15
|
|
|
@@ -117,39 +117,55 @@ exports.printBuildLink = async (shouldStopSession, exitCode = null) => {
|
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
const nodeRequest = (type, url, data, config) => {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
120
|
+
return new Promise(async (resolve, reject) => {
|
|
121
|
+
const options = {
|
|
122
|
+
...config,
|
|
123
|
+
method: type,
|
|
124
|
+
url: `${API_URL}/${url}`,
|
|
125
|
+
data: data,
|
|
126
|
+
httpsAgent: this.httpsKeepAliveAgent,
|
|
127
|
+
maxAttempts: 2,
|
|
128
|
+
headers: {
|
|
129
|
+
...config.headers,
|
|
130
|
+
'Content-Type': 'application/json;charset=utf-8',
|
|
131
|
+
"X-Forwarded-For": "127.0.0.1"
|
|
132
|
+
},
|
|
133
|
+
clientIp: "127.0.0.1"
|
|
134
|
+
};
|
|
133
135
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
} else if(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
136
|
+
if(process.env.HTTP_PROXY){
|
|
137
|
+
options.proxy = false
|
|
138
|
+
options.httpsAgent = new HttpsProxyAgent(process.env.HTTP_PROXY);
|
|
139
|
+
} else if (process.env.HTTPS_PROXY){
|
|
140
|
+
options.proxy = false
|
|
141
|
+
options.httpsAgent = new HttpsProxyAgent(process.env.HTTPS_PROXY);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if(url === exports.requestQueueHandler.screenshotEventUrl) {
|
|
145
|
+
options.agent = httpsScreenshotsKeepAliveAgent;
|
|
146
|
+
}
|
|
147
|
+
axios(options)
|
|
148
|
+
.then(response => {
|
|
149
|
+
|
|
150
|
+
if(response.status != 200) {
|
|
151
|
+
reject(response && response.data ? response.data : `Received response from BrowserStack Server with status : ${response.status}`);
|
|
152
|
+
} else {
|
|
153
|
+
try {
|
|
154
|
+
const responseBody = typeof response.data === 'object' ? response.data : JSON.parse(response.data);
|
|
155
|
+
resolve({ data: responseBody });
|
|
156
|
+
} catch (error) {
|
|
157
|
+
if (!url.includes('/stop')) {
|
|
158
|
+
reject('Not a JSON response from BrowserStack Server');
|
|
159
|
+
} else {
|
|
160
|
+
resolve({ data: response.data });
|
|
161
|
+
}
|
|
162
|
+
}
|
|
145
163
|
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
164
|
+
})
|
|
165
|
+
.catch(error => {
|
|
166
|
+
reject(error)
|
|
149
167
|
});
|
|
150
|
-
}
|
|
151
168
|
});
|
|
152
|
-
});
|
|
153
169
|
}
|
|
154
170
|
|
|
155
171
|
exports.failureData = (errors,tag) => {
|
|
@@ -277,7 +293,7 @@ exports.setEventListeners = (bsConfig) => {
|
|
|
277
293
|
try {
|
|
278
294
|
if(!file.includes('commands.js')) {
|
|
279
295
|
const defaultFileContent = fs.readFileSync(file, {encoding: 'utf-8'});
|
|
280
|
-
|
|
296
|
+
|
|
281
297
|
let cypressCommandEventListener = getCypressCommandEventListener(file.includes('js'));
|
|
282
298
|
if(!defaultFileContent.includes(cypressCommandEventListener)) {
|
|
283
299
|
let newFileContent = defaultFileContent +
|
|
@@ -345,10 +361,10 @@ const setCrashReportingConfig = (bsConfig, bsConfigPath) => {
|
|
|
345
361
|
|
|
346
362
|
exports.launchTestSession = async (user_config, bsConfigPath) => {
|
|
347
363
|
setCrashReportingConfig(user_config, bsConfigPath);
|
|
348
|
-
|
|
364
|
+
|
|
349
365
|
const obsUserName = user_config["auth"]["username"];
|
|
350
366
|
const obsAccessKey = user_config["auth"]["access_key"];
|
|
351
|
-
|
|
367
|
+
|
|
352
368
|
const BSTestOpsToken = `${obsUserName || ''}:${obsAccessKey || ''}`;
|
|
353
369
|
if(BSTestOpsToken === '') {
|
|
354
370
|
exports.debug('EXCEPTION IN BUILD START EVENT : Missing authentication token', true, null);
|
|
@@ -480,12 +496,12 @@ exports.batchAndPostEvents = async (eventUrl, kind, data) => {
|
|
|
480
496
|
'Authorization': `Bearer ${process.env.BS_TESTOPS_JWT}`,
|
|
481
497
|
'Content-Type': 'application/json',
|
|
482
498
|
'X-BSTACK-TESTOPS': 'true'
|
|
483
|
-
}
|
|
499
|
+
}
|
|
484
500
|
};
|
|
485
501
|
|
|
486
502
|
try {
|
|
487
503
|
const eventsUuids = data.map(eventData => `${eventData.event_type}:${eventData.test_run ? eventData.test_run.uuid : (eventData.hook_run ? eventData.hook_run.uuid : null)}`).join(', ');
|
|
488
|
-
exports.debugOnConsole(`[Request Batch Send] for events:uuids ${eventsUuids}`);
|
|
504
|
+
exports.debugOnConsole(`[Request Batch Send] for events:uuids ${eventsUuids}`);
|
|
489
505
|
const response = await nodeRequest('POST',eventUrl,data,config);
|
|
490
506
|
exports.debugOnConsole(`[Request Batch Response] for events:uuids ${eventsUuids}`);
|
|
491
507
|
if(response.data.error) {
|
|
@@ -522,7 +538,7 @@ exports.uploadEventData = async (eventData, run=0) => {
|
|
|
522
538
|
}[eventData.event_type];
|
|
523
539
|
|
|
524
540
|
if(run === 0 && process.env.BS_TESTOPS_JWT != "null") exports.pending_test_uploads.count += 1;
|
|
525
|
-
|
|
541
|
+
|
|
526
542
|
if (process.env.BS_TESTOPS_BUILD_COMPLETED === "true") {
|
|
527
543
|
if(process.env.BS_TESTOPS_JWT == "null") {
|
|
528
544
|
exports.debug(`EXCEPTION IN ${log_tag} REQUEST TO TEST OBSERVABILITY : missing authentication token`);
|
|
@@ -533,7 +549,7 @@ exports.uploadEventData = async (eventData, run=0) => {
|
|
|
533
549
|
};
|
|
534
550
|
} else {
|
|
535
551
|
let data = eventData, event_api_url = 'api/v1/event';
|
|
536
|
-
|
|
552
|
+
|
|
537
553
|
exports.requestQueueHandler.start();
|
|
538
554
|
const { shouldProceed, proceedWithData, proceedWithUrl } = exports.requestQueueHandler.add(eventData);
|
|
539
555
|
exports.debugOnConsole(`[Request Queue] ${eventData.event_type} with uuid ${eventData.test_run ? eventData.test_run.uuid : (eventData.hook_run ? eventData.hook_run.uuid : null)} is added`)
|
|
@@ -547,11 +563,11 @@ exports.uploadEventData = async (eventData, run=0) => {
|
|
|
547
563
|
const config = {
|
|
548
564
|
headers: {
|
|
549
565
|
'Authorization': `Bearer ${process.env.BS_TESTOPS_JWT}`,
|
|
550
|
-
'Content-Type': 'application/json',
|
|
566
|
+
'Content-Type': 'application/json;charset=utf-8',
|
|
551
567
|
'X-BSTACK-TESTOPS': 'true'
|
|
552
568
|
}
|
|
553
569
|
};
|
|
554
|
-
|
|
570
|
+
|
|
555
571
|
try {
|
|
556
572
|
const eventsUuids = data.map(eventData => `${eventData.event_type}:${eventData.test_run ? eventData.test_run.uuid : (eventData.hook_run ? eventData.hook_run.uuid : null)}`).join(', ');
|
|
557
573
|
exports.debugOnConsole(`[Request Send] for events:uuids ${eventsUuids}`);
|
|
@@ -613,7 +629,7 @@ exports.setTestObservabilityFlags = (bsConfig) => {
|
|
|
613
629
|
isTestObservabilitySession = false;
|
|
614
630
|
exports.debug(`EXCEPTION while parsing testObservability capability with error ${e}`, true, e);
|
|
615
631
|
}
|
|
616
|
-
|
|
632
|
+
|
|
617
633
|
/* browserstackAutomation */
|
|
618
634
|
let isBrowserstackInfra = true;
|
|
619
635
|
try {
|
|
@@ -624,7 +640,7 @@ exports.setTestObservabilityFlags = (bsConfig) => {
|
|
|
624
640
|
isBrowserstackInfra = true;
|
|
625
641
|
exports.debug(`EXCEPTION while parsing browserstackAutomation capability with error ${e}`, true, e);
|
|
626
642
|
}
|
|
627
|
-
|
|
643
|
+
|
|
628
644
|
if(isTestObservabilitySession) logger.warn("testObservability is set to true. Other test reporters you are using will be automatically disabled. Learn more at browserstack.com/docs/test-observability/overview/what-is-test-observability");
|
|
629
645
|
|
|
630
646
|
process.env.BROWSERSTACK_TEST_OBSERVABILITY = isTestObservabilitySession;
|
|
@@ -664,7 +680,7 @@ exports.stopBuildUpstream = async () => {
|
|
|
664
680
|
'X-BSTACK-TESTOPS': 'true'
|
|
665
681
|
}
|
|
666
682
|
};
|
|
667
|
-
|
|
683
|
+
|
|
668
684
|
try {
|
|
669
685
|
const response = await nodeRequest('PUT',`api/v1/builds/${process.env.BS_TESTOPS_BUILD_HASHED_ID}/stop`,data,config);
|
|
670
686
|
if(response.data && response.data.error) {
|
|
@@ -39,7 +39,7 @@ class RequestQueueHandler {
|
|
|
39
39
|
this.queue.splice(0,BATCH_SIZE);
|
|
40
40
|
this.resetEventBatchPolling();
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
return {
|
|
44
44
|
shouldProceed: shouldProceed,
|
|
45
45
|
proceedWithData: data,
|
|
@@ -54,7 +54,7 @@ class RequestQueueHandler {
|
|
|
54
54
|
|
|
55
55
|
shutdownSync = () => {
|
|
56
56
|
this.removeEventBatchPolling('REMOVING');
|
|
57
|
-
|
|
57
|
+
|
|
58
58
|
fs.writeFileSync(path.join(__dirname, PENDING_QUEUES_FILE), JSON.stringify(this.queue));
|
|
59
59
|
this.queue = [];
|
|
60
60
|
cp.spawnSync('node', [path.join(__dirname, 'cleanupQueueSync.js'), path.join(__dirname, PENDING_QUEUES_FILE)], {stdio: 'inherit'});
|
|
@@ -13,17 +13,17 @@ exports.startIPCServer = (subscribeServerEvents, unsubscribeServerEvents) => {
|
|
|
13
13
|
ipc.config.silent = true;
|
|
14
14
|
|
|
15
15
|
ipc.serve(() => {
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
ipc.server.on('socket.disconnected', (socket, destroyedSocketID) => {
|
|
18
18
|
ipc.log(`client ${destroyedSocketID} has disconnected!`);
|
|
19
19
|
});
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
ipc.server.on('destroy', () => {
|
|
22
22
|
ipc.log('server destroyed');
|
|
23
23
|
});
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
subscribeServerEvents(ipc.server);
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
process.on('exit', () => {
|
|
28
28
|
unsubscribeServerEvents(ipc.server);
|
|
29
29
|
ipc.server.stop();
|
|
@@ -31,8 +31,8 @@ exports.startIPCServer = (subscribeServerEvents, unsubscribeServerEvents) => {
|
|
|
31
31
|
// on exit handler will block the process
|
|
32
32
|
requestQueueHandler.shutdownSync();
|
|
33
33
|
});
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
});
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
ipc.server.start();
|
|
38
38
|
};
|
|
@@ -169,7 +169,6 @@ class MyReporter {
|
|
|
169
169
|
})
|
|
170
170
|
|
|
171
171
|
.on(EVENT_TEST_BEGIN, async (test) => {
|
|
172
|
-
debugOnConsole(`[MOCHA EVENT] EVENT_TEST_BEGIN`);
|
|
173
172
|
debugOnConsole(`[MOCHA EVENT] EVENT_TEST_BEGIN for uuid: ${test.testAnalyticsId}`);
|
|
174
173
|
if (this.runStatusMarkedHash[test.testAnalyticsId]) return;
|
|
175
174
|
if(this.testObservability == true) {
|
|
@@ -178,7 +177,6 @@ class MyReporter {
|
|
|
178
177
|
})
|
|
179
178
|
|
|
180
179
|
.on(EVENT_TEST_END, async (test) => {
|
|
181
|
-
debugOnConsole(`[MOCHA EVENT] EVENT_TEST_END`);
|
|
182
180
|
debugOnConsole(`[MOCHA EVENT] EVENT_TEST_BEGIN for uuid: ${test.testAnalyticsId}`);
|
|
183
181
|
if (this.runStatusMarkedHash[test.testAnalyticsId]) return;
|
|
184
182
|
if(this.testObservability == true) {
|
|
@@ -188,7 +186,7 @@ class MyReporter {
|
|
|
188
186
|
}
|
|
189
187
|
}
|
|
190
188
|
})
|
|
191
|
-
|
|
189
|
+
|
|
192
190
|
.once(EVENT_RUN_END, async () => {
|
|
193
191
|
try {
|
|
194
192
|
debugOnConsole(`[MOCHA EVENT] EVENT_RUN_END`);
|
|
@@ -307,9 +305,9 @@ class MyReporter {
|
|
|
307
305
|
let gitConfigPath = process.env.OBSERVABILITY_GIT_CONFIG_PATH ? process.env.OBSERVABILITY_GIT_CONFIG_PATH.toString() : (rootParentFile ? findGitConfig(rootParentFile) : null);
|
|
308
306
|
if(!isBrowserstackInfra()) gitConfigPath = process.env.OBSERVABILITY_GIT_CONFIG_PATH_LOCAL ? process.env.OBSERVABILITY_GIT_CONFIG_PATH_LOCAL.toString() : null;
|
|
309
307
|
const prefixedTestPath = rootParentFile ? this._paths.prefixTestPath(rootParentFile) : 'File path could not be found';
|
|
310
|
-
|
|
308
|
+
|
|
311
309
|
const fileSeparator = getFileSeparatorData();
|
|
312
|
-
|
|
310
|
+
|
|
313
311
|
let testData = {
|
|
314
312
|
'framework': 'Cypress',
|
|
315
313
|
'uuid': (eventType.includes("Test") ? test.testAnalyticsId : test.hookAnalyticsId) || uuidv4(),
|
|
@@ -417,14 +415,14 @@ class MyReporter {
|
|
|
417
415
|
}
|
|
418
416
|
|
|
419
417
|
if(eventType == "HookRunFinished") delete testData.started_at;
|
|
420
|
-
|
|
418
|
+
|
|
421
419
|
if(eventType.match(/HookRun/)) {
|
|
422
420
|
testData['hook_type'] = HOOK_TYPES_MAP[testData['hook_type']];
|
|
423
421
|
uploadData['hook_run'] = testData;
|
|
424
422
|
} else {
|
|
425
423
|
uploadData['test_run'] = testData;
|
|
426
424
|
}
|
|
427
|
-
|
|
425
|
+
|
|
428
426
|
if(eventType == 'HookRunFinished' && testData['hook_type'] == 'BEFORE_ALL') {
|
|
429
427
|
uploadData.cypressSteps = JSON.parse(JSON.stringify(this.currentTestSteps));
|
|
430
428
|
this.beforeHooks.push(uploadData);
|
|
@@ -610,7 +608,7 @@ class MyReporter {
|
|
|
610
608
|
if(isCommandPresent) {
|
|
611
609
|
return;
|
|
612
610
|
}
|
|
613
|
-
|
|
611
|
+
|
|
614
612
|
const currentStepObj = {
|
|
615
613
|
id: command.attributes.id,
|
|
616
614
|
text: 'cy.' + command.attributes.name + '(' + this.getFormattedArgs(command.attributes.args) + ')',
|
|
@@ -660,7 +658,7 @@ class MyReporter {
|
|
|
660
658
|
}
|
|
661
659
|
} else if(type == 'COMMAND_RETRY') {
|
|
662
660
|
if(!command.id) return;
|
|
663
|
-
|
|
661
|
+
|
|
664
662
|
let isRetryStepFound = false;
|
|
665
663
|
/* Parse steps array in reverse and update the last step with common chainerId */
|
|
666
664
|
for(let idx=this.currentTestSteps.length-1; idx>=0; idx--) {
|
|
@@ -754,7 +752,7 @@ class MyReporter {
|
|
|
754
752
|
});
|
|
755
753
|
}
|
|
756
754
|
}
|
|
757
|
-
|
|
755
|
+
|
|
758
756
|
return null
|
|
759
757
|
}
|
|
760
758
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browserstack-cypress-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.32.0",
|
|
4
4
|
"description": "BrowserStack Cypress CLI for Cypress integration with BrowserStack's remote devices.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -14,9 +14,12 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"archiver": "5.3.0",
|
|
16
16
|
"async": "3.2.3",
|
|
17
|
+
"axios": "^1.7.7",
|
|
18
|
+
"axios-retry": "^3.5.0",
|
|
17
19
|
"browserstack-local": "1.5.4",
|
|
18
20
|
"chalk": "4.1.2",
|
|
19
|
-
"cli-progress": "3.10.0",
|
|
21
|
+
"cli-progress": "^3.10.0",
|
|
22
|
+
"form-data": "^4.0.0",
|
|
20
23
|
"fs-extra": "8.1.0",
|
|
21
24
|
"getmac": "5.20.0",
|
|
22
25
|
"git-last-commit": "^1.0.1",
|
|
@@ -26,8 +29,6 @@
|
|
|
26
29
|
"mocha": "^10.2.0",
|
|
27
30
|
"mkdirp": "1.0.4",
|
|
28
31
|
"node-ipc": "9.1.1",
|
|
29
|
-
"request": "2.88.2",
|
|
30
|
-
"requestretry": "7.1.0",
|
|
31
32
|
"table": "5.4.6",
|
|
32
33
|
"update-notifier": "7.0.0",
|
|
33
34
|
"uuid": "8.3.2",
|