@shopware-ag/acceptance-test-suite 1.0.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/LICENSE +21 -0
- package/README.md +357 -0
- package/dist/index.d.mts +531 -0
- package/dist/index.d.ts +531 -0
- package/dist/index.mjs +2259 -0
- package/package.json +54 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2259 @@
|
|
|
1
|
+
import { test as test$c, expect, request, mergeTests } from '@playwright/test';
|
|
2
|
+
export * from '@playwright/test';
|
|
3
|
+
import crypto, { createHash } from 'crypto';
|
|
4
|
+
import { stringify } from 'uuid';
|
|
5
|
+
import { Image } from 'image-js';
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
|
|
8
|
+
const getLanguageData = async (languageCode, adminApiContext) => {
|
|
9
|
+
const resp = await adminApiContext.post("search/language", {
|
|
10
|
+
data: {
|
|
11
|
+
limit: 1,
|
|
12
|
+
filter: [{
|
|
13
|
+
type: "equals",
|
|
14
|
+
field: "translationCode.code",
|
|
15
|
+
value: languageCode
|
|
16
|
+
}],
|
|
17
|
+
associations: { translationCode: {} }
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const result = await resp.json();
|
|
21
|
+
return {
|
|
22
|
+
id: result.data[0].id,
|
|
23
|
+
localeId: result.data[0].translationCode.id
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
const getSnippetSetId = async (languageCode, adminApiContext) => {
|
|
27
|
+
const resp = await adminApiContext.post("search/snippet-set", {
|
|
28
|
+
data: {
|
|
29
|
+
limit: 1,
|
|
30
|
+
filter: [{
|
|
31
|
+
type: "equals",
|
|
32
|
+
field: "iso",
|
|
33
|
+
value: languageCode
|
|
34
|
+
}]
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const result = await resp.json();
|
|
38
|
+
return result.data[0].id;
|
|
39
|
+
};
|
|
40
|
+
const getCurrency = async (isoCode, adminApiContext) => {
|
|
41
|
+
const resp = await adminApiContext.post("search/currency", {
|
|
42
|
+
data: {
|
|
43
|
+
limit: 1,
|
|
44
|
+
filter: [{
|
|
45
|
+
type: "equals",
|
|
46
|
+
field: "isoCode",
|
|
47
|
+
value: isoCode
|
|
48
|
+
}]
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const result = await resp.json();
|
|
52
|
+
return result.data[0];
|
|
53
|
+
};
|
|
54
|
+
const getTaxId = async (adminApiContext) => {
|
|
55
|
+
const resp = await adminApiContext.post("search/tax", {
|
|
56
|
+
data: { limit: 1 }
|
|
57
|
+
});
|
|
58
|
+
const result = await resp.json();
|
|
59
|
+
return result.data[0].id;
|
|
60
|
+
};
|
|
61
|
+
const getPaymentMethodId = async (adminApiContext, handlerId) => {
|
|
62
|
+
const handler = handlerId || "Shopware\\Core\\Checkout\\Payment\\Cart\\PaymentHandler\\InvoicePayment";
|
|
63
|
+
const resp = await adminApiContext.post("search/payment-method", {
|
|
64
|
+
data: {
|
|
65
|
+
limit: 1,
|
|
66
|
+
filter: [{
|
|
67
|
+
type: "equals",
|
|
68
|
+
field: "handlerIdentifier",
|
|
69
|
+
value: handler
|
|
70
|
+
}]
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
const result = await resp.json();
|
|
74
|
+
return result.data[0].id;
|
|
75
|
+
};
|
|
76
|
+
const getDefaultShippingMethodId = async (adminApiContext) => {
|
|
77
|
+
const resp = await adminApiContext.post("search/shipping-method", {
|
|
78
|
+
data: {
|
|
79
|
+
limit: 1,
|
|
80
|
+
filter: [{
|
|
81
|
+
type: "equals",
|
|
82
|
+
field: "name",
|
|
83
|
+
value: "Standard"
|
|
84
|
+
}]
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
const result = await resp.json();
|
|
88
|
+
return result.data[0].id;
|
|
89
|
+
};
|
|
90
|
+
const getCountryId = async (iso2, adminApiContext) => {
|
|
91
|
+
const resp = await adminApiContext.post("search/country", {
|
|
92
|
+
data: {
|
|
93
|
+
limit: 1,
|
|
94
|
+
filter: [{
|
|
95
|
+
type: "equals",
|
|
96
|
+
field: "iso",
|
|
97
|
+
value: iso2
|
|
98
|
+
}]
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
const result = await resp.json();
|
|
102
|
+
return result.data[0].id;
|
|
103
|
+
};
|
|
104
|
+
const getThemeId = async (technicalName, adminApiContext) => {
|
|
105
|
+
const resp = await adminApiContext.post("search/theme", {
|
|
106
|
+
data: {
|
|
107
|
+
limit: 1,
|
|
108
|
+
filter: [{
|
|
109
|
+
type: "equals",
|
|
110
|
+
field: "technicalName",
|
|
111
|
+
value: technicalName
|
|
112
|
+
}]
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
const result = await resp.json();
|
|
116
|
+
return result.data[0].id;
|
|
117
|
+
};
|
|
118
|
+
const getSalutationId = async (salutationKey, adminApiContext) => {
|
|
119
|
+
const resp = await adminApiContext.post("search/salutation", {
|
|
120
|
+
data: {
|
|
121
|
+
limit: 1,
|
|
122
|
+
filter: [{
|
|
123
|
+
type: "equals",
|
|
124
|
+
field: "salutationKey",
|
|
125
|
+
value: salutationKey
|
|
126
|
+
}]
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
const result = await resp.json();
|
|
130
|
+
return result.data[0].id;
|
|
131
|
+
};
|
|
132
|
+
const getStateMachineId = async (technicalName, adminApiContext) => {
|
|
133
|
+
const resp = await adminApiContext.post("search/state-machine", {
|
|
134
|
+
data: {
|
|
135
|
+
limit: 1,
|
|
136
|
+
filter: [{
|
|
137
|
+
type: "equals",
|
|
138
|
+
field: "technicalName",
|
|
139
|
+
value: technicalName
|
|
140
|
+
}]
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
const result = await resp.json();
|
|
144
|
+
return result.data[0].id;
|
|
145
|
+
};
|
|
146
|
+
const getStateMachineStateId = async (stateMachineId, adminApiContext) => {
|
|
147
|
+
const resp = await adminApiContext.post("search/state-machine-state", {
|
|
148
|
+
data: {
|
|
149
|
+
limit: 1,
|
|
150
|
+
filter: [{
|
|
151
|
+
type: "equals",
|
|
152
|
+
field: "stateMachineId",
|
|
153
|
+
value: stateMachineId
|
|
154
|
+
}]
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
const result = await resp.json();
|
|
158
|
+
return result.data[0].id;
|
|
159
|
+
};
|
|
160
|
+
const getFlowId = async (eventName, adminApiContext) => {
|
|
161
|
+
const resp = await adminApiContext.post("search-ids/flow", {
|
|
162
|
+
data: {
|
|
163
|
+
query: [{
|
|
164
|
+
query: {
|
|
165
|
+
type: "contains",
|
|
166
|
+
field: "flow.eventName",
|
|
167
|
+
value: eventName
|
|
168
|
+
}
|
|
169
|
+
}]
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
const result = await resp.json();
|
|
173
|
+
return result.data[0];
|
|
174
|
+
};
|
|
175
|
+
const getOrderTransactionId = async (orderId, adminApiContext) => {
|
|
176
|
+
const orderTransactionResponse = await adminApiContext.get(`order/${orderId}/transactions?_response`);
|
|
177
|
+
const { data: orderTransaction } = await orderTransactionResponse.json();
|
|
178
|
+
return orderTransaction[0].id;
|
|
179
|
+
};
|
|
180
|
+
const getMediaId = async (fileName, adminApiContext) => {
|
|
181
|
+
const resp = await adminApiContext.post("./search/media", {
|
|
182
|
+
data: {
|
|
183
|
+
limit: 1,
|
|
184
|
+
filter: [{
|
|
185
|
+
type: "equals",
|
|
186
|
+
field: "fileName",
|
|
187
|
+
value: fileName
|
|
188
|
+
}]
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
const result = await resp.json();
|
|
192
|
+
return result.data[0].id;
|
|
193
|
+
};
|
|
194
|
+
function extractIdFromUrl(url) {
|
|
195
|
+
const segments = url.split("/");
|
|
196
|
+
return segments.length > 0 ? segments[segments.length - 1] : null;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const test$a = test$c.extend({
|
|
200
|
+
SalesChannelBaseConfig: [
|
|
201
|
+
async ({ AdminApiContext }, use) => {
|
|
202
|
+
const requests = {
|
|
203
|
+
language: getLanguageData("en-GB", AdminApiContext),
|
|
204
|
+
currencyEUR: getCurrency("EUR", AdminApiContext),
|
|
205
|
+
invoicePaymentMethodId: getPaymentMethodId(AdminApiContext),
|
|
206
|
+
defaultShippingMethod: getDefaultShippingMethodId(AdminApiContext),
|
|
207
|
+
getTaxId: getTaxId(AdminApiContext),
|
|
208
|
+
deCountryId: getCountryId("de", AdminApiContext),
|
|
209
|
+
enGBSnippetSetId: getSnippetSetId("en-GB", AdminApiContext),
|
|
210
|
+
defaultThemeId: getThemeId("Storefront", AdminApiContext)
|
|
211
|
+
};
|
|
212
|
+
await Promise.all(Object.values(requests));
|
|
213
|
+
const lang = await requests.language;
|
|
214
|
+
const currency = await requests.currencyEUR;
|
|
215
|
+
await use({
|
|
216
|
+
enGBLocaleId: lang.localeId,
|
|
217
|
+
enGBLanguageId: lang.id,
|
|
218
|
+
storefrontTypeId: "8a243080f92e4c719546314b577cf82b",
|
|
219
|
+
eurCurrencyId: currency.id,
|
|
220
|
+
invoicePaymentMethodId: await requests.invoicePaymentMethodId,
|
|
221
|
+
defaultShippingMethod: await requests.defaultShippingMethod,
|
|
222
|
+
taxId: await requests.getTaxId,
|
|
223
|
+
deCountryId: await requests.deCountryId,
|
|
224
|
+
enGBSnippetSetId: await requests.enGBSnippetSetId,
|
|
225
|
+
defaultThemeId: await requests.defaultThemeId,
|
|
226
|
+
appUrl: process.env["APP_URL"],
|
|
227
|
+
adminUrl: process.env["ADMIN_URL"] || `${process.env["APP_URL"]}admin/`
|
|
228
|
+
});
|
|
229
|
+
},
|
|
230
|
+
{ scope: "worker" }
|
|
231
|
+
],
|
|
232
|
+
DefaultSalesChannel: [
|
|
233
|
+
async ({ IdProvider, AdminApiContext, SalesChannelBaseConfig }, use) => {
|
|
234
|
+
const { id, uuid } = IdProvider.getWorkerDerivedStableId("salesChannel");
|
|
235
|
+
const { uuid: rootCategoryUuid } = IdProvider.getWorkerDerivedStableId("category");
|
|
236
|
+
const { uuid: customerGroupUuid } = IdProvider.getWorkerDerivedStableId("customerGroup");
|
|
237
|
+
const { uuid: domainUuid } = IdProvider.getWorkerDerivedStableId("domain");
|
|
238
|
+
const { uuid: customerUuid } = IdProvider.getWorkerDerivedStableId("customer");
|
|
239
|
+
const baseUrl = `${SalesChannelBaseConfig.appUrl}test-${uuid}/`;
|
|
240
|
+
const currentConfigResponse = await AdminApiContext.get(`./_action/system-config?domain=storefront&salesChannelId=${uuid}`);
|
|
241
|
+
const currentConfig = await currentConfigResponse.json();
|
|
242
|
+
await AdminApiContext.delete(`./customer/${customerUuid}`);
|
|
243
|
+
const ordersResp = await AdminApiContext.post(`./search/order`, {
|
|
244
|
+
data: {
|
|
245
|
+
filter: [{
|
|
246
|
+
type: "equals",
|
|
247
|
+
field: "salesChannelId",
|
|
248
|
+
value: uuid
|
|
249
|
+
}]
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
const orders = await ordersResp.json();
|
|
253
|
+
if (orders.data) {
|
|
254
|
+
for (const order of orders.data) {
|
|
255
|
+
const deleteOrderResp = await AdminApiContext.delete(`./order/${order.id}`);
|
|
256
|
+
expect(deleteOrderResp.ok()).toBeTruthy();
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
const versionsResp = await AdminApiContext.post(`./search/version`);
|
|
260
|
+
expect(versionsResp.ok()).toBeTruthy();
|
|
261
|
+
const versions = await versionsResp.json();
|
|
262
|
+
const versionIds = versions.data.map((v) => v.id);
|
|
263
|
+
for (const versionId of versionIds) {
|
|
264
|
+
const ordersResp2 = await AdminApiContext.post(`./search/order`, {
|
|
265
|
+
data: {
|
|
266
|
+
filter: [
|
|
267
|
+
{
|
|
268
|
+
type: "equals",
|
|
269
|
+
field: "salesChannelId",
|
|
270
|
+
value: uuid
|
|
271
|
+
}
|
|
272
|
+
]
|
|
273
|
+
},
|
|
274
|
+
headers: {
|
|
275
|
+
"sw-version-id": versionId
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
const orders2 = await ordersResp2.json();
|
|
279
|
+
if (orders2.data) {
|
|
280
|
+
for (const order of orders2.data) {
|
|
281
|
+
const deleteOrderResp = await AdminApiContext.post(
|
|
282
|
+
`./_action/version/${versionId}/order/${order.id}`
|
|
283
|
+
);
|
|
284
|
+
expect(deleteOrderResp.ok()).toBeTruthy();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
await AdminApiContext.delete(`./sales-channel/${uuid}`);
|
|
289
|
+
const syncResp = await AdminApiContext.post("./_action/sync", {
|
|
290
|
+
data: {
|
|
291
|
+
"write-sales-channel": {
|
|
292
|
+
entity: "sales_channel",
|
|
293
|
+
action: "upsert",
|
|
294
|
+
payload: [
|
|
295
|
+
{
|
|
296
|
+
id: uuid,
|
|
297
|
+
name: `${id} acceptance test`,
|
|
298
|
+
typeId: SalesChannelBaseConfig.storefrontTypeId,
|
|
299
|
+
languageId: SalesChannelBaseConfig.enGBLanguageId,
|
|
300
|
+
currencyId: SalesChannelBaseConfig.eurCurrencyId,
|
|
301
|
+
paymentMethodId: SalesChannelBaseConfig.invoicePaymentMethodId,
|
|
302
|
+
shippingMethodId: SalesChannelBaseConfig.defaultShippingMethod,
|
|
303
|
+
countryId: SalesChannelBaseConfig.deCountryId,
|
|
304
|
+
accessKey: "SWSC" + uuid,
|
|
305
|
+
homeEnabled: true,
|
|
306
|
+
navigationCategory: {
|
|
307
|
+
id: rootCategoryUuid,
|
|
308
|
+
name: `${id} Acceptance test`,
|
|
309
|
+
displayNestedProducts: true,
|
|
310
|
+
type: "page",
|
|
311
|
+
productAssignmentType: "product"
|
|
312
|
+
},
|
|
313
|
+
domains: [{
|
|
314
|
+
id: domainUuid,
|
|
315
|
+
url: baseUrl,
|
|
316
|
+
languageId: SalesChannelBaseConfig.enGBLanguageId,
|
|
317
|
+
snippetSetId: SalesChannelBaseConfig.enGBSnippetSetId,
|
|
318
|
+
currencyId: SalesChannelBaseConfig.eurCurrencyId
|
|
319
|
+
}],
|
|
320
|
+
customerGroup: {
|
|
321
|
+
id: customerGroupUuid,
|
|
322
|
+
name: `${id} Acceptance test`
|
|
323
|
+
},
|
|
324
|
+
languages: [{ id: SalesChannelBaseConfig.enGBLanguageId }],
|
|
325
|
+
countries: [{ id: SalesChannelBaseConfig.deCountryId }],
|
|
326
|
+
shippingMethods: [{ id: SalesChannelBaseConfig.defaultShippingMethod }],
|
|
327
|
+
paymentMethods: [{ id: SalesChannelBaseConfig.invoicePaymentMethodId }],
|
|
328
|
+
currencies: [{ id: SalesChannelBaseConfig.eurCurrencyId }]
|
|
329
|
+
}
|
|
330
|
+
]
|
|
331
|
+
},
|
|
332
|
+
"theme-assignment": {
|
|
333
|
+
entity: "theme_sales_channel",
|
|
334
|
+
action: "upsert",
|
|
335
|
+
payload: [{
|
|
336
|
+
salesChannelId: uuid,
|
|
337
|
+
themeId: SalesChannelBaseConfig.defaultThemeId
|
|
338
|
+
}]
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
expect(syncResp.ok()).toBeTruthy();
|
|
343
|
+
const salesChannelPromise = AdminApiContext.get(`./sales-channel/${uuid}`);
|
|
344
|
+
let themeAssignPromise;
|
|
345
|
+
if (currentConfig && currentConfig["storefront.themeSeed"]) {
|
|
346
|
+
const md5 = (data) => createHash("md5").update(data).digest("hex");
|
|
347
|
+
const md5Str = md5(`${SalesChannelBaseConfig.defaultThemeId}${uuid}${currentConfig["storefront.themeSeed"]}`);
|
|
348
|
+
const themeCssResp = await AdminApiContext.head(`${SalesChannelBaseConfig.appUrl}theme/${md5Str}/css/all.css`);
|
|
349
|
+
if (themeCssResp.status() === 200) {
|
|
350
|
+
themeAssignPromise = AdminApiContext.post(`./_action/system-config?salesChannelId=${uuid}`, {
|
|
351
|
+
data: {
|
|
352
|
+
"storefront.themeSeed": currentConfig["storefront.themeSeed"]
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
if (!themeAssignPromise) {
|
|
358
|
+
themeAssignPromise = AdminApiContext.post(
|
|
359
|
+
`./_action/theme/${SalesChannelBaseConfig.defaultThemeId}/assign/${uuid}`
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
const salutationResponse = await AdminApiContext.get(`./salutation`);
|
|
363
|
+
const salutations = await salutationResponse.json();
|
|
364
|
+
const customerData = {
|
|
365
|
+
id: customerUuid,
|
|
366
|
+
email: `customer_${id}@example.com`,
|
|
367
|
+
password: "shopware",
|
|
368
|
+
salutationId: salutations.data[0].id,
|
|
369
|
+
defaultShippingAddress: {
|
|
370
|
+
firstName: `${id} admin`,
|
|
371
|
+
lastName: `${id} admin`,
|
|
372
|
+
city: "not",
|
|
373
|
+
street: "not",
|
|
374
|
+
zipcode: "not",
|
|
375
|
+
countryId: SalesChannelBaseConfig.deCountryId,
|
|
376
|
+
salutationId: salutations.data[0].id
|
|
377
|
+
},
|
|
378
|
+
defaultBillingAddress: {
|
|
379
|
+
firstName: `${id} admin`,
|
|
380
|
+
lastName: `${id} admin`,
|
|
381
|
+
city: "not",
|
|
382
|
+
street: "not",
|
|
383
|
+
zipcode: "not",
|
|
384
|
+
countryId: SalesChannelBaseConfig.deCountryId,
|
|
385
|
+
salutationId: salutations.data[0].id
|
|
386
|
+
},
|
|
387
|
+
firstName: `${id} admin`,
|
|
388
|
+
lastName: `${id} admin`,
|
|
389
|
+
salesChannelId: uuid,
|
|
390
|
+
groupId: customerGroupUuid,
|
|
391
|
+
customerNumber: `${customerUuid}`,
|
|
392
|
+
defaultPaymentMethodId: SalesChannelBaseConfig.invoicePaymentMethodId
|
|
393
|
+
};
|
|
394
|
+
const customerRespPromise = AdminApiContext.post("./customer?_response", {
|
|
395
|
+
data: customerData
|
|
396
|
+
});
|
|
397
|
+
const [customerResp, themeAssignResp, salesChannelResp] = await Promise.all([
|
|
398
|
+
customerRespPromise,
|
|
399
|
+
themeAssignPromise,
|
|
400
|
+
salesChannelPromise
|
|
401
|
+
]);
|
|
402
|
+
expect(customerResp.ok()).toBeTruthy();
|
|
403
|
+
expect(themeAssignResp.ok()).toBeTruthy();
|
|
404
|
+
expect(salesChannelResp.ok()).toBeTruthy();
|
|
405
|
+
const customer = await customerResp.json();
|
|
406
|
+
const salesChannel = await salesChannelResp.json();
|
|
407
|
+
await use({
|
|
408
|
+
salesChannel: salesChannel.data,
|
|
409
|
+
customer: { ...customer.data, password: customerData.password },
|
|
410
|
+
url: baseUrl
|
|
411
|
+
});
|
|
412
|
+
},
|
|
413
|
+
{ scope: "worker" }
|
|
414
|
+
]
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
var __defProp$k = Object.defineProperty;
|
|
418
|
+
var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
419
|
+
var __publicField$k = (obj, key, value) => {
|
|
420
|
+
__defNormalProp$k(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
421
|
+
return value;
|
|
422
|
+
};
|
|
423
|
+
const _AdminApiContext = class _AdminApiContext {
|
|
424
|
+
constructor(context, options) {
|
|
425
|
+
__publicField$k(this, "context");
|
|
426
|
+
__publicField$k(this, "options");
|
|
427
|
+
this.context = context;
|
|
428
|
+
this.options = options;
|
|
429
|
+
}
|
|
430
|
+
static async create(options) {
|
|
431
|
+
const contextOptions = { ...this.defaultOptions, ...options };
|
|
432
|
+
const tmpContext = await this.createApiRequestContext(contextOptions);
|
|
433
|
+
if (!contextOptions.client_id) {
|
|
434
|
+
contextOptions["access_token"] = await this.authenticateWithUserPassword(tmpContext, contextOptions);
|
|
435
|
+
const userContext = await this.createApiRequestContext(contextOptions);
|
|
436
|
+
const accessKeyData = await (await userContext.get("_action/access-key/integration")).json();
|
|
437
|
+
const integrationData = {
|
|
438
|
+
admin: true,
|
|
439
|
+
label: "Playwright Acceptance Test Suite",
|
|
440
|
+
...accessKeyData
|
|
441
|
+
};
|
|
442
|
+
await userContext.post("integration", {
|
|
443
|
+
data: integrationData
|
|
444
|
+
});
|
|
445
|
+
contextOptions.client_id = accessKeyData.accessKey;
|
|
446
|
+
contextOptions.client_secret = accessKeyData.secretAccessKey;
|
|
447
|
+
}
|
|
448
|
+
contextOptions["access_token"] = await this.authenticateWithClientCredentials(tmpContext, contextOptions);
|
|
449
|
+
return new _AdminApiContext(await this.createApiRequestContext(contextOptions), contextOptions);
|
|
450
|
+
}
|
|
451
|
+
static async createApiRequestContext(options) {
|
|
452
|
+
const extraHTTPHeaders = {
|
|
453
|
+
"Accept": "application/json",
|
|
454
|
+
"Content-Type": "application/json"
|
|
455
|
+
};
|
|
456
|
+
if (options.access_token && options.access_token.length) {
|
|
457
|
+
extraHTTPHeaders["Authorization"] = "Bearer " + options.access_token;
|
|
458
|
+
}
|
|
459
|
+
return await request.newContext({
|
|
460
|
+
baseURL: `${options.app_url}api/`,
|
|
461
|
+
ignoreHTTPSErrors: options.ignoreHTTPSErrors,
|
|
462
|
+
extraHTTPHeaders
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
static async authenticateWithClientCredentials(context, options) {
|
|
466
|
+
const authResponse = await context.post("oauth/token", {
|
|
467
|
+
data: {
|
|
468
|
+
grant_type: "client_credentials",
|
|
469
|
+
client_id: options.client_id,
|
|
470
|
+
client_secret: options.client_secret,
|
|
471
|
+
scope: ["write"]
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
const authData = await authResponse.json();
|
|
475
|
+
if (!authData["access_token"]) {
|
|
476
|
+
throw new Error(`Failed to authenticate with client_id: ${options.client_id}`);
|
|
477
|
+
}
|
|
478
|
+
return authData["access_token"];
|
|
479
|
+
}
|
|
480
|
+
static async authenticateWithUserPassword(context, options) {
|
|
481
|
+
const authResponse = await context.post("oauth/token", {
|
|
482
|
+
data: {
|
|
483
|
+
client_id: "administration",
|
|
484
|
+
grant_type: "password",
|
|
485
|
+
username: options.admin_username,
|
|
486
|
+
password: options.admin_password,
|
|
487
|
+
scope: ["write"]
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
const authData = await authResponse.json();
|
|
491
|
+
if (!authData["access_token"]) {
|
|
492
|
+
throw new Error(`Failed to authenticate with user: ${options.admin_username}`);
|
|
493
|
+
}
|
|
494
|
+
return authData["access_token"];
|
|
495
|
+
}
|
|
496
|
+
isAuthenticated() {
|
|
497
|
+
return !!this.options["access_token"];
|
|
498
|
+
}
|
|
499
|
+
async get(url, options) {
|
|
500
|
+
return this.context.get(url, options);
|
|
501
|
+
}
|
|
502
|
+
async post(url, options) {
|
|
503
|
+
return this.context.post(url, options);
|
|
504
|
+
}
|
|
505
|
+
async patch(url, options) {
|
|
506
|
+
return this.context.patch(url, options);
|
|
507
|
+
}
|
|
508
|
+
async delete(url, options) {
|
|
509
|
+
return this.context.delete(url, options);
|
|
510
|
+
}
|
|
511
|
+
async fetch(url, options) {
|
|
512
|
+
return this.context.fetch(url, options);
|
|
513
|
+
}
|
|
514
|
+
async head(url, options) {
|
|
515
|
+
return this.context.head(url, options);
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
__publicField$k(_AdminApiContext, "defaultOptions", {
|
|
519
|
+
app_url: process.env["APP_URL"],
|
|
520
|
+
client_id: process.env["SHOPWARE_ACCESS_KEY_ID"],
|
|
521
|
+
client_secret: process.env["SHOPWARE_SECRET_ACCESS_KEY"],
|
|
522
|
+
admin_username: process.env["SHOPWARE_ADMIN_USERNAME"] || "admin",
|
|
523
|
+
admin_password: process.env["SHOPWARE_ADMIN_PASSWORD"] || "shopware",
|
|
524
|
+
ignoreHTTPSErrors: true
|
|
525
|
+
});
|
|
526
|
+
let AdminApiContext = _AdminApiContext;
|
|
527
|
+
|
|
528
|
+
var __defProp$j = Object.defineProperty;
|
|
529
|
+
var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
530
|
+
var __publicField$j = (obj, key, value) => {
|
|
531
|
+
__defNormalProp$j(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
532
|
+
return value;
|
|
533
|
+
};
|
|
534
|
+
const _StoreApiContext = class _StoreApiContext {
|
|
535
|
+
constructor(context, options) {
|
|
536
|
+
__publicField$j(this, "context");
|
|
537
|
+
__publicField$j(this, "options");
|
|
538
|
+
this.context = context;
|
|
539
|
+
this.options = options;
|
|
540
|
+
}
|
|
541
|
+
static async create(options) {
|
|
542
|
+
const contextOptions = { ...this.defaultOptions, ...options };
|
|
543
|
+
return new _StoreApiContext(await this.createContext(contextOptions), contextOptions);
|
|
544
|
+
}
|
|
545
|
+
static async createContext(options) {
|
|
546
|
+
const extraHTTPHeaders = {
|
|
547
|
+
"Accept": "application/json",
|
|
548
|
+
"Content-Type": "application/json"
|
|
549
|
+
};
|
|
550
|
+
if (options["sw-access-key"]) {
|
|
551
|
+
extraHTTPHeaders["sw-access-key"] = options["sw-access-key"];
|
|
552
|
+
}
|
|
553
|
+
if (options["sw-context-token"]) {
|
|
554
|
+
extraHTTPHeaders["sw-context-token"] = options["sw-context-token"];
|
|
555
|
+
}
|
|
556
|
+
return await request.newContext({
|
|
557
|
+
baseURL: `${options["app_url"]}store-api/`,
|
|
558
|
+
ignoreHTTPSErrors: options.ignoreHTTPSErrors,
|
|
559
|
+
extraHTTPHeaders
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
async login(user) {
|
|
563
|
+
const loginResponse = await this.post(`account/login`, {
|
|
564
|
+
data: {
|
|
565
|
+
username: user.email,
|
|
566
|
+
password: user.password
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
const responseHeaders = loginResponse.headers();
|
|
570
|
+
if (!responseHeaders["sw-context-token"]) {
|
|
571
|
+
throw new Error(`Failed to login with user: ${user.email}`);
|
|
572
|
+
}
|
|
573
|
+
this.options["sw-context-token"] = responseHeaders["sw-context-token"];
|
|
574
|
+
this.context = await _StoreApiContext.createContext(this.options);
|
|
575
|
+
return responseHeaders;
|
|
576
|
+
}
|
|
577
|
+
async get(url, options) {
|
|
578
|
+
return this.context.get(url, options);
|
|
579
|
+
}
|
|
580
|
+
async post(url, options) {
|
|
581
|
+
return this.context.post(url, options);
|
|
582
|
+
}
|
|
583
|
+
async patch(url, options) {
|
|
584
|
+
return this.context.patch(url, options);
|
|
585
|
+
}
|
|
586
|
+
async delete(url, options) {
|
|
587
|
+
return this.context.delete(url, options);
|
|
588
|
+
}
|
|
589
|
+
async fetch(url, options) {
|
|
590
|
+
return this.context.fetch(url, options);
|
|
591
|
+
}
|
|
592
|
+
async head(url, options) {
|
|
593
|
+
return this.context.head(url, options);
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
__publicField$j(_StoreApiContext, "defaultOptions", {
|
|
597
|
+
app_url: process.env["APP_URL"],
|
|
598
|
+
ignoreHTTPSErrors: true
|
|
599
|
+
});
|
|
600
|
+
let StoreApiContext = _StoreApiContext;
|
|
601
|
+
|
|
602
|
+
const test$9 = test$c.extend({
|
|
603
|
+
AdminApiContext: [
|
|
604
|
+
async ({}, use) => {
|
|
605
|
+
const adminApiContext = await AdminApiContext.create();
|
|
606
|
+
await use(adminApiContext);
|
|
607
|
+
},
|
|
608
|
+
{ scope: "worker" }
|
|
609
|
+
],
|
|
610
|
+
StoreApiContext: [
|
|
611
|
+
async ({ DefaultSalesChannel }, use) => {
|
|
612
|
+
const options = {
|
|
613
|
+
app_url: process.env["APP_URL"],
|
|
614
|
+
"sw-access-key": DefaultSalesChannel.salesChannel.accessKey,
|
|
615
|
+
ignoreHTTPSErrors: true
|
|
616
|
+
};
|
|
617
|
+
const storeApiContext = await StoreApiContext.create(options);
|
|
618
|
+
await use(storeApiContext);
|
|
619
|
+
},
|
|
620
|
+
{ scope: "worker" }
|
|
621
|
+
]
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
const test$8 = test$c.extend({
|
|
625
|
+
AdminPage: async ({ IdProvider, AdminApiContext, SalesChannelBaseConfig, browser }, use) => {
|
|
626
|
+
const context = await browser.newContext({
|
|
627
|
+
baseURL: SalesChannelBaseConfig.adminUrl
|
|
628
|
+
});
|
|
629
|
+
const page = await context.newPage();
|
|
630
|
+
const { id, uuid } = IdProvider.getIdPair();
|
|
631
|
+
const adminUser = {
|
|
632
|
+
id: uuid,
|
|
633
|
+
username: `admin_${id}`,
|
|
634
|
+
firstName: `${id} admin`,
|
|
635
|
+
lastName: `${id} admin`,
|
|
636
|
+
localeId: SalesChannelBaseConfig.enGBLocaleId,
|
|
637
|
+
email: `admin_${id}@example.com`,
|
|
638
|
+
timezone: "Europe/Berlin",
|
|
639
|
+
password: "shopware",
|
|
640
|
+
admin: true
|
|
641
|
+
};
|
|
642
|
+
const response = await AdminApiContext.post("user", {
|
|
643
|
+
data: adminUser
|
|
644
|
+
});
|
|
645
|
+
expect(response.ok()).toBeTruthy();
|
|
646
|
+
await page.goto("#/login");
|
|
647
|
+
await page.getByLabel("Username").fill(adminUser.username);
|
|
648
|
+
await page.getByLabel("Password").fill(adminUser.password);
|
|
649
|
+
await page.getByRole("button", { name: "Log in" }).click();
|
|
650
|
+
await expect(page.locator("css=.sw-admin-menu__header-logo").first()).toBeVisible({
|
|
651
|
+
timeout: 2e4
|
|
652
|
+
});
|
|
653
|
+
await expect(page.locator(".sw-skeleton")).toHaveCount(0, {
|
|
654
|
+
timeout: 1e4
|
|
655
|
+
});
|
|
656
|
+
await expect(page.locator(".sw-loader")).toHaveCount(0, {
|
|
657
|
+
timeout: 1e4
|
|
658
|
+
});
|
|
659
|
+
await page.addStyleTag({
|
|
660
|
+
content: `
|
|
661
|
+
.sf-toolbar {
|
|
662
|
+
width: 0 !important;
|
|
663
|
+
height: 0 !important;
|
|
664
|
+
display: none !important;
|
|
665
|
+
pointer-events: none !important;
|
|
666
|
+
}
|
|
667
|
+
`.trim()
|
|
668
|
+
});
|
|
669
|
+
await use(page);
|
|
670
|
+
await page.close();
|
|
671
|
+
await context.close();
|
|
672
|
+
const cleanupResponse = await AdminApiContext.delete(`user/${uuid}`);
|
|
673
|
+
expect(cleanupResponse.ok()).toBeTruthy();
|
|
674
|
+
},
|
|
675
|
+
StorefrontPage: async ({ DefaultSalesChannel, browser }, use) => {
|
|
676
|
+
const { url } = DefaultSalesChannel;
|
|
677
|
+
const context = await browser.newContext({
|
|
678
|
+
baseURL: url
|
|
679
|
+
});
|
|
680
|
+
const page = await context.newPage();
|
|
681
|
+
await page.goto("./");
|
|
682
|
+
await use(page);
|
|
683
|
+
await page.close();
|
|
684
|
+
await context.close();
|
|
685
|
+
}
|
|
686
|
+
});
|
|
687
|
+
|
|
688
|
+
var __defProp$i = Object.defineProperty;
|
|
689
|
+
var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
690
|
+
var __publicField$i = (obj, key, value) => {
|
|
691
|
+
__defNormalProp$i(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
692
|
+
return value;
|
|
693
|
+
};
|
|
694
|
+
class Actor {
|
|
695
|
+
constructor(name, page) {
|
|
696
|
+
__publicField$i(this, "page");
|
|
697
|
+
__publicField$i(this, "name");
|
|
698
|
+
__publicField$i(this, "expects", expect);
|
|
699
|
+
this.name = name;
|
|
700
|
+
this.page = page;
|
|
701
|
+
}
|
|
702
|
+
async attemptsTo(task) {
|
|
703
|
+
const stepTitle = `${this.name} attempts to ${this.camelCaseToLowerCase(task.name)}`;
|
|
704
|
+
await test$c.step(stepTitle, async () => await task());
|
|
705
|
+
}
|
|
706
|
+
async goesTo(pageObject) {
|
|
707
|
+
const stepTitle = `${this.name} navigates to ${this.camelCaseToLowerCase(pageObject.constructor.name)}`;
|
|
708
|
+
await test$c.step(stepTitle, async () => {
|
|
709
|
+
await pageObject.goTo();
|
|
710
|
+
await this.page.addStyleTag({
|
|
711
|
+
content: `
|
|
712
|
+
.sf-toolbar {
|
|
713
|
+
width: 0 !important;
|
|
714
|
+
height: 0 !important;
|
|
715
|
+
display: none !important;
|
|
716
|
+
pointer-events: none !important;
|
|
717
|
+
}
|
|
718
|
+
`.trim()
|
|
719
|
+
});
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
camelCaseToLowerCase(str) {
|
|
723
|
+
return str.replace(/[A-Z]/g, (letter) => ` ${letter.toLowerCase()}`);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
const test$7 = test$c.extend({
|
|
728
|
+
ShopCustomer: async ({ StorefrontPage }, use) => {
|
|
729
|
+
const shopCustomer = new Actor("Shop customer", StorefrontPage);
|
|
730
|
+
await use(shopCustomer);
|
|
731
|
+
},
|
|
732
|
+
ShopAdmin: async ({ AdminPage }, use) => {
|
|
733
|
+
const shopAdmin = new Actor("Shop administrator", AdminPage);
|
|
734
|
+
await use(shopAdmin);
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
var __defProp$h = Object.defineProperty;
|
|
739
|
+
var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
740
|
+
var __publicField$h = (obj, key, value) => {
|
|
741
|
+
__defNormalProp$h(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
742
|
+
return value;
|
|
743
|
+
};
|
|
744
|
+
class IdProvider {
|
|
745
|
+
constructor(workerIndex, seed) {
|
|
746
|
+
__publicField$h(this, "workerIndex");
|
|
747
|
+
__publicField$h(this, "seed");
|
|
748
|
+
this.workerIndex = workerIndex;
|
|
749
|
+
this.seed = seed;
|
|
750
|
+
}
|
|
751
|
+
getIdPair() {
|
|
752
|
+
return {
|
|
753
|
+
id: `${crypto.randomInt(0, 281474976710655)}`,
|
|
754
|
+
uuid: crypto.randomUUID().replaceAll("-", "")
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
getUniqueName() {
|
|
758
|
+
return `name_${this.getIdPair().id}`;
|
|
759
|
+
}
|
|
760
|
+
getWorkerDerivedStableId(key) {
|
|
761
|
+
const hash = crypto.createHash("sha256");
|
|
762
|
+
hash.update(this.seed);
|
|
763
|
+
hash.update(key);
|
|
764
|
+
hash.update(`${this.workerIndex}`);
|
|
765
|
+
const buffer = hash.digest();
|
|
766
|
+
const bytes = Uint8Array.from(buffer).slice(0, 16);
|
|
767
|
+
bytes[6] = 1 << 5;
|
|
768
|
+
bytes[8] = 128;
|
|
769
|
+
return {
|
|
770
|
+
id: `${this.workerIndex}`,
|
|
771
|
+
uuid: stringify(bytes).replaceAll("-", "")
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
const test$6 = test$c.extend({
|
|
777
|
+
IdProvider: [
|
|
778
|
+
async ({}, use, workerInfo) => {
|
|
779
|
+
const seed = process.env.SHOPWARE_ACCESS_KEY_ID || process.env.SHOPWARE_ADMIN_PASSWORD || "test-suite";
|
|
780
|
+
const idProvider = new IdProvider(workerInfo.workerIndex, seed);
|
|
781
|
+
await use(idProvider);
|
|
782
|
+
},
|
|
783
|
+
{ scope: "worker" }
|
|
784
|
+
]
|
|
785
|
+
});
|
|
786
|
+
|
|
787
|
+
var __defProp$g = Object.defineProperty;
|
|
788
|
+
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
789
|
+
var __publicField$g = (obj, key, value) => {
|
|
790
|
+
__defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
791
|
+
return value;
|
|
792
|
+
};
|
|
793
|
+
class Home {
|
|
794
|
+
constructor(page) {
|
|
795
|
+
this.page = page;
|
|
796
|
+
__publicField$g(this, "productImages");
|
|
797
|
+
this.productImages = page.locator(".product-image-link");
|
|
798
|
+
}
|
|
799
|
+
async goTo() {
|
|
800
|
+
await this.page.goto("./");
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
var __defProp$f = Object.defineProperty;
|
|
805
|
+
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
806
|
+
var __publicField$f = (obj, key, value) => {
|
|
807
|
+
__defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
808
|
+
return value;
|
|
809
|
+
};
|
|
810
|
+
let ProductDetail$1 = class ProductDetail {
|
|
811
|
+
constructor(page, productData) {
|
|
812
|
+
this.page = page;
|
|
813
|
+
this.productData = productData;
|
|
814
|
+
__publicField$f(this, "addToCartButton");
|
|
815
|
+
__publicField$f(this, "offCanvasCartTitle");
|
|
816
|
+
__publicField$f(this, "offCanvasCart");
|
|
817
|
+
__publicField$f(this, "offCanvasCartGoToCheckoutButton");
|
|
818
|
+
__publicField$f(this, "productSingleImage");
|
|
819
|
+
__publicField$f(this, "offCanvasLineItemImages");
|
|
820
|
+
__publicField$f(this, "quantitySelect");
|
|
821
|
+
__publicField$f(this, "offCanvasSummaryTotalPrice");
|
|
822
|
+
__publicField$f(this, "offCanvas");
|
|
823
|
+
this.addToCartButton = page.getByRole("button", { name: "Add to shopping cart" });
|
|
824
|
+
this.offCanvasCartTitle = page.getByText("Shopping cart", { exact: true });
|
|
825
|
+
this.offCanvasCart = page.getByRole("dialog");
|
|
826
|
+
this.offCanvasCartGoToCheckoutButton = page.getByRole("link", { name: "Go to checkout" });
|
|
827
|
+
this.offCanvasLineItemImages = page.locator(".line-item-img-link");
|
|
828
|
+
this.quantitySelect = page.getByLabel("Quantity", { exact: true });
|
|
829
|
+
this.offCanvas = page.locator("offcanvas-body");
|
|
830
|
+
this.offCanvasSummaryTotalPrice = page.locator(".offcanvas-summary").locator('dt:has-text("Subtotal") + dd');
|
|
831
|
+
this.productSingleImage = page.locator(".gallery-slider-single-image");
|
|
832
|
+
}
|
|
833
|
+
async goTo(productData = this.productData) {
|
|
834
|
+
let namePath = "";
|
|
835
|
+
if (productData.translated && productData.translated.name) {
|
|
836
|
+
namePath = productData.translated.name.replaceAll("_", "-");
|
|
837
|
+
}
|
|
838
|
+
const url = `${namePath}/${productData.productNumber}`;
|
|
839
|
+
await this.page.goto(url);
|
|
840
|
+
}
|
|
841
|
+
};
|
|
842
|
+
|
|
843
|
+
var __defProp$e = Object.defineProperty;
|
|
844
|
+
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
845
|
+
var __publicField$e = (obj, key, value) => {
|
|
846
|
+
__defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
847
|
+
return value;
|
|
848
|
+
};
|
|
849
|
+
class CheckoutCart {
|
|
850
|
+
constructor(page) {
|
|
851
|
+
this.page = page;
|
|
852
|
+
__publicField$e(this, "headline");
|
|
853
|
+
__publicField$e(this, "goToCheckoutButton");
|
|
854
|
+
__publicField$e(this, "enterDiscountInput");
|
|
855
|
+
__publicField$e(this, "grandTotalPrice");
|
|
856
|
+
__publicField$e(this, "emptyCartAlert");
|
|
857
|
+
__publicField$e(this, "stockReachedAlert");
|
|
858
|
+
__publicField$e(this, "cartLineItemImages");
|
|
859
|
+
__publicField$e(this, "unitPriceInfo");
|
|
860
|
+
this.headline = page.getByRole("heading", { name: "Shopping cart" });
|
|
861
|
+
this.goToCheckoutButton = page.getByRole("link", { name: "Go to checkout" });
|
|
862
|
+
this.enterDiscountInput = page.getByLabel("Discount code");
|
|
863
|
+
this.grandTotalPrice = page.locator('dt:has-text("Grand total") + dd:visible');
|
|
864
|
+
this.emptyCartAlert = page.getByText("Your shopping cart is empty.");
|
|
865
|
+
this.stockReachedAlert = page.getByText("only available 1 times");
|
|
866
|
+
this.cartLineItemImages = page.locator(".line-item-img-link");
|
|
867
|
+
this.unitPriceInfo = page.locator(".line-item-unit-price-value");
|
|
868
|
+
}
|
|
869
|
+
async goTo() {
|
|
870
|
+
await this.page.goto("checkout/cart");
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
var __defProp$d = Object.defineProperty;
|
|
875
|
+
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
876
|
+
var __publicField$d = (obj, key, value) => {
|
|
877
|
+
__defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
878
|
+
return value;
|
|
879
|
+
};
|
|
880
|
+
class CheckoutConfirm {
|
|
881
|
+
constructor(page) {
|
|
882
|
+
this.page = page;
|
|
883
|
+
__publicField$d(this, "headline");
|
|
884
|
+
__publicField$d(this, "termsAndConditionsCheckbox");
|
|
885
|
+
__publicField$d(this, "immediateAccessToDigitalProductCheckbox");
|
|
886
|
+
__publicField$d(this, "grandTotalPrice");
|
|
887
|
+
__publicField$d(this, "submitOrderButton");
|
|
888
|
+
/**
|
|
889
|
+
* Payment options
|
|
890
|
+
*/
|
|
891
|
+
__publicField$d(this, "paymentCashOnDelivery");
|
|
892
|
+
__publicField$d(this, "paymentPaidInAdvance");
|
|
893
|
+
__publicField$d(this, "paymentInvoice");
|
|
894
|
+
/**
|
|
895
|
+
* Shipping options
|
|
896
|
+
*/
|
|
897
|
+
__publicField$d(this, "shippingStandard");
|
|
898
|
+
__publicField$d(this, "shippingExpress");
|
|
899
|
+
/**
|
|
900
|
+
* Product details
|
|
901
|
+
*/
|
|
902
|
+
__publicField$d(this, "cartLineItemImages");
|
|
903
|
+
this.headline = page.getByRole("heading", { name: "Complete order" });
|
|
904
|
+
this.termsAndConditionsCheckbox = page.getByLabel("I have read and accepted the general terms and conditions.");
|
|
905
|
+
this.immediateAccessToDigitalProductCheckbox = page.getByLabel("I want immediate access to the digital content and I acknowledge that thereby I waive my right to cancel.");
|
|
906
|
+
this.grandTotalPrice = page.locator(`dt:has-text('Grand total') + dd`);
|
|
907
|
+
this.submitOrderButton = page.getByRole("button", { name: "Submit order" });
|
|
908
|
+
this.paymentCashOnDelivery = page.getByLabel("Cash on delivery");
|
|
909
|
+
this.paymentPaidInAdvance = page.getByLabel("Paid in advance");
|
|
910
|
+
this.paymentInvoice = page.getByLabel("Invoice");
|
|
911
|
+
this.shippingStandard = page.getByLabel("Standard");
|
|
912
|
+
this.shippingExpress = page.getByLabel("Express");
|
|
913
|
+
this.cartLineItemImages = page.locator(".line-item-img-link");
|
|
914
|
+
}
|
|
915
|
+
async goTo() {
|
|
916
|
+
await this.page.goto("checkout/confirm");
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
var __defProp$c = Object.defineProperty;
|
|
921
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
922
|
+
var __publicField$c = (obj, key, value) => {
|
|
923
|
+
__defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
924
|
+
return value;
|
|
925
|
+
};
|
|
926
|
+
class CheckoutFinish {
|
|
927
|
+
constructor(page) {
|
|
928
|
+
this.page = page;
|
|
929
|
+
__publicField$c(this, "headline");
|
|
930
|
+
__publicField$c(this, "orderNumberText");
|
|
931
|
+
__publicField$c(this, "grandTotalPrice");
|
|
932
|
+
__publicField$c(this, "cartLineItemImages");
|
|
933
|
+
__publicField$c(this, "orderNumberRegex", /Your order number: #(\d+)/);
|
|
934
|
+
this.headline = page.getByRole("heading", { name: "Thank you for your order" });
|
|
935
|
+
this.orderNumberText = page.getByText(this.orderNumberRegex);
|
|
936
|
+
this.grandTotalPrice = page.locator('dt:has-text("Grand total") + dd');
|
|
937
|
+
this.cartLineItemImages = page.locator(".line-item-img-link");
|
|
938
|
+
}
|
|
939
|
+
async goTo() {
|
|
940
|
+
console.error("The checkout finish page should only be navigated to via checkout action.");
|
|
941
|
+
}
|
|
942
|
+
async getOrderNumber() {
|
|
943
|
+
const orderNumberText = await this.orderNumberText.textContent();
|
|
944
|
+
let orderNumber = null;
|
|
945
|
+
if (orderNumberText !== null) {
|
|
946
|
+
const matches = orderNumberText.match(this.orderNumberRegex);
|
|
947
|
+
if (matches !== null && matches.length) {
|
|
948
|
+
orderNumber = matches[1];
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
return orderNumber;
|
|
952
|
+
}
|
|
953
|
+
getOrderId() {
|
|
954
|
+
const url = this.page.url();
|
|
955
|
+
const [, searchString] = url.split("?");
|
|
956
|
+
const params = new URLSearchParams(searchString);
|
|
957
|
+
return params.get("orderId");
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
var __defProp$b = Object.defineProperty;
|
|
962
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
963
|
+
var __publicField$b = (obj, key, value) => {
|
|
964
|
+
__defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
965
|
+
return value;
|
|
966
|
+
};
|
|
967
|
+
class CheckoutRegister {
|
|
968
|
+
constructor(page) {
|
|
969
|
+
this.page = page;
|
|
970
|
+
__publicField$b(this, "cartLineItemImages");
|
|
971
|
+
this.cartLineItemImages = page.locator(".line-item-img-link");
|
|
972
|
+
}
|
|
973
|
+
async goTo() {
|
|
974
|
+
await this.page.goto("checkout/register");
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
var __defProp$a = Object.defineProperty;
|
|
979
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
980
|
+
var __publicField$a = (obj, key, value) => {
|
|
981
|
+
__defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
982
|
+
return value;
|
|
983
|
+
};
|
|
984
|
+
class Account {
|
|
985
|
+
constructor(page) {
|
|
986
|
+
this.page = page;
|
|
987
|
+
__publicField$a(this, "headline");
|
|
988
|
+
__publicField$a(this, "personalDataCardTitle");
|
|
989
|
+
this.headline = page.getByRole("heading", { name: "Overview" });
|
|
990
|
+
this.personalDataCardTitle = page.getByRole("heading", { name: "Personal data" });
|
|
991
|
+
}
|
|
992
|
+
async goTo() {
|
|
993
|
+
await this.page.goto("account");
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
var __defProp$9 = Object.defineProperty;
|
|
998
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
999
|
+
var __publicField$9 = (obj, key, value) => {
|
|
1000
|
+
__defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1001
|
+
return value;
|
|
1002
|
+
};
|
|
1003
|
+
class AccountLogin {
|
|
1004
|
+
constructor(page) {
|
|
1005
|
+
this.page = page;
|
|
1006
|
+
__publicField$9(this, "emailInput");
|
|
1007
|
+
__publicField$9(this, "passwordInput");
|
|
1008
|
+
__publicField$9(this, "loginButton");
|
|
1009
|
+
__publicField$9(this, "logoutLink");
|
|
1010
|
+
__publicField$9(this, "successAlert");
|
|
1011
|
+
// Inputs for registration
|
|
1012
|
+
__publicField$9(this, "personalFormArea");
|
|
1013
|
+
__publicField$9(this, "billingAddressFormArea");
|
|
1014
|
+
__publicField$9(this, "firstNameInput");
|
|
1015
|
+
__publicField$9(this, "lastNameInput");
|
|
1016
|
+
__publicField$9(this, "registerEmailInput");
|
|
1017
|
+
__publicField$9(this, "registerPasswordInput");
|
|
1018
|
+
__publicField$9(this, "streetAddressInput");
|
|
1019
|
+
__publicField$9(this, "cityInput");
|
|
1020
|
+
__publicField$9(this, "countryInput");
|
|
1021
|
+
__publicField$9(this, "registerButton");
|
|
1022
|
+
this.emailInput = page.getByLabel("Your email address");
|
|
1023
|
+
this.passwordInput = page.getByLabel("Your password");
|
|
1024
|
+
this.loginButton = page.getByRole("button", { name: "Log in" });
|
|
1025
|
+
this.logoutLink = page.getByRole("link", { name: "Log out" });
|
|
1026
|
+
this.personalFormArea = page.locator(".register-personal");
|
|
1027
|
+
this.billingAddressFormArea = page.locator(".register-billing");
|
|
1028
|
+
this.firstNameInput = this.personalFormArea.getByLabel("First name*");
|
|
1029
|
+
this.lastNameInput = this.personalFormArea.getByLabel("Last name*");
|
|
1030
|
+
this.registerEmailInput = this.personalFormArea.getByLabel("Email address*");
|
|
1031
|
+
this.registerPasswordInput = this.personalFormArea.getByLabel("Password*");
|
|
1032
|
+
this.streetAddressInput = this.billingAddressFormArea.getByLabel("Street address*");
|
|
1033
|
+
this.cityInput = this.billingAddressFormArea.getByLabel("City*");
|
|
1034
|
+
this.countryInput = this.billingAddressFormArea.getByLabel("Country*");
|
|
1035
|
+
this.registerButton = page.getByRole("button", { name: "Continue" });
|
|
1036
|
+
this.logoutLink = page.getByRole("link", { name: "Log out" });
|
|
1037
|
+
this.successAlert = page.getByText("Successfully logged out.");
|
|
1038
|
+
}
|
|
1039
|
+
async goTo() {
|
|
1040
|
+
await this.page.goto("account/login");
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
var __defProp$8 = Object.defineProperty;
|
|
1045
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1046
|
+
var __publicField$8 = (obj, key, value) => {
|
|
1047
|
+
__defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1048
|
+
return value;
|
|
1049
|
+
};
|
|
1050
|
+
class AccountOrder {
|
|
1051
|
+
constructor(page) {
|
|
1052
|
+
this.page = page;
|
|
1053
|
+
__publicField$8(this, "cartLineItemImages");
|
|
1054
|
+
__publicField$8(this, "orderExpandButton");
|
|
1055
|
+
__publicField$8(this, "digitalProductDownloadButton");
|
|
1056
|
+
this.orderExpandButton = page.getByRole("button", { name: "Expand" }).first();
|
|
1057
|
+
this.cartLineItemImages = page.locator(".line-item-img-link");
|
|
1058
|
+
this.digitalProductDownloadButton = page.getByRole("link", { name: "Download" }).first();
|
|
1059
|
+
}
|
|
1060
|
+
async goTo() {
|
|
1061
|
+
await this.page.goto("account/order");
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
var __defProp$7 = Object.defineProperty;
|
|
1066
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1067
|
+
var __publicField$7 = (obj, key, value) => {
|
|
1068
|
+
__defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1069
|
+
return value;
|
|
1070
|
+
};
|
|
1071
|
+
class Search {
|
|
1072
|
+
constructor(page) {
|
|
1073
|
+
this.page = page;
|
|
1074
|
+
__publicField$7(this, "productImages");
|
|
1075
|
+
this.productImages = page.locator(".product-image-link");
|
|
1076
|
+
}
|
|
1077
|
+
async goTo() {
|
|
1078
|
+
const url = `search?search`;
|
|
1079
|
+
await this.page.goto(url);
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
var __defProp$6 = Object.defineProperty;
|
|
1084
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1085
|
+
var __publicField$6 = (obj, key, value) => {
|
|
1086
|
+
__defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1087
|
+
return value;
|
|
1088
|
+
};
|
|
1089
|
+
class SearchSuggest {
|
|
1090
|
+
constructor(page) {
|
|
1091
|
+
this.page = page;
|
|
1092
|
+
__publicField$6(this, "searchSuggestLineItemImages");
|
|
1093
|
+
this.searchSuggestLineItemImages = page.locator(".search-suggest-product-image-container");
|
|
1094
|
+
}
|
|
1095
|
+
async goTo() {
|
|
1096
|
+
const url = `suggest?search`;
|
|
1097
|
+
await this.page.goto(url);
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
const StorefrontPageObjects = {
|
|
1102
|
+
Home,
|
|
1103
|
+
ProductDetail: ProductDetail$1,
|
|
1104
|
+
CheckoutCart,
|
|
1105
|
+
CheckoutConfirm,
|
|
1106
|
+
CheckoutFinish,
|
|
1107
|
+
CheckoutRegister,
|
|
1108
|
+
Account,
|
|
1109
|
+
AccountLogin,
|
|
1110
|
+
AccountOrder,
|
|
1111
|
+
Search,
|
|
1112
|
+
SearchSuggest
|
|
1113
|
+
};
|
|
1114
|
+
const test$5 = test$c.extend({
|
|
1115
|
+
StorefrontHome: async ({ StorefrontPage }, use) => {
|
|
1116
|
+
await use(new Home(StorefrontPage));
|
|
1117
|
+
},
|
|
1118
|
+
StorefrontProductDetail: async ({ StorefrontPage, ProductData }, use) => {
|
|
1119
|
+
await use(new ProductDetail$1(StorefrontPage, ProductData));
|
|
1120
|
+
},
|
|
1121
|
+
StorefrontCheckoutCart: async ({ StorefrontPage }, use) => {
|
|
1122
|
+
await use(new CheckoutCart(StorefrontPage));
|
|
1123
|
+
},
|
|
1124
|
+
StorefrontCheckoutConfirm: async ({ StorefrontPage }, use) => {
|
|
1125
|
+
await use(new CheckoutConfirm(StorefrontPage));
|
|
1126
|
+
},
|
|
1127
|
+
StorefrontCheckoutFinish: async ({ StorefrontPage }, use) => {
|
|
1128
|
+
await use(new CheckoutFinish(StorefrontPage));
|
|
1129
|
+
},
|
|
1130
|
+
StorefrontCheckoutRegister: async ({ StorefrontPage }, use) => {
|
|
1131
|
+
await use(new CheckoutRegister(StorefrontPage));
|
|
1132
|
+
},
|
|
1133
|
+
StorefrontAccount: async ({ StorefrontPage }, use) => {
|
|
1134
|
+
await use(new Account(StorefrontPage));
|
|
1135
|
+
},
|
|
1136
|
+
StorefrontAccountLogin: async ({ StorefrontPage }, use) => {
|
|
1137
|
+
await use(new AccountLogin(StorefrontPage));
|
|
1138
|
+
},
|
|
1139
|
+
StorefrontAccountOrder: async ({ StorefrontPage }, use) => {
|
|
1140
|
+
await use(new AccountOrder(StorefrontPage));
|
|
1141
|
+
},
|
|
1142
|
+
StorefrontSearch: async ({ StorefrontPage }, use) => {
|
|
1143
|
+
await use(new Search(StorefrontPage));
|
|
1144
|
+
},
|
|
1145
|
+
StorefrontSearchSuggest: async ({ StorefrontPage }, use) => {
|
|
1146
|
+
await use(new SearchSuggest(StorefrontPage));
|
|
1147
|
+
}
|
|
1148
|
+
});
|
|
1149
|
+
|
|
1150
|
+
var __defProp$5 = Object.defineProperty;
|
|
1151
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1152
|
+
var __publicField$5 = (obj, key, value) => {
|
|
1153
|
+
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1154
|
+
return value;
|
|
1155
|
+
};
|
|
1156
|
+
class ProductDetail {
|
|
1157
|
+
constructor(page, productData) {
|
|
1158
|
+
this.page = page;
|
|
1159
|
+
/**
|
|
1160
|
+
* Save interactions
|
|
1161
|
+
*/
|
|
1162
|
+
__publicField$5(this, "savePhysicalProductButton");
|
|
1163
|
+
__publicField$5(this, "saveButtonLoadingSpinner");
|
|
1164
|
+
__publicField$5(this, "saveButtonCheckMark");
|
|
1165
|
+
/**
|
|
1166
|
+
* Media Upload interactions
|
|
1167
|
+
*/
|
|
1168
|
+
__publicField$5(this, "uploadMediaButton");
|
|
1169
|
+
__publicField$5(this, "coverImage");
|
|
1170
|
+
__publicField$5(this, "productImage");
|
|
1171
|
+
/**
|
|
1172
|
+
* Tabs
|
|
1173
|
+
*/
|
|
1174
|
+
__publicField$5(this, "variantsTabLink");
|
|
1175
|
+
/**
|
|
1176
|
+
* Variants Generation
|
|
1177
|
+
*/
|
|
1178
|
+
__publicField$5(this, "generateVariantsButton");
|
|
1179
|
+
__publicField$5(this, "variantsModal");
|
|
1180
|
+
__publicField$5(this, "variantsModalHeadline");
|
|
1181
|
+
__publicField$5(this, "variantsNextButton");
|
|
1182
|
+
__publicField$5(this, "variantsSaveButton");
|
|
1183
|
+
/**
|
|
1184
|
+
* Property Selection
|
|
1185
|
+
*/
|
|
1186
|
+
__publicField$5(this, "propertyGroupColor");
|
|
1187
|
+
__publicField$5(this, "propertyGroupSize");
|
|
1188
|
+
__publicField$5(this, "propertyOptionGrid");
|
|
1189
|
+
__publicField$5(this, "propertyOptionColorBlue");
|
|
1190
|
+
__publicField$5(this, "propertyOptionColorRed");
|
|
1191
|
+
__publicField$5(this, "propertyOptionColorGreen");
|
|
1192
|
+
__publicField$5(this, "propertyOptionSizeSmall");
|
|
1193
|
+
__publicField$5(this, "propertyOptionSizeMedium");
|
|
1194
|
+
__publicField$5(this, "propertyOptionSizeLarge");
|
|
1195
|
+
__publicField$5(this, "productData");
|
|
1196
|
+
this.productData = productData;
|
|
1197
|
+
this.savePhysicalProductButton = page.getByRole("button", { name: "Save" });
|
|
1198
|
+
this.saveButtonCheckMark = page.locator(".icon--regular-checkmark-xs");
|
|
1199
|
+
this.saveButtonLoadingSpinner = page.locator("sw-loader");
|
|
1200
|
+
this.uploadMediaButton = page.getByRole("button", { name: "Upload file" });
|
|
1201
|
+
this.coverImage = page.locator(".sw-product-media-form__cover-image");
|
|
1202
|
+
this.productImage = page.locator(".sw-media-preview-v2__item");
|
|
1203
|
+
this.variantsTabLink = page.getByRole("link", { name: "Variants" });
|
|
1204
|
+
this.generateVariantsButton = page.getByRole("button", { name: "Generate variants" });
|
|
1205
|
+
this.variantsModal = page.getByRole("dialog", { name: "Generate variants" });
|
|
1206
|
+
this.variantsModalHeadline = this.variantsModal.getByRole("heading", { name: "Generate variants" });
|
|
1207
|
+
this.variantsNextButton = this.variantsModal.getByRole("button", { name: "Next" });
|
|
1208
|
+
this.variantsSaveButton = this.variantsModal.getByRole("button", { name: "Save variants" });
|
|
1209
|
+
this.propertyGroupColor = this.variantsModal.getByText("Color").first();
|
|
1210
|
+
this.propertyGroupSize = this.variantsModal.getByText("Size").first();
|
|
1211
|
+
this.propertyOptionGrid = this.variantsModal.locator(".sw-property-search__tree-selection__option_grid");
|
|
1212
|
+
this.propertyOptionColorBlue = this.propertyOptionGrid.getByLabel("Blue");
|
|
1213
|
+
this.propertyOptionColorRed = this.propertyOptionGrid.getByLabel("Red");
|
|
1214
|
+
this.propertyOptionColorGreen = this.propertyOptionGrid.getByLabel("Green");
|
|
1215
|
+
this.propertyOptionSizeSmall = this.propertyOptionGrid.getByLabel("Small");
|
|
1216
|
+
this.propertyOptionSizeMedium = this.propertyOptionGrid.getByLabel("Medium");
|
|
1217
|
+
this.propertyOptionSizeLarge = this.propertyOptionGrid.getByLabel("Large");
|
|
1218
|
+
}
|
|
1219
|
+
async goTo() {
|
|
1220
|
+
await this.page.goto(`#/sw/product/detail/${this.productData.id}/base`);
|
|
1221
|
+
}
|
|
1222
|
+
getProductId() {
|
|
1223
|
+
return this.productData.id;
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
var __defProp$4 = Object.defineProperty;
|
|
1228
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1229
|
+
var __publicField$4 = (obj, key, value) => {
|
|
1230
|
+
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1231
|
+
return value;
|
|
1232
|
+
};
|
|
1233
|
+
class OrderDetail {
|
|
1234
|
+
constructor(page, orderData) {
|
|
1235
|
+
this.page = page;
|
|
1236
|
+
__publicField$4(this, "dataGridContextButton");
|
|
1237
|
+
__publicField$4(this, "orderTag");
|
|
1238
|
+
__publicField$4(this, "orderData");
|
|
1239
|
+
this.orderData = orderData;
|
|
1240
|
+
this.dataGridContextButton = page.locator(".sw-data-grid__actions-menu").and(page.getByRole("button"));
|
|
1241
|
+
this.orderTag = page.locator(".sw-select-selection-list__item");
|
|
1242
|
+
}
|
|
1243
|
+
async goTo() {
|
|
1244
|
+
await this.page.goto(`#/sw/order/detail/${this.orderData.id}/general`);
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
var __defProp$3 = Object.defineProperty;
|
|
1249
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1250
|
+
var __publicField$3 = (obj, key, value) => {
|
|
1251
|
+
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1252
|
+
return value;
|
|
1253
|
+
};
|
|
1254
|
+
class CustomerDetail {
|
|
1255
|
+
constructor(page, customer) {
|
|
1256
|
+
this.page = page;
|
|
1257
|
+
__publicField$3(this, "customerId");
|
|
1258
|
+
__publicField$3(this, "editButton");
|
|
1259
|
+
__publicField$3(this, "generalTab");
|
|
1260
|
+
__publicField$3(this, "accountCard");
|
|
1261
|
+
this.customerId = customer.id;
|
|
1262
|
+
this.editButton = page.getByRole("button", { name: "Edit" });
|
|
1263
|
+
this.generalTab = page.getByRole("link", { name: "General" });
|
|
1264
|
+
this.accountCard = page.locator(".sw-customer-card");
|
|
1265
|
+
}
|
|
1266
|
+
async goTo() {
|
|
1267
|
+
await this.page.goto(`#/sw/customer/detail/${this.customerId}/base`);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
var __defProp$2 = Object.defineProperty;
|
|
1272
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1273
|
+
var __publicField$2 = (obj, key, value) => {
|
|
1274
|
+
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1275
|
+
return value;
|
|
1276
|
+
};
|
|
1277
|
+
class FirstRunWizard {
|
|
1278
|
+
constructor(page) {
|
|
1279
|
+
this.page = page;
|
|
1280
|
+
__publicField$2(this, "nextButton");
|
|
1281
|
+
__publicField$2(this, "configureLaterButton");
|
|
1282
|
+
__publicField$2(this, "skipButton");
|
|
1283
|
+
__publicField$2(this, "finishButton");
|
|
1284
|
+
__publicField$2(this, "backButton");
|
|
1285
|
+
__publicField$2(this, "smtpServerButton");
|
|
1286
|
+
__publicField$2(this, "dataImportHeader");
|
|
1287
|
+
__publicField$2(this, "installLanguagePackButton");
|
|
1288
|
+
__publicField$2(this, "installDemoDataButton");
|
|
1289
|
+
__publicField$2(this, "installMigrationAssistantButton");
|
|
1290
|
+
__publicField$2(this, "defaultValuesHeader");
|
|
1291
|
+
__publicField$2(this, "mailerConfigurationHeader");
|
|
1292
|
+
__publicField$2(this, "payPalSetupHeader");
|
|
1293
|
+
__publicField$2(this, "extensionsHeader");
|
|
1294
|
+
__publicField$2(this, "shopwareAccountHeader");
|
|
1295
|
+
__publicField$2(this, "shopwareStoreHeader");
|
|
1296
|
+
__publicField$2(this, "doneHeader");
|
|
1297
|
+
__publicField$2(this, "frwSuccessText");
|
|
1298
|
+
__publicField$2(this, "welcomeText");
|
|
1299
|
+
__publicField$2(this, "pluginCardInfo");
|
|
1300
|
+
__publicField$2(this, "dataImportCard");
|
|
1301
|
+
__publicField$2(this, "salesChannelSelectionList");
|
|
1302
|
+
__publicField$2(this, "salesChannelSelectionMultiSelect");
|
|
1303
|
+
__publicField$2(this, "smtpServerTitle");
|
|
1304
|
+
__publicField$2(this, "smtpServerFields");
|
|
1305
|
+
__publicField$2(this, "payPalPaymethods");
|
|
1306
|
+
__publicField$2(this, "payPalInfoCard");
|
|
1307
|
+
__publicField$2(this, "emailAddressInputField");
|
|
1308
|
+
__publicField$2(this, "passwordInputField");
|
|
1309
|
+
__publicField$2(this, "forgotPasswordLink");
|
|
1310
|
+
__publicField$2(this, "extensionStoreHeading");
|
|
1311
|
+
__publicField$2(this, "documentationLink");
|
|
1312
|
+
__publicField$2(this, "forumLink");
|
|
1313
|
+
__publicField$2(this, "roadmapLink");
|
|
1314
|
+
__publicField$2(this, "germanRegionSelector");
|
|
1315
|
+
__publicField$2(this, "toolsSelector");
|
|
1316
|
+
__publicField$2(this, "recommendationHeader");
|
|
1317
|
+
__publicField$2(this, "toolsRecommendedPlugin");
|
|
1318
|
+
this.nextButton = page.getByText("Next", { exact: true });
|
|
1319
|
+
this.configureLaterButton = page.getByText("Configure later", { exact: true });
|
|
1320
|
+
this.skipButton = page.getByText("Skip", { exact: true });
|
|
1321
|
+
this.finishButton = page.getByText("Finish", { exact: true });
|
|
1322
|
+
this.backButton = page.getByText("Back", { exact: true });
|
|
1323
|
+
this.installLanguagePackButton = page.getByRole("button", { name: "Install" });
|
|
1324
|
+
this.welcomeText = page.locator(".headline-welcome", { hasText: "Welcome to the Shopware 6 Administration" });
|
|
1325
|
+
this.pluginCardInfo = page.locator(".sw-plugin-card__info");
|
|
1326
|
+
this.installMigrationAssistantButton = page.getByRole("button", { name: "Install Migration Assistant" });
|
|
1327
|
+
this.installDemoDataButton = page.getByRole("button", { name: "Install demo data" });
|
|
1328
|
+
this.dataImportHeader = page.locator(".sw-modal__title", { hasText: "Getting started with Shopware 6" });
|
|
1329
|
+
this.dataImportCard = page.locator(".sw-first-run-wizard-data-import__card");
|
|
1330
|
+
this.defaultValuesHeader = page.locator(".sw-modal__title", { hasText: "Setup default values" });
|
|
1331
|
+
this.salesChannelSelectionMultiSelect = page.getByPlaceholder("Select Sales Channels...");
|
|
1332
|
+
this.salesChannelSelectionList = page.locator(".sw-popover__wrapper").getByRole("listitem");
|
|
1333
|
+
this.mailerConfigurationHeader = page.locator(".sw-modal__title", { hasText: "Mailer configuration" });
|
|
1334
|
+
this.smtpServerButton = page.getByText("Configure own SMTP server", { exact: true });
|
|
1335
|
+
this.smtpServerTitle = page.getByText("SMTP server", { exact: true });
|
|
1336
|
+
this.smtpServerFields = page.locator(".sw-field");
|
|
1337
|
+
this.payPalSetupHeader = page.locator(".sw-modal__title", { hasText: "Setup PayPal" });
|
|
1338
|
+
this.payPalPaymethods = page.locator(".paymethod");
|
|
1339
|
+
this.payPalInfoCard = page.locator(".sw-first-run-wizard-paypal-info");
|
|
1340
|
+
this.extensionsHeader = page.locator(".sw-modal__title", { hasText: "Extensions" });
|
|
1341
|
+
this.germanRegionSelector = page.getByText("Germany / Austria / Switzerland");
|
|
1342
|
+
this.toolsSelector = page.getByText("Tools");
|
|
1343
|
+
this.recommendationHeader = page.getByText("Global recommendations", { exact: true });
|
|
1344
|
+
this.toolsRecommendedPlugin = page.locator(".sw-plugin-card__info").locator(".sw-plugin-card__label");
|
|
1345
|
+
this.shopwareAccountHeader = page.locator(".sw-modal__title", { hasText: "Shopware Account" });
|
|
1346
|
+
this.emailAddressInputField = page.getByPlaceholder("Enter your email address...", { exact: true });
|
|
1347
|
+
this.passwordInputField = page.getByPlaceholder("Enter your password...", { exact: true });
|
|
1348
|
+
this.forgotPasswordLink = page.getByText("Did you forget your password?", { exact: true });
|
|
1349
|
+
this.shopwareStoreHeader = page.locator(".sw-modal__title", { hasText: "Shopware Store" });
|
|
1350
|
+
this.doneHeader = page.locator(".sw-modal__title", { hasText: "Done" });
|
|
1351
|
+
this.extensionStoreHeading = page.locator(".sw-first-run-wizard-store__heading");
|
|
1352
|
+
this.frwSuccessText = page.getByText("All done!", { exact: true });
|
|
1353
|
+
this.documentationLink = page.locator('[href*="https://docs.shopware.com/en"]');
|
|
1354
|
+
this.forumLink = page.locator('[href*="https://forum.shopware.com/"]');
|
|
1355
|
+
this.roadmapLink = page.locator('[href*="https://www.shopware.com/en/roadmap/"]');
|
|
1356
|
+
}
|
|
1357
|
+
async goTo() {
|
|
1358
|
+
await this.page.goto(`#/sw/first/run/wizard/index/`);
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
var __defProp$1 = Object.defineProperty;
|
|
1363
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1364
|
+
var __publicField$1 = (obj, key, value) => {
|
|
1365
|
+
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1366
|
+
return value;
|
|
1367
|
+
};
|
|
1368
|
+
class FlowBuilderCreate {
|
|
1369
|
+
constructor(page) {
|
|
1370
|
+
this.page = page;
|
|
1371
|
+
__publicField$1(this, "saveButton");
|
|
1372
|
+
__publicField$1(this, "header");
|
|
1373
|
+
this.saveButton = page.locator(".sw-flow-detail__save");
|
|
1374
|
+
this.header = page.locator("h2");
|
|
1375
|
+
}
|
|
1376
|
+
async goTo() {
|
|
1377
|
+
await this.page.goto(`#/sw/flow/create/general`);
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
var __defProp = Object.defineProperty;
|
|
1382
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1383
|
+
var __publicField = (obj, key, value) => {
|
|
1384
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1385
|
+
return value;
|
|
1386
|
+
};
|
|
1387
|
+
class FlowBuilderListing {
|
|
1388
|
+
constructor(page) {
|
|
1389
|
+
this.page = page;
|
|
1390
|
+
__publicField(this, "firstFlowName");
|
|
1391
|
+
__publicField(this, "firstFlowContextButton");
|
|
1392
|
+
__publicField(this, "flowContextMenu");
|
|
1393
|
+
__publicField(this, "contextMenuDownload");
|
|
1394
|
+
__publicField(this, "flowDownloadModal");
|
|
1395
|
+
__publicField(this, "downloadFlowButton");
|
|
1396
|
+
__publicField(this, "successAlert");
|
|
1397
|
+
__publicField(this, "successAlertMessage");
|
|
1398
|
+
this.firstFlowName = page.locator(".sw-data-grid__cell--name a").first();
|
|
1399
|
+
this.firstFlowContextButton = page.locator(".sw-data-grid__actions-menu").first();
|
|
1400
|
+
this.flowContextMenu = page.locator(".sw-context-menu__content");
|
|
1401
|
+
this.contextMenuDownload = page.locator(".sw-flow-list__item-download");
|
|
1402
|
+
this.flowDownloadModal = page.locator(" .sw-flow-download-modal");
|
|
1403
|
+
this.downloadFlowButton = page.getByRole("button", { name: "Download flow" });
|
|
1404
|
+
this.successAlert = page.locator(".sw-alert__body");
|
|
1405
|
+
this.successAlertMessage = page.locator(".sw-alert__message");
|
|
1406
|
+
}
|
|
1407
|
+
async goTo() {
|
|
1408
|
+
await this.page.goto(`#/sw/flow/index/`);
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
const AdminPageObjects = {
|
|
1413
|
+
ProductDetail,
|
|
1414
|
+
OrderDetail,
|
|
1415
|
+
CustomerDetail,
|
|
1416
|
+
FirstRunWizard,
|
|
1417
|
+
FlowBuilderCreate,
|
|
1418
|
+
FlowBuilderListing
|
|
1419
|
+
};
|
|
1420
|
+
const test$4 = test$c.extend({
|
|
1421
|
+
AdminProductDetail: async ({ AdminPage, ProductData }, use) => {
|
|
1422
|
+
await use(new ProductDetail(AdminPage, ProductData));
|
|
1423
|
+
},
|
|
1424
|
+
AdminOrderDetail: async ({ AdminPage, OrderData }, use) => {
|
|
1425
|
+
await use(new OrderDetail(AdminPage, OrderData));
|
|
1426
|
+
},
|
|
1427
|
+
AdminCustomerDetail: async ({ AdminPage, DefaultSalesChannel }, use) => {
|
|
1428
|
+
await use(new CustomerDetail(AdminPage, DefaultSalesChannel.customer));
|
|
1429
|
+
},
|
|
1430
|
+
AdminFirstRunWizard: async ({ AdminPage }, use) => {
|
|
1431
|
+
await use(new FirstRunWizard(AdminPage));
|
|
1432
|
+
},
|
|
1433
|
+
AdminFlowBuilderCreate: async ({ AdminPage }, use) => {
|
|
1434
|
+
await use(new FlowBuilderCreate(AdminPage));
|
|
1435
|
+
},
|
|
1436
|
+
AdminFlowBuilderListing: async ({ AdminPage }, use) => {
|
|
1437
|
+
await use(new FlowBuilderListing(AdminPage));
|
|
1438
|
+
}
|
|
1439
|
+
});
|
|
1440
|
+
|
|
1441
|
+
const ProductData = test$c.extend({
|
|
1442
|
+
ProductData: async ({ IdProvider, SalesChannelBaseConfig, AdminApiContext, DefaultSalesChannel }, use) => {
|
|
1443
|
+
const { id: productId, uuid: productUuid } = IdProvider.getIdPair();
|
|
1444
|
+
const productName = `Product_test_${productId}`;
|
|
1445
|
+
const productResponse = await AdminApiContext.post("./product?_response", {
|
|
1446
|
+
data: {
|
|
1447
|
+
active: true,
|
|
1448
|
+
stock: 10,
|
|
1449
|
+
taxId: SalesChannelBaseConfig.taxId,
|
|
1450
|
+
id: productUuid,
|
|
1451
|
+
name: productName,
|
|
1452
|
+
productNumber: "Product-" + productId,
|
|
1453
|
+
price: [
|
|
1454
|
+
{
|
|
1455
|
+
currencyId: SalesChannelBaseConfig.eurCurrencyId,
|
|
1456
|
+
gross: 10,
|
|
1457
|
+
linked: false,
|
|
1458
|
+
net: 8.4
|
|
1459
|
+
}
|
|
1460
|
+
],
|
|
1461
|
+
purchasePrices: [
|
|
1462
|
+
{
|
|
1463
|
+
currencyId: SalesChannelBaseConfig.eurCurrencyId,
|
|
1464
|
+
gross: 8,
|
|
1465
|
+
linked: false,
|
|
1466
|
+
net: 6.7
|
|
1467
|
+
}
|
|
1468
|
+
]
|
|
1469
|
+
}
|
|
1470
|
+
});
|
|
1471
|
+
expect(productResponse.ok()).toBeTruthy();
|
|
1472
|
+
const { data: product } = await productResponse.json();
|
|
1473
|
+
const syncResp = await AdminApiContext.post("./_action/sync", {
|
|
1474
|
+
data: {
|
|
1475
|
+
"add product to sales channel": {
|
|
1476
|
+
entity: "product_visibility",
|
|
1477
|
+
action: "upsert",
|
|
1478
|
+
payload: [
|
|
1479
|
+
{
|
|
1480
|
+
productId: product.id,
|
|
1481
|
+
salesChannelId: DefaultSalesChannel.salesChannel.id,
|
|
1482
|
+
visibility: 30
|
|
1483
|
+
}
|
|
1484
|
+
]
|
|
1485
|
+
},
|
|
1486
|
+
"add product to root navigation": {
|
|
1487
|
+
entity: "product_category",
|
|
1488
|
+
action: "upsert",
|
|
1489
|
+
payload: [
|
|
1490
|
+
{
|
|
1491
|
+
productId: product.id,
|
|
1492
|
+
categoryId: DefaultSalesChannel.salesChannel.navigationCategoryId
|
|
1493
|
+
}
|
|
1494
|
+
]
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
});
|
|
1498
|
+
expect(syncResp.ok()).toBeTruthy();
|
|
1499
|
+
await use(product);
|
|
1500
|
+
const cleanupResponse = await AdminApiContext.delete(`./product/${productUuid}`);
|
|
1501
|
+
expect(cleanupResponse.ok()).toBeTruthy();
|
|
1502
|
+
}
|
|
1503
|
+
});
|
|
1504
|
+
|
|
1505
|
+
const DigitalProductData = test$c.extend({
|
|
1506
|
+
DigitalProductData: async ({ IdProvider, AdminApiContext, ProductData }, use) => {
|
|
1507
|
+
const newMediaResource = await AdminApiContext.post("./media?_response", {
|
|
1508
|
+
data: {
|
|
1509
|
+
private: false
|
|
1510
|
+
}
|
|
1511
|
+
});
|
|
1512
|
+
expect(newMediaResource.ok()).toBeTruthy();
|
|
1513
|
+
const { data: newMediaValue } = await newMediaResource.json();
|
|
1514
|
+
const newMediaId = newMediaValue.id;
|
|
1515
|
+
const filename = "testfile_" + IdProvider.getUniqueName();
|
|
1516
|
+
const fileContent = "This is a test file to test digital product download";
|
|
1517
|
+
const newMediaUpload = await AdminApiContext.post(`./_action/media/${newMediaId}/upload?extension=txt&fileName=${filename}&_response`, {
|
|
1518
|
+
headers: {
|
|
1519
|
+
"content-type": "application/octet-stream"
|
|
1520
|
+
},
|
|
1521
|
+
data: fileContent
|
|
1522
|
+
});
|
|
1523
|
+
expect(newMediaUpload.ok()).toBeTruthy();
|
|
1524
|
+
const productDownloadResponse = await AdminApiContext.post(`./product-download?_response`, {
|
|
1525
|
+
data: {
|
|
1526
|
+
productId: ProductData.id,
|
|
1527
|
+
mediaId: newMediaId
|
|
1528
|
+
}
|
|
1529
|
+
});
|
|
1530
|
+
expect(productDownloadResponse.ok()).toBeTruthy();
|
|
1531
|
+
const { data: productDownload } = await productDownloadResponse.json();
|
|
1532
|
+
const returnData = {
|
|
1533
|
+
product: ProductData,
|
|
1534
|
+
fileContent
|
|
1535
|
+
};
|
|
1536
|
+
await use(returnData);
|
|
1537
|
+
const orderSearchResponse = await AdminApiContext.post("./search/order", {
|
|
1538
|
+
data: {
|
|
1539
|
+
limit: 10,
|
|
1540
|
+
filter: [
|
|
1541
|
+
{
|
|
1542
|
+
type: "equals",
|
|
1543
|
+
field: "lineItems.productId",
|
|
1544
|
+
value: ProductData.id
|
|
1545
|
+
}
|
|
1546
|
+
]
|
|
1547
|
+
}
|
|
1548
|
+
});
|
|
1549
|
+
expect(orderSearchResponse.ok()).toBeTruthy();
|
|
1550
|
+
const { data: ordersWithDigitalProduct } = await orderSearchResponse.json();
|
|
1551
|
+
for (const order of ordersWithDigitalProduct) {
|
|
1552
|
+
const deleteOrderResponse = await AdminApiContext.delete(`./order/${order.id}`);
|
|
1553
|
+
expect(deleteOrderResponse.ok()).toBeTruthy();
|
|
1554
|
+
}
|
|
1555
|
+
const unlinkMediaResponse = await AdminApiContext.delete(`./product-download/${productDownload.id}`);
|
|
1556
|
+
expect(unlinkMediaResponse.ok()).toBeTruthy();
|
|
1557
|
+
const cleanupMediaResponse = await AdminApiContext.delete(`./media/${newMediaId}`);
|
|
1558
|
+
expect(cleanupMediaResponse.ok()).toBeTruthy();
|
|
1559
|
+
}
|
|
1560
|
+
});
|
|
1561
|
+
|
|
1562
|
+
const PropertiesData = test$c.extend({
|
|
1563
|
+
PropertiesData: async ({ AdminApiContext }, use) => {
|
|
1564
|
+
const propertyGroupColorResponse = await AdminApiContext.post("property-group?_response=1", {
|
|
1565
|
+
data: {
|
|
1566
|
+
name: "Color",
|
|
1567
|
+
description: "Color",
|
|
1568
|
+
displayType: "color",
|
|
1569
|
+
sortingType: "name",
|
|
1570
|
+
options: [{
|
|
1571
|
+
name: "Blue",
|
|
1572
|
+
colorHexCode: "#2148d6"
|
|
1573
|
+
}, {
|
|
1574
|
+
name: "Red",
|
|
1575
|
+
colorHexCode: "#bf0f2a"
|
|
1576
|
+
}, {
|
|
1577
|
+
name: "Green",
|
|
1578
|
+
colorHexCode: "#12bf0f"
|
|
1579
|
+
}]
|
|
1580
|
+
}
|
|
1581
|
+
});
|
|
1582
|
+
const propertyGroupSizeResponse = await AdminApiContext.post("property-group?_response=1", {
|
|
1583
|
+
data: {
|
|
1584
|
+
name: "Size",
|
|
1585
|
+
description: "Size",
|
|
1586
|
+
displayType: "text",
|
|
1587
|
+
sortingType: "name",
|
|
1588
|
+
options: [{
|
|
1589
|
+
name: "Small"
|
|
1590
|
+
}, {
|
|
1591
|
+
name: "Medium"
|
|
1592
|
+
}, {
|
|
1593
|
+
name: "Large"
|
|
1594
|
+
}]
|
|
1595
|
+
}
|
|
1596
|
+
});
|
|
1597
|
+
expect(propertyGroupColorResponse.ok()).toBeTruthy();
|
|
1598
|
+
expect(propertyGroupSizeResponse.ok()).toBeTruthy();
|
|
1599
|
+
const { data: propertyGroupColor } = await propertyGroupColorResponse.json();
|
|
1600
|
+
const { data: propertyGroupSize } = await propertyGroupSizeResponse.json();
|
|
1601
|
+
await use({
|
|
1602
|
+
propertyGroupColor,
|
|
1603
|
+
propertyGroupSize
|
|
1604
|
+
});
|
|
1605
|
+
const deleteGroupColor = await AdminApiContext.delete(`property-group/${propertyGroupColor.id}`);
|
|
1606
|
+
const deleteGroupSize = await AdminApiContext.delete(`property-group/${propertyGroupSize.id}`);
|
|
1607
|
+
expect(deleteGroupColor.ok()).toBeTruthy();
|
|
1608
|
+
expect(deleteGroupSize.ok()).toBeTruthy();
|
|
1609
|
+
}
|
|
1610
|
+
});
|
|
1611
|
+
|
|
1612
|
+
const CartWithProductData = test$c.extend({
|
|
1613
|
+
CartWithProductData: async ({ StoreApiContext, DefaultSalesChannel, ProductData }, use) => {
|
|
1614
|
+
await StoreApiContext.login(DefaultSalesChannel.customer);
|
|
1615
|
+
const cartResponse = await StoreApiContext.post("checkout/cart", {
|
|
1616
|
+
data: {
|
|
1617
|
+
name: "default-customer-cart"
|
|
1618
|
+
}
|
|
1619
|
+
});
|
|
1620
|
+
expect(cartResponse.ok()).toBeTruthy();
|
|
1621
|
+
const lineItemResponse = await StoreApiContext.post("checkout/cart/line-item", {
|
|
1622
|
+
data: {
|
|
1623
|
+
items: [
|
|
1624
|
+
{
|
|
1625
|
+
type: "product",
|
|
1626
|
+
referencedId: ProductData.id,
|
|
1627
|
+
quantity: 10
|
|
1628
|
+
}
|
|
1629
|
+
]
|
|
1630
|
+
}
|
|
1631
|
+
});
|
|
1632
|
+
expect(lineItemResponse.ok()).toBeTruthy();
|
|
1633
|
+
const cartData = await lineItemResponse.json();
|
|
1634
|
+
await use(cartData);
|
|
1635
|
+
}
|
|
1636
|
+
});
|
|
1637
|
+
|
|
1638
|
+
const PromotionWithCodeData = test$c.extend({
|
|
1639
|
+
PromotionWithCodeData: async ({ AdminApiContext, DefaultSalesChannel, IdProvider }, use) => {
|
|
1640
|
+
const promotionCode = `${IdProvider.getIdPair().id}`;
|
|
1641
|
+
const promotionName = `Test Promotion ${promotionCode}`;
|
|
1642
|
+
const promotionResponse = await AdminApiContext.post("promotion?_response=1", {
|
|
1643
|
+
data: {
|
|
1644
|
+
name: promotionName,
|
|
1645
|
+
active: true,
|
|
1646
|
+
maxRedemptionsGlobal: 100,
|
|
1647
|
+
maxRedemptionsPerCustomer: 10,
|
|
1648
|
+
priority: 1,
|
|
1649
|
+
exclusive: false,
|
|
1650
|
+
useCodes: true,
|
|
1651
|
+
useIndividualCodes: false,
|
|
1652
|
+
useSetGroups: false,
|
|
1653
|
+
preventCombination: true,
|
|
1654
|
+
customerRestriction: false,
|
|
1655
|
+
code: promotionCode,
|
|
1656
|
+
discounts: [
|
|
1657
|
+
{
|
|
1658
|
+
scope: "cart",
|
|
1659
|
+
type: "percentage",
|
|
1660
|
+
value: 10,
|
|
1661
|
+
considerAdvancedRules: false
|
|
1662
|
+
}
|
|
1663
|
+
],
|
|
1664
|
+
salesChannels: [
|
|
1665
|
+
{
|
|
1666
|
+
salesChannelId: DefaultSalesChannel.salesChannel.id,
|
|
1667
|
+
priority: 1
|
|
1668
|
+
}
|
|
1669
|
+
]
|
|
1670
|
+
}
|
|
1671
|
+
});
|
|
1672
|
+
expect(promotionResponse.ok()).toBeTruthy();
|
|
1673
|
+
const { data: promotion } = await promotionResponse.json();
|
|
1674
|
+
await use(promotion);
|
|
1675
|
+
const cleanupResponse = await AdminApiContext.delete(`promotion/${promotion.id}`);
|
|
1676
|
+
expect(cleanupResponse.ok()).toBeTruthy();
|
|
1677
|
+
}
|
|
1678
|
+
});
|
|
1679
|
+
|
|
1680
|
+
function createRandomImage(width = 800, height = 600) {
|
|
1681
|
+
const buffer = Buffer.alloc(width * height * 4);
|
|
1682
|
+
let i = 0;
|
|
1683
|
+
while (i < buffer.length) {
|
|
1684
|
+
buffer[i++] = Math.floor(Math.random() * 256);
|
|
1685
|
+
}
|
|
1686
|
+
return new Image(width, height, buffer);
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
const MediaData = test$c.extend({
|
|
1690
|
+
MediaData: async ({ AdminApiContext, IdProvider }, use) => {
|
|
1691
|
+
const imageId = IdProvider.getIdPair().id;
|
|
1692
|
+
const imageFilePath = `./tmp/image-${imageId}.png`;
|
|
1693
|
+
const image = createRandomImage();
|
|
1694
|
+
if (!fs.existsSync("./tmp/")) {
|
|
1695
|
+
try {
|
|
1696
|
+
fs.mkdirSync("./tmp/");
|
|
1697
|
+
} catch (err) {
|
|
1698
|
+
console.error(err);
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
fs.writeFileSync(imageFilePath, image.toBuffer());
|
|
1702
|
+
const mediaResponse = await AdminApiContext.post("media?_response", {
|
|
1703
|
+
data: {
|
|
1704
|
+
private: false
|
|
1705
|
+
}
|
|
1706
|
+
});
|
|
1707
|
+
expect(mediaResponse.ok()).toBeTruthy();
|
|
1708
|
+
const { data: media } = await mediaResponse.json();
|
|
1709
|
+
const mediaCreationResponse = await AdminApiContext.post(`_action/media/${media.id}/upload?extension=png&fileName=${media.id}`, {
|
|
1710
|
+
data: fs.readFileSync(imageFilePath),
|
|
1711
|
+
headers: {
|
|
1712
|
+
"content-type": "image/png"
|
|
1713
|
+
}
|
|
1714
|
+
});
|
|
1715
|
+
expect(mediaCreationResponse.ok()).toBeTruthy();
|
|
1716
|
+
const altTag = media.alt = `alt-${media.id}`;
|
|
1717
|
+
const titleTag = media.title = `title-${media.id}`;
|
|
1718
|
+
const editMediaResponse = await AdminApiContext.patch(`media/${media.id}`, {
|
|
1719
|
+
data: {
|
|
1720
|
+
alt: altTag,
|
|
1721
|
+
title: titleTag
|
|
1722
|
+
}
|
|
1723
|
+
});
|
|
1724
|
+
expect(editMediaResponse.ok()).toBeTruthy();
|
|
1725
|
+
await use(media);
|
|
1726
|
+
fs.unlink(imageFilePath, (err) => {
|
|
1727
|
+
if (err) {
|
|
1728
|
+
throw err;
|
|
1729
|
+
}
|
|
1730
|
+
});
|
|
1731
|
+
const cleanupResponse = await AdminApiContext.delete(`media/${media.id}`);
|
|
1732
|
+
expect(cleanupResponse.ok()).toBeTruthy();
|
|
1733
|
+
}
|
|
1734
|
+
});
|
|
1735
|
+
|
|
1736
|
+
const OrderData = test$c.extend({
|
|
1737
|
+
OrderData: async ({ IdProvider, AdminApiContext, SalesChannelBaseConfig, DefaultSalesChannel, ProductData }, use) => {
|
|
1738
|
+
const requests = {
|
|
1739
|
+
currencyEUR: getCurrency("EUR", AdminApiContext),
|
|
1740
|
+
mrSalutationId: getSalutationId("mr", AdminApiContext),
|
|
1741
|
+
orderStateId: getStateMachineId("order.state", AdminApiContext),
|
|
1742
|
+
orderTransactionStateId: getStateMachineId("order_transaction.state", AdminApiContext),
|
|
1743
|
+
orderDeliveryStateId: getStateMachineId("order_delivery.state", AdminApiContext)
|
|
1744
|
+
};
|
|
1745
|
+
await Promise.all(Object.values(requests));
|
|
1746
|
+
const { id: orderId } = IdProvider.getIdPair();
|
|
1747
|
+
const addressId = IdProvider.getIdPair().uuid;
|
|
1748
|
+
const mrSalutationId = await requests.mrSalutationId;
|
|
1749
|
+
const orderStateId = await requests.orderStateId;
|
|
1750
|
+
const currencyEUR = await requests.currencyEUR;
|
|
1751
|
+
const orderTransactionStateId = await requests.orderTransactionStateId;
|
|
1752
|
+
const orderDeliveryStateId = await requests.orderDeliveryStateId;
|
|
1753
|
+
const orderStateStateMachineStateId = await getStateMachineStateId(orderStateId, AdminApiContext);
|
|
1754
|
+
const orderTransactionStateIdMachineStateId = await getStateMachineStateId(orderTransactionStateId, AdminApiContext);
|
|
1755
|
+
const orderDeliveryStateIdMachineStateId = await getStateMachineStateId(orderDeliveryStateId, AdminApiContext);
|
|
1756
|
+
const orderResponse = await AdminApiContext.post("./order?_response=detail", {
|
|
1757
|
+
data: {
|
|
1758
|
+
billingAddressId: addressId,
|
|
1759
|
+
currencyId: SalesChannelBaseConfig.eurCurrencyId,
|
|
1760
|
+
languageId: SalesChannelBaseConfig.enGBLanguageId,
|
|
1761
|
+
salesChannelId: DefaultSalesChannel.salesChannel.id,
|
|
1762
|
+
stateId: orderStateStateMachineStateId,
|
|
1763
|
+
orderDateTime: "2024-02-01 07:00:00",
|
|
1764
|
+
orderNumber: orderId,
|
|
1765
|
+
currencyFactor: currencyEUR.factor,
|
|
1766
|
+
itemRounding: {
|
|
1767
|
+
decimals: 2,
|
|
1768
|
+
interval: 0.01,
|
|
1769
|
+
roundForNet: true
|
|
1770
|
+
},
|
|
1771
|
+
totalRounding: {
|
|
1772
|
+
decimals: 2,
|
|
1773
|
+
interval: 0.01,
|
|
1774
|
+
roundForNet: true
|
|
1775
|
+
},
|
|
1776
|
+
orderCustomer: {
|
|
1777
|
+
customerId: `${DefaultSalesChannel.customer.id}`,
|
|
1778
|
+
email: `${DefaultSalesChannel.customer.email}`,
|
|
1779
|
+
firstName: `${DefaultSalesChannel.customer.firstName}`,
|
|
1780
|
+
lastName: `${DefaultSalesChannel.customer.lastName}`,
|
|
1781
|
+
salutationId: `${DefaultSalesChannel.customer.salutationId}`
|
|
1782
|
+
},
|
|
1783
|
+
addresses: [
|
|
1784
|
+
{
|
|
1785
|
+
id: addressId,
|
|
1786
|
+
salutationId: `${DefaultSalesChannel.customer.salutationId}`,
|
|
1787
|
+
firstName: `${DefaultSalesChannel.customer.firstName}`,
|
|
1788
|
+
lastName: `${DefaultSalesChannel.customer.lastName}`,
|
|
1789
|
+
street: `${orderId} street`,
|
|
1790
|
+
zipcode: `${orderId} zipcode`,
|
|
1791
|
+
city: `${orderId} city`,
|
|
1792
|
+
countryId: SalesChannelBaseConfig.deCountryId,
|
|
1793
|
+
company: `${orderId} company`,
|
|
1794
|
+
vatId: null,
|
|
1795
|
+
phoneNumber: `${orderId}`
|
|
1796
|
+
}
|
|
1797
|
+
],
|
|
1798
|
+
price: {
|
|
1799
|
+
totalPrice: 13.98,
|
|
1800
|
+
positionPrice: 13.98,
|
|
1801
|
+
rawTotal: 13.98,
|
|
1802
|
+
netPrice: 13.98,
|
|
1803
|
+
taxStatus: "gross",
|
|
1804
|
+
calculatedTaxes: [
|
|
1805
|
+
{
|
|
1806
|
+
tax: 0,
|
|
1807
|
+
taxRate: 0,
|
|
1808
|
+
price: 13.98
|
|
1809
|
+
}
|
|
1810
|
+
],
|
|
1811
|
+
taxRules: [
|
|
1812
|
+
{
|
|
1813
|
+
taxRate: 0,
|
|
1814
|
+
percentage: 100
|
|
1815
|
+
}
|
|
1816
|
+
]
|
|
1817
|
+
},
|
|
1818
|
+
shippingCosts: {
|
|
1819
|
+
unitPrice: 2.99,
|
|
1820
|
+
totalPrice: 2.99,
|
|
1821
|
+
quantity: 1,
|
|
1822
|
+
calculatedTaxes: [
|
|
1823
|
+
{
|
|
1824
|
+
tax: 0,
|
|
1825
|
+
taxRate: 0,
|
|
1826
|
+
price: 2.99
|
|
1827
|
+
}
|
|
1828
|
+
],
|
|
1829
|
+
taxRules: [
|
|
1830
|
+
{
|
|
1831
|
+
taxRate: 0,
|
|
1832
|
+
percentage: 100
|
|
1833
|
+
}
|
|
1834
|
+
]
|
|
1835
|
+
},
|
|
1836
|
+
lineItems: [
|
|
1837
|
+
{
|
|
1838
|
+
productId: ProductData.id,
|
|
1839
|
+
referencedId: ProductData.id,
|
|
1840
|
+
payload: {
|
|
1841
|
+
productNumber: ProductData.productNumber
|
|
1842
|
+
},
|
|
1843
|
+
identifier: ProductData.id,
|
|
1844
|
+
type: "product",
|
|
1845
|
+
label: "Shopware Blue T-shirt",
|
|
1846
|
+
quantity: 1,
|
|
1847
|
+
position: 1,
|
|
1848
|
+
price: {
|
|
1849
|
+
unitPrice: 10.99,
|
|
1850
|
+
totalPrice: 10.99,
|
|
1851
|
+
quantity: 1,
|
|
1852
|
+
calculatedTaxes: [
|
|
1853
|
+
{
|
|
1854
|
+
tax: 0,
|
|
1855
|
+
taxRate: 0,
|
|
1856
|
+
price: 10.99
|
|
1857
|
+
}
|
|
1858
|
+
],
|
|
1859
|
+
taxRules: [
|
|
1860
|
+
{
|
|
1861
|
+
taxRate: 0,
|
|
1862
|
+
percentage: 100
|
|
1863
|
+
}
|
|
1864
|
+
]
|
|
1865
|
+
},
|
|
1866
|
+
priceDefinition: {
|
|
1867
|
+
type: "quantity",
|
|
1868
|
+
price: 10.99,
|
|
1869
|
+
quantity: 1,
|
|
1870
|
+
taxRules: [
|
|
1871
|
+
{
|
|
1872
|
+
taxRate: 0,
|
|
1873
|
+
percentage: 100
|
|
1874
|
+
}
|
|
1875
|
+
],
|
|
1876
|
+
listPrice: 8,
|
|
1877
|
+
isCalculated: true,
|
|
1878
|
+
referencePriceDefinition: null
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
],
|
|
1882
|
+
deliveries: [
|
|
1883
|
+
{
|
|
1884
|
+
stateId: orderDeliveryStateIdMachineStateId,
|
|
1885
|
+
shippingMethodId: SalesChannelBaseConfig.defaultShippingMethod,
|
|
1886
|
+
shippingOrderAddress: {
|
|
1887
|
+
id: IdProvider.getIdPair().uuid,
|
|
1888
|
+
salutationId: mrSalutationId,
|
|
1889
|
+
firstName: "John",
|
|
1890
|
+
lastName: "Doe",
|
|
1891
|
+
street: "Shortstreet 5",
|
|
1892
|
+
zipcode: "12345",
|
|
1893
|
+
city: "Doe City",
|
|
1894
|
+
countryId: SalesChannelBaseConfig.deCountryId,
|
|
1895
|
+
phoneNumber: "123 456 789"
|
|
1896
|
+
},
|
|
1897
|
+
shippingDateEarliest: "2024-03-01 07:00:00",
|
|
1898
|
+
shippingDateLatest: "2024-03-03 07:00:00",
|
|
1899
|
+
shippingCosts: {
|
|
1900
|
+
unitPrice: 8.99,
|
|
1901
|
+
totalPrice: 8.99,
|
|
1902
|
+
quantity: 1,
|
|
1903
|
+
calculatedTaxes: [
|
|
1904
|
+
{
|
|
1905
|
+
tax: 0,
|
|
1906
|
+
taxRate: 0,
|
|
1907
|
+
price: 8.99
|
|
1908
|
+
}
|
|
1909
|
+
],
|
|
1910
|
+
taxRules: [
|
|
1911
|
+
{
|
|
1912
|
+
taxRate: 0,
|
|
1913
|
+
percentage: 100
|
|
1914
|
+
}
|
|
1915
|
+
]
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
],
|
|
1919
|
+
transactions: [
|
|
1920
|
+
{
|
|
1921
|
+
paymentMethodId: SalesChannelBaseConfig.invoicePaymentMethodId,
|
|
1922
|
+
amount: {
|
|
1923
|
+
unitPrice: 13.98,
|
|
1924
|
+
totalPrice: 13.98,
|
|
1925
|
+
quantity: 1,
|
|
1926
|
+
calculatedTaxes: [
|
|
1927
|
+
{
|
|
1928
|
+
tax: 0,
|
|
1929
|
+
taxRate: 0,
|
|
1930
|
+
price: 0
|
|
1931
|
+
}
|
|
1932
|
+
],
|
|
1933
|
+
taxRules: [
|
|
1934
|
+
{
|
|
1935
|
+
taxRate: 0,
|
|
1936
|
+
percentage: 100
|
|
1937
|
+
}
|
|
1938
|
+
]
|
|
1939
|
+
},
|
|
1940
|
+
stateId: orderTransactionStateIdMachineStateId
|
|
1941
|
+
}
|
|
1942
|
+
]
|
|
1943
|
+
}
|
|
1944
|
+
});
|
|
1945
|
+
expect(orderResponse.ok()).toBeTruthy();
|
|
1946
|
+
const { data: order } = await orderResponse.json();
|
|
1947
|
+
await use(order);
|
|
1948
|
+
const cleanupResponse = await AdminApiContext.delete(`./order/${order.id}`);
|
|
1949
|
+
expect(cleanupResponse.ok()).toBeTruthy();
|
|
1950
|
+
}
|
|
1951
|
+
});
|
|
1952
|
+
|
|
1953
|
+
const TagData = test$c.extend({
|
|
1954
|
+
TagData: async ({ IdProvider, AdminApiContext }, use) => {
|
|
1955
|
+
const tagUUID = IdProvider.getIdPair().uuid;
|
|
1956
|
+
const tagId = IdProvider.getIdPair().id;
|
|
1957
|
+
const tagName = `Test-${tagId}`;
|
|
1958
|
+
const tagResponse = await AdminApiContext.post("./tag?_response=detail", {
|
|
1959
|
+
data: {
|
|
1960
|
+
id: tagUUID,
|
|
1961
|
+
name: tagName
|
|
1962
|
+
}
|
|
1963
|
+
});
|
|
1964
|
+
expect(tagResponse.ok()).toBeTruthy();
|
|
1965
|
+
const { data: tag } = await tagResponse.json();
|
|
1966
|
+
await use(tag);
|
|
1967
|
+
const cleanupResponse = await AdminApiContext.delete(`./tag/${tag.id}`);
|
|
1968
|
+
expect(cleanupResponse.ok()).toBeTruthy();
|
|
1969
|
+
}
|
|
1970
|
+
});
|
|
1971
|
+
|
|
1972
|
+
const test$3 = mergeTests(
|
|
1973
|
+
ProductData,
|
|
1974
|
+
DigitalProductData,
|
|
1975
|
+
CartWithProductData,
|
|
1976
|
+
PromotionWithCodeData,
|
|
1977
|
+
PropertiesData,
|
|
1978
|
+
MediaData,
|
|
1979
|
+
OrderData,
|
|
1980
|
+
TagData
|
|
1981
|
+
);
|
|
1982
|
+
|
|
1983
|
+
const SaveProduct = test$c.extend({
|
|
1984
|
+
SaveProduct: async ({ ShopAdmin, AdminProductDetail }, use) => {
|
|
1985
|
+
const task = () => {
|
|
1986
|
+
return async function SaveProduct2() {
|
|
1987
|
+
await AdminProductDetail.savePhysicalProductButton.click();
|
|
1988
|
+
const response = await AdminProductDetail.page.waitForResponse(`${process.env["APP_URL"]}api/_action/sync`);
|
|
1989
|
+
expect(response.ok()).toBeTruthy();
|
|
1990
|
+
await ShopAdmin.expects(AdminProductDetail.savePhysicalProductButton).toBeVisible();
|
|
1991
|
+
await ShopAdmin.expects(AdminProductDetail.savePhysicalProductButton).toContainText("Save");
|
|
1992
|
+
await ShopAdmin.expects(AdminProductDetail.saveButtonCheckMark).toBeHidden();
|
|
1993
|
+
await ShopAdmin.expects(AdminProductDetail.saveButtonLoadingSpinner).toBeHidden();
|
|
1994
|
+
await ShopAdmin.expects(AdminProductDetail.page.getByText("The following error occurred:")).toBeHidden();
|
|
1995
|
+
};
|
|
1996
|
+
};
|
|
1997
|
+
await use(task);
|
|
1998
|
+
}
|
|
1999
|
+
});
|
|
2000
|
+
|
|
2001
|
+
const test$2 = mergeTests(
|
|
2002
|
+
SaveProduct
|
|
2003
|
+
);
|
|
2004
|
+
|
|
2005
|
+
const Login = test$c.extend({
|
|
2006
|
+
Login: async ({ ShopCustomer, DefaultSalesChannel, StorefrontAccountLogin, StorefrontAccount }, use) => {
|
|
2007
|
+
const task = () => {
|
|
2008
|
+
return async function Login2() {
|
|
2009
|
+
const { customer } = DefaultSalesChannel;
|
|
2010
|
+
await ShopCustomer.goesTo(StorefrontAccountLogin);
|
|
2011
|
+
await StorefrontAccountLogin.emailInput.fill(customer.email);
|
|
2012
|
+
await StorefrontAccountLogin.passwordInput.fill(customer.password);
|
|
2013
|
+
await StorefrontAccountLogin.loginButton.click();
|
|
2014
|
+
await ShopCustomer.expects(StorefrontAccount.personalDataCardTitle).toBeVisible();
|
|
2015
|
+
};
|
|
2016
|
+
};
|
|
2017
|
+
await use(task);
|
|
2018
|
+
}
|
|
2019
|
+
});
|
|
2020
|
+
|
|
2021
|
+
const Logout = test$c.extend({
|
|
2022
|
+
Logout: async ({ ShopCustomer, StorefrontAccountLogin }, use) => {
|
|
2023
|
+
const task = () => {
|
|
2024
|
+
return async function Logout2() {
|
|
2025
|
+
await ShopCustomer.goesTo(StorefrontAccountLogin);
|
|
2026
|
+
await ShopCustomer.expects(StorefrontAccountLogin.loginButton).not.toBeVisible();
|
|
2027
|
+
await StorefrontAccountLogin.logoutLink.click();
|
|
2028
|
+
await ShopCustomer.expects(StorefrontAccountLogin.successAlert).toBeVisible();
|
|
2029
|
+
};
|
|
2030
|
+
};
|
|
2031
|
+
await use(task);
|
|
2032
|
+
}
|
|
2033
|
+
});
|
|
2034
|
+
|
|
2035
|
+
const Register = test$c.extend({
|
|
2036
|
+
Register: async ({ StorefrontAccountLogin, AdminApiContext }, use) => {
|
|
2037
|
+
const registrationData = {
|
|
2038
|
+
firstName: "Jeff",
|
|
2039
|
+
lastName: "Goldblum",
|
|
2040
|
+
email: "invalid",
|
|
2041
|
+
password: "shopware",
|
|
2042
|
+
street: "Ebbinghof 10",
|
|
2043
|
+
city: "Sch\xF6ppingen",
|
|
2044
|
+
country: "Germany"
|
|
2045
|
+
};
|
|
2046
|
+
const task = (email) => {
|
|
2047
|
+
return async function Register2() {
|
|
2048
|
+
registrationData.email = email;
|
|
2049
|
+
await StorefrontAccountLogin.firstNameInput.fill(registrationData.firstName);
|
|
2050
|
+
await StorefrontAccountLogin.lastNameInput.fill(registrationData.lastName);
|
|
2051
|
+
await StorefrontAccountLogin.registerEmailInput.fill(registrationData.email);
|
|
2052
|
+
await StorefrontAccountLogin.registerPasswordInput.fill(registrationData.password);
|
|
2053
|
+
await StorefrontAccountLogin.streetAddressInput.fill(registrationData.street);
|
|
2054
|
+
await StorefrontAccountLogin.cityInput.fill(registrationData.city);
|
|
2055
|
+
await StorefrontAccountLogin.countryInput.selectOption(registrationData.country);
|
|
2056
|
+
await StorefrontAccountLogin.registerButton.click();
|
|
2057
|
+
};
|
|
2058
|
+
};
|
|
2059
|
+
await use(task);
|
|
2060
|
+
const customerResponse = await AdminApiContext.post("search/customer", {
|
|
2061
|
+
data: {
|
|
2062
|
+
limit: 1,
|
|
2063
|
+
filter: [{
|
|
2064
|
+
type: "equals",
|
|
2065
|
+
field: "email",
|
|
2066
|
+
value: registrationData.email
|
|
2067
|
+
}]
|
|
2068
|
+
}
|
|
2069
|
+
});
|
|
2070
|
+
expect(customerResponse.ok()).toBeTruthy();
|
|
2071
|
+
const customerResponseData = await customerResponse.json();
|
|
2072
|
+
for (const customer of customerResponseData.data) {
|
|
2073
|
+
await AdminApiContext.delete(`customer/${customer.id}`);
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
});
|
|
2077
|
+
|
|
2078
|
+
const AddProductToCart = test$c.extend({
|
|
2079
|
+
AddProductToCart: async ({ ShopCustomer, StorefrontProductDetail }, use) => {
|
|
2080
|
+
const task = (ProductData, quantity = "1") => {
|
|
2081
|
+
return async function AddProductToCart2() {
|
|
2082
|
+
await StorefrontProductDetail.quantitySelect.fill(quantity);
|
|
2083
|
+
await StorefrontProductDetail.addToCartButton.click();
|
|
2084
|
+
await ShopCustomer.expects(StorefrontProductDetail.offCanvasCartTitle).toBeVisible();
|
|
2085
|
+
await ShopCustomer.expects(StorefrontProductDetail.offCanvasCart.getByText(ProductData.name)).toBeVisible();
|
|
2086
|
+
};
|
|
2087
|
+
};
|
|
2088
|
+
await use(task);
|
|
2089
|
+
}
|
|
2090
|
+
});
|
|
2091
|
+
|
|
2092
|
+
const ProceedFromProductToCheckout = test$c.extend({
|
|
2093
|
+
ProceedFromProductToCheckout: async ({ ShopCustomer, StorefrontProductDetail, StorefrontCheckoutConfirm }, use) => {
|
|
2094
|
+
const task = () => {
|
|
2095
|
+
return async function ProceedFromProductToCheckout2() {
|
|
2096
|
+
await StorefrontProductDetail.offCanvasCartGoToCheckoutButton.click();
|
|
2097
|
+
await ShopCustomer.expects(StorefrontCheckoutConfirm.headline).toBeVisible();
|
|
2098
|
+
};
|
|
2099
|
+
};
|
|
2100
|
+
await use(task);
|
|
2101
|
+
}
|
|
2102
|
+
});
|
|
2103
|
+
|
|
2104
|
+
const ProceedFromCartToCheckout = test$c.extend({
|
|
2105
|
+
ProceedFromCartToCheckout: async ({
|
|
2106
|
+
ShopCustomer,
|
|
2107
|
+
StorefrontCheckoutCart,
|
|
2108
|
+
StorefrontCheckoutConfirm
|
|
2109
|
+
}, use) => {
|
|
2110
|
+
const task = () => {
|
|
2111
|
+
return async function ProceedFromCartToCheckout2() {
|
|
2112
|
+
await StorefrontCheckoutCart.goToCheckoutButton.click();
|
|
2113
|
+
await ShopCustomer.expects(StorefrontCheckoutConfirm.headline).toBeVisible();
|
|
2114
|
+
};
|
|
2115
|
+
};
|
|
2116
|
+
await use(task);
|
|
2117
|
+
}
|
|
2118
|
+
});
|
|
2119
|
+
|
|
2120
|
+
const ConfirmTermsAndConditions = test$c.extend({
|
|
2121
|
+
ConfirmTermsAndConditions: async ({ ShopCustomer, StorefrontCheckoutConfirm }, use) => {
|
|
2122
|
+
const task = () => {
|
|
2123
|
+
return async function ConfirmTermsAndConditions2() {
|
|
2124
|
+
await StorefrontCheckoutConfirm.termsAndConditionsCheckbox.check();
|
|
2125
|
+
await ShopCustomer.expects(StorefrontCheckoutConfirm.termsAndConditionsCheckbox).toBeChecked();
|
|
2126
|
+
};
|
|
2127
|
+
};
|
|
2128
|
+
await use(task);
|
|
2129
|
+
}
|
|
2130
|
+
});
|
|
2131
|
+
|
|
2132
|
+
const SelectCashOnDeliveryPaymentOption = test$c.extend({
|
|
2133
|
+
SelectCashOnDeliveryPaymentOption: async ({ ShopCustomer, StorefrontCheckoutConfirm }, use) => {
|
|
2134
|
+
const task = () => {
|
|
2135
|
+
return async function SelectCashOnDeliveryPaymentOption2() {
|
|
2136
|
+
await StorefrontCheckoutConfirm.paymentCashOnDelivery.check();
|
|
2137
|
+
await ShopCustomer.expects(StorefrontCheckoutConfirm.paymentCashOnDelivery).toBeChecked();
|
|
2138
|
+
};
|
|
2139
|
+
};
|
|
2140
|
+
await use(task);
|
|
2141
|
+
}
|
|
2142
|
+
});
|
|
2143
|
+
|
|
2144
|
+
const SelectInvoicePaymentOption = test$c.extend({
|
|
2145
|
+
SelectInvoicePaymentOption: async ({ ShopCustomer, StorefrontCheckoutConfirm }, use) => {
|
|
2146
|
+
const task = () => {
|
|
2147
|
+
return async function SelectInvoicePaymentOption2() {
|
|
2148
|
+
await StorefrontCheckoutConfirm.paymentInvoice.check();
|
|
2149
|
+
await ShopCustomer.expects(StorefrontCheckoutConfirm.paymentInvoice).toBeChecked();
|
|
2150
|
+
};
|
|
2151
|
+
};
|
|
2152
|
+
await use(task);
|
|
2153
|
+
}
|
|
2154
|
+
});
|
|
2155
|
+
|
|
2156
|
+
const SelectPaidInAdvancePaymentOption = test$c.extend({
|
|
2157
|
+
SelectPaidInAdvancePaymentOption: async ({ ShopCustomer, StorefrontCheckoutConfirm }, use) => {
|
|
2158
|
+
const task = () => {
|
|
2159
|
+
return async function SelectPaidInAdvancePaymentOption2() {
|
|
2160
|
+
await StorefrontCheckoutConfirm.paymentPaidInAdvance.check();
|
|
2161
|
+
await ShopCustomer.expects(StorefrontCheckoutConfirm.paymentPaidInAdvance).toBeChecked();
|
|
2162
|
+
};
|
|
2163
|
+
};
|
|
2164
|
+
await use(task);
|
|
2165
|
+
}
|
|
2166
|
+
});
|
|
2167
|
+
|
|
2168
|
+
const SelectStandardShippingOption = test$c.extend({
|
|
2169
|
+
SelectStandardShippingOption: async ({ ShopCustomer, StorefrontCheckoutConfirm }, use) => {
|
|
2170
|
+
const task = () => {
|
|
2171
|
+
return async function SelectStandardShippingOption2() {
|
|
2172
|
+
await StorefrontCheckoutConfirm.shippingStandard.check();
|
|
2173
|
+
await ShopCustomer.expects(StorefrontCheckoutConfirm.shippingStandard).toBeChecked();
|
|
2174
|
+
};
|
|
2175
|
+
};
|
|
2176
|
+
await use(task);
|
|
2177
|
+
}
|
|
2178
|
+
});
|
|
2179
|
+
|
|
2180
|
+
const SelectExpressShippingOption = test$c.extend({
|
|
2181
|
+
SelectExpressShippingOption: async ({ ShopCustomer, StorefrontCheckoutConfirm }, use) => {
|
|
2182
|
+
const task = () => {
|
|
2183
|
+
return async function SelectExpressShippingOption2() {
|
|
2184
|
+
await StorefrontCheckoutConfirm.shippingExpress.check();
|
|
2185
|
+
await ShopCustomer.expects(StorefrontCheckoutConfirm.shippingExpress).toBeChecked();
|
|
2186
|
+
};
|
|
2187
|
+
};
|
|
2188
|
+
await use(task);
|
|
2189
|
+
}
|
|
2190
|
+
});
|
|
2191
|
+
|
|
2192
|
+
const SubmitOrder = test$c.extend({
|
|
2193
|
+
SubmitOrder: async ({ ShopCustomer, StorefrontCheckoutConfirm, StorefrontCheckoutFinish }, use) => {
|
|
2194
|
+
const task = () => {
|
|
2195
|
+
return async function SubmitOrder2() {
|
|
2196
|
+
await StorefrontCheckoutConfirm.submitOrderButton.click();
|
|
2197
|
+
await ShopCustomer.expects(StorefrontCheckoutFinish.headline).toBeVisible();
|
|
2198
|
+
};
|
|
2199
|
+
};
|
|
2200
|
+
await use(task);
|
|
2201
|
+
}
|
|
2202
|
+
});
|
|
2203
|
+
|
|
2204
|
+
const OpenSearchResultPage = test$c.extend({
|
|
2205
|
+
OpenSearchResultPage: async ({ StorefrontSearch }, use) => {
|
|
2206
|
+
const task = (searchTerm) => {
|
|
2207
|
+
return async function OpenSearchResultPage2() {
|
|
2208
|
+
const url = `search?search=${searchTerm}`;
|
|
2209
|
+
await StorefrontSearch.page.goto(url);
|
|
2210
|
+
};
|
|
2211
|
+
};
|
|
2212
|
+
await use(task);
|
|
2213
|
+
}
|
|
2214
|
+
});
|
|
2215
|
+
|
|
2216
|
+
const OpenSearchSuggestPage = test$c.extend({
|
|
2217
|
+
OpenSearchSuggestPage: async ({ StorefrontSearchSuggest }, use) => {
|
|
2218
|
+
const task = (searchTerm) => {
|
|
2219
|
+
return async function OpenSearchSuggestPage2() {
|
|
2220
|
+
const url = `suggest?search=${searchTerm}`;
|
|
2221
|
+
await StorefrontSearchSuggest.page.goto(url);
|
|
2222
|
+
};
|
|
2223
|
+
};
|
|
2224
|
+
await use(task);
|
|
2225
|
+
}
|
|
2226
|
+
});
|
|
2227
|
+
|
|
2228
|
+
const test$1 = mergeTests(
|
|
2229
|
+
Login,
|
|
2230
|
+
Logout,
|
|
2231
|
+
Register,
|
|
2232
|
+
AddProductToCart,
|
|
2233
|
+
ProceedFromProductToCheckout,
|
|
2234
|
+
ProceedFromCartToCheckout,
|
|
2235
|
+
ConfirmTermsAndConditions,
|
|
2236
|
+
SelectInvoicePaymentOption,
|
|
2237
|
+
SelectCashOnDeliveryPaymentOption,
|
|
2238
|
+
SelectPaidInAdvancePaymentOption,
|
|
2239
|
+
SelectStandardShippingOption,
|
|
2240
|
+
SelectExpressShippingOption,
|
|
2241
|
+
SubmitOrder,
|
|
2242
|
+
OpenSearchResultPage,
|
|
2243
|
+
OpenSearchSuggestPage
|
|
2244
|
+
);
|
|
2245
|
+
|
|
2246
|
+
const test = mergeTests(
|
|
2247
|
+
test$6,
|
|
2248
|
+
test$a,
|
|
2249
|
+
test$9,
|
|
2250
|
+
test$8,
|
|
2251
|
+
test$7,
|
|
2252
|
+
test$5,
|
|
2253
|
+
test$4,
|
|
2254
|
+
test$3,
|
|
2255
|
+
test$2,
|
|
2256
|
+
test$1
|
|
2257
|
+
);
|
|
2258
|
+
|
|
2259
|
+
export { AdminPageObjects, StorefrontPageObjects, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, test };
|