bdy 1.12.6-master → 1.12.7-dev
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/distTs/package.json +1 -1
- package/distTs/src/command/vt/close.js +2 -3
- package/distTs/src/command/vt/compare.js +2 -2
- package/distTs/src/command/vt/storybook.js +2 -2
- package/distTs/src/visualTest/requests.js +34 -16
- package/distTs/src/visualTest/snapshots.js +4 -4
- package/package.json +1 -1
package/distTs/package.json
CHANGED
|
@@ -17,9 +17,8 @@ commandVtClose.action(async () => {
|
|
|
17
17
|
output_1.default.exitError(texts_1.ERR_MISSING_BUILD_ID);
|
|
18
18
|
}
|
|
19
19
|
try {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
output_1.default.exitNormal(response);
|
|
20
|
+
const { message } = await (0, requests_1.closeSession)();
|
|
21
|
+
output_1.default.exitNormal(message);
|
|
23
22
|
}
|
|
24
23
|
catch (error) {
|
|
25
24
|
output_1.default.exitError(`${error}`);
|
|
@@ -61,8 +61,8 @@ commandVtCompare.action(async (options) => {
|
|
|
61
61
|
const ciAndGitInfo = await (0, ci_1.getCiAndGitInfo)({});
|
|
62
62
|
(0, context_1.setCiAndCommitInfo)(ciAndGitInfo);
|
|
63
63
|
try {
|
|
64
|
-
const
|
|
65
|
-
output_1.default.exitSuccess(
|
|
64
|
+
const { message } = await (0, requests_1.sendCompareLinks)(filteredUrls, validatedOptions, sitemapSource);
|
|
65
|
+
output_1.default.exitSuccess(message);
|
|
66
66
|
}
|
|
67
67
|
catch (error) {
|
|
68
68
|
output_1.default.exitError(`${error}`);
|
|
@@ -33,8 +33,8 @@ commandVtStorybook.action(async () => {
|
|
|
33
33
|
(0, context_1.setCiAndCommitInfo)(ciAndGitInfo);
|
|
34
34
|
(0, ci_1.logCiInfo)(ciAndGitInfo);
|
|
35
35
|
try {
|
|
36
|
-
const
|
|
37
|
-
output_1.default.exitSuccess(
|
|
36
|
+
const { message } = await (0, requests_1.sendStorybook)(storybookSnapshots, currentDirectoryFiles);
|
|
37
|
+
output_1.default.exitSuccess(message);
|
|
38
38
|
}
|
|
39
39
|
catch (error) {
|
|
40
40
|
output_1.default.exitError(`${error}`);
|
|
@@ -103,15 +103,18 @@ async function sendSnapshot(snapshot, firstSnapshot) {
|
|
|
103
103
|
firstSnapshot,
|
|
104
104
|
};
|
|
105
105
|
const formData = createFormData(info, files);
|
|
106
|
-
const [message] = await sendRequest({
|
|
106
|
+
const [message, response] = await sendRequest({
|
|
107
107
|
path: '/snapshot',
|
|
108
108
|
payload: formData,
|
|
109
109
|
multipart: true,
|
|
110
110
|
});
|
|
111
|
-
if (
|
|
111
|
+
if (message) {
|
|
112
|
+
throw new Error(message);
|
|
113
|
+
}
|
|
114
|
+
if (!response) {
|
|
112
115
|
throw new Error(texts_1.ERR_INVALID_SNAPSHOT_RESPONSE);
|
|
113
116
|
}
|
|
114
|
-
return
|
|
117
|
+
return response;
|
|
115
118
|
}
|
|
116
119
|
async function sendSnapshots(snapshots) {
|
|
117
120
|
const files = [];
|
|
@@ -137,26 +140,35 @@ async function sendSnapshots(snapshots) {
|
|
|
137
140
|
firstSnapshot: true,
|
|
138
141
|
};
|
|
139
142
|
const formData = createFormData(info, files);
|
|
140
|
-
const [message] = await sendRequest({
|
|
143
|
+
const [message, response] = await sendRequest({
|
|
141
144
|
path: '/snapshots',
|
|
142
145
|
payload: formData,
|
|
143
146
|
multipart: true,
|
|
144
147
|
});
|
|
145
|
-
if (
|
|
148
|
+
if (message) {
|
|
149
|
+
throw new Error(message);
|
|
150
|
+
}
|
|
151
|
+
if (!response) {
|
|
146
152
|
throw new Error(texts_1.ERR_INVALID_SNAPSHOTS_RESPONSE);
|
|
147
153
|
}
|
|
148
|
-
return
|
|
154
|
+
return response;
|
|
149
155
|
}
|
|
150
156
|
async function closeSession() {
|
|
151
157
|
const payload = {
|
|
152
158
|
token: context_1.token,
|
|
153
159
|
buildId: context_1.buildId,
|
|
154
160
|
};
|
|
155
|
-
const [message] = await sendRequest({
|
|
156
|
-
|
|
161
|
+
const [message, response] = await sendRequest({
|
|
162
|
+
path: '/close',
|
|
163
|
+
payload,
|
|
164
|
+
});
|
|
165
|
+
if (message) {
|
|
166
|
+
throw new Error(message);
|
|
167
|
+
}
|
|
168
|
+
if (!response) {
|
|
157
169
|
throw new Error(texts_1.ERR_INVALID_CLOSE_SESSION_RESPONSE);
|
|
158
170
|
}
|
|
159
|
-
return
|
|
171
|
+
return response;
|
|
160
172
|
}
|
|
161
173
|
async function getDefaultSettings() {
|
|
162
174
|
const [message, response] = await sendRequest({
|
|
@@ -191,18 +203,21 @@ async function sendStorybook(snapshots, filePaths) {
|
|
|
191
203
|
};
|
|
192
204
|
const files = filePaths.map((file) => ({
|
|
193
205
|
id: file,
|
|
194
|
-
body: new Blob([(0, node_fs_1.readFileSync)(file)]),
|
|
206
|
+
body: new Blob([new Uint8Array((0, node_fs_1.readFileSync)(file))]),
|
|
195
207
|
}));
|
|
196
208
|
const formData = createFormData(info, files);
|
|
197
|
-
const [message] = await sendRequest({
|
|
209
|
+
const [message, response] = await sendRequest({
|
|
198
210
|
path: '/storybook',
|
|
199
211
|
payload: formData,
|
|
200
212
|
multipart: true,
|
|
201
213
|
});
|
|
202
|
-
if (
|
|
214
|
+
if (message) {
|
|
215
|
+
throw new Error(message);
|
|
216
|
+
}
|
|
217
|
+
if (!response) {
|
|
203
218
|
throw new Error(texts_1.ERR_INVALID_STORYBOOK_RESPONSE);
|
|
204
219
|
}
|
|
205
|
-
return
|
|
220
|
+
return response;
|
|
206
221
|
}
|
|
207
222
|
async function sendCompareLinks(urls, validatedOptions, sitemapSource) {
|
|
208
223
|
const info = {
|
|
@@ -230,14 +245,17 @@ async function sendCompareLinks(urls, validatedOptions, sitemapSource) {
|
|
|
230
245
|
commitDetails: context_1.commitDetails,
|
|
231
246
|
cliId: context_1.cliId,
|
|
232
247
|
};
|
|
233
|
-
const [message] = await sendRequest({
|
|
248
|
+
const [message, response] = await sendRequest({
|
|
234
249
|
path: '/compareLinks',
|
|
235
250
|
payload: info,
|
|
236
251
|
});
|
|
237
|
-
if (
|
|
252
|
+
if (message) {
|
|
253
|
+
throw new Error(message);
|
|
254
|
+
}
|
|
255
|
+
if (!response) {
|
|
238
256
|
throw new Error(texts_1.ERR_INVALID_COMPARE_LINKS_RESPONSE);
|
|
239
257
|
}
|
|
240
|
-
return
|
|
258
|
+
return response;
|
|
241
259
|
}
|
|
242
260
|
async function sendScrap(url, outputType, follow, quality, fullPage, cssSelector, xpathSelector, browser, viewport, devicePixelRatio, darkMode, delay, waitForElement) {
|
|
243
261
|
const payload = {
|
|
@@ -58,8 +58,8 @@ async function processSnapshot(snapshot, firstSnapshot) {
|
|
|
58
58
|
: await getSnapshotWithResources(snapshot);
|
|
59
59
|
try {
|
|
60
60
|
output_1.default.normal(texts_1.LOG_SENDING_DATA);
|
|
61
|
-
const
|
|
62
|
-
sessionLink =
|
|
61
|
+
const { message } = await (0, requests_1.sendSnapshot)(preparedSnapshot, firstSnapshot);
|
|
62
|
+
sessionLink = message;
|
|
63
63
|
}
|
|
64
64
|
catch (error) {
|
|
65
65
|
output_1.default.error(`${error}`);
|
|
@@ -84,8 +84,8 @@ async function processSnapshots() {
|
|
|
84
84
|
else {
|
|
85
85
|
try {
|
|
86
86
|
output_1.default.normal(texts_1.LOG_SENDING_DATA);
|
|
87
|
-
const
|
|
88
|
-
sessionLink =
|
|
87
|
+
const { message } = await (0, requests_1.sendSnapshots)(preparedSnapshots);
|
|
88
|
+
sessionLink = message;
|
|
89
89
|
}
|
|
90
90
|
catch (error) {
|
|
91
91
|
output_1.default.error(`${error}`);
|