@shopware-ag/acceptance-test-suite 3.1.0 → 3.2.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/dist/index.d.mts +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.mjs +64 -8
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -464,6 +464,25 @@ declare class TestDataService {
|
|
|
464
464
|
* @param salesChannelId - The uuid of the sales channel in which the promotion should be active.
|
|
465
465
|
*/
|
|
466
466
|
createPromotionWithCode(overrides?: Partial<Promotion>, salesChannelId?: string): Promise<Promotion>;
|
|
467
|
+
/**
|
|
468
|
+
* Creates a new basic payment method.
|
|
469
|
+
*
|
|
470
|
+
* @param overrides - Specific data overrides that will be applied to the payment method data struct.
|
|
471
|
+
*/
|
|
472
|
+
createBasicPaymentMethod(overrides?: Partial<PaymentMethod>): Promise<PaymentMethod>;
|
|
473
|
+
/**
|
|
474
|
+
* Creates a payment method with one randomly generated image.
|
|
475
|
+
*
|
|
476
|
+
* @param overrides - Specific data overrides that will be applied to the payment method data struct.
|
|
477
|
+
*/
|
|
478
|
+
createPaymentMethodWithImage(overrides?: Partial<PaymentMethod>): Promise<PaymentMethod>;
|
|
479
|
+
/**
|
|
480
|
+
* Assigns a media resource to a payment method as a logo.
|
|
481
|
+
*
|
|
482
|
+
* @param paymentMethodId - The uuid of the payment method.
|
|
483
|
+
* @param mediaId - The uuid of the media resource.
|
|
484
|
+
*/
|
|
485
|
+
assignPaymentMethodMedia(paymentMethodId: string, mediaId: string): Promise<any>;
|
|
467
486
|
/**
|
|
468
487
|
* Assigns a media resource as the download of a digital product.
|
|
469
488
|
*
|
|
@@ -595,6 +614,12 @@ declare class TestDataService {
|
|
|
595
614
|
getBasicProductStruct(taxId?: string, currencyId?: string, overrides?: Partial<Product>): Partial<Product>;
|
|
596
615
|
getProductPriceRangeStruct(currencyId: string, ruleId: string): Partial<Product>;
|
|
597
616
|
getBasicManufacturerStruct(overrides?: Partial<Manufacturer>): Partial<Manufacturer>;
|
|
617
|
+
getBasicPaymentMethodStruct(overrides?: Partial<PaymentMethod>): {
|
|
618
|
+
id: string;
|
|
619
|
+
name: string;
|
|
620
|
+
technicalName: string;
|
|
621
|
+
active: boolean;
|
|
622
|
+
} & Partial<PaymentMethod>;
|
|
598
623
|
getBasicCategoryStruct(overrides?: Partial<Category$1>, parentId?: string): {
|
|
599
624
|
id: string;
|
|
600
625
|
name: string;
|
|
@@ -649,6 +674,8 @@ declare class TestDataService {
|
|
|
649
674
|
};
|
|
650
675
|
} & Partial<OrderLineItem>;
|
|
651
676
|
getBasicPromotionLineItemStruct(lineItem: SimpleLineItem): {
|
|
677
|
+
promotionId: string;
|
|
678
|
+
referencedId: string | undefined;
|
|
652
679
|
payload: {
|
|
653
680
|
code: string | undefined;
|
|
654
681
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -464,6 +464,25 @@ declare class TestDataService {
|
|
|
464
464
|
* @param salesChannelId - The uuid of the sales channel in which the promotion should be active.
|
|
465
465
|
*/
|
|
466
466
|
createPromotionWithCode(overrides?: Partial<Promotion>, salesChannelId?: string): Promise<Promotion>;
|
|
467
|
+
/**
|
|
468
|
+
* Creates a new basic payment method.
|
|
469
|
+
*
|
|
470
|
+
* @param overrides - Specific data overrides that will be applied to the payment method data struct.
|
|
471
|
+
*/
|
|
472
|
+
createBasicPaymentMethod(overrides?: Partial<PaymentMethod>): Promise<PaymentMethod>;
|
|
473
|
+
/**
|
|
474
|
+
* Creates a payment method with one randomly generated image.
|
|
475
|
+
*
|
|
476
|
+
* @param overrides - Specific data overrides that will be applied to the payment method data struct.
|
|
477
|
+
*/
|
|
478
|
+
createPaymentMethodWithImage(overrides?: Partial<PaymentMethod>): Promise<PaymentMethod>;
|
|
479
|
+
/**
|
|
480
|
+
* Assigns a media resource to a payment method as a logo.
|
|
481
|
+
*
|
|
482
|
+
* @param paymentMethodId - The uuid of the payment method.
|
|
483
|
+
* @param mediaId - The uuid of the media resource.
|
|
484
|
+
*/
|
|
485
|
+
assignPaymentMethodMedia(paymentMethodId: string, mediaId: string): Promise<any>;
|
|
467
486
|
/**
|
|
468
487
|
* Assigns a media resource as the download of a digital product.
|
|
469
488
|
*
|
|
@@ -595,6 +614,12 @@ declare class TestDataService {
|
|
|
595
614
|
getBasicProductStruct(taxId?: string, currencyId?: string, overrides?: Partial<Product>): Partial<Product>;
|
|
596
615
|
getProductPriceRangeStruct(currencyId: string, ruleId: string): Partial<Product>;
|
|
597
616
|
getBasicManufacturerStruct(overrides?: Partial<Manufacturer>): Partial<Manufacturer>;
|
|
617
|
+
getBasicPaymentMethodStruct(overrides?: Partial<PaymentMethod>): {
|
|
618
|
+
id: string;
|
|
619
|
+
name: string;
|
|
620
|
+
technicalName: string;
|
|
621
|
+
active: boolean;
|
|
622
|
+
} & Partial<PaymentMethod>;
|
|
598
623
|
getBasicCategoryStruct(overrides?: Partial<Category$1>, parentId?: string): {
|
|
599
624
|
id: string;
|
|
600
625
|
name: string;
|
|
@@ -649,6 +674,8 @@ declare class TestDataService {
|
|
|
649
674
|
};
|
|
650
675
|
} & Partial<OrderLineItem>;
|
|
651
676
|
getBasicPromotionLineItemStruct(lineItem: SimpleLineItem): {
|
|
677
|
+
promotionId: string;
|
|
678
|
+
referencedId: string | undefined;
|
|
652
679
|
payload: {
|
|
653
680
|
code: string | undefined;
|
|
654
681
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1039,7 +1039,7 @@ class TestDataService {
|
|
|
1039
1039
|
data: basicManufacturer
|
|
1040
1040
|
});
|
|
1041
1041
|
const { data: manufacturer } = await manufacturerResponse.json();
|
|
1042
|
-
this.addCreatedRecord("
|
|
1042
|
+
this.addCreatedRecord("product_manufacturer", manufacturer.id);
|
|
1043
1043
|
return manufacturer;
|
|
1044
1044
|
}
|
|
1045
1045
|
/**
|
|
@@ -1210,7 +1210,13 @@ class TestDataService {
|
|
|
1210
1210
|
const response = await this.AdminApiClient.post("customer?_response=detail", {
|
|
1211
1211
|
data: basicCustomerStruct
|
|
1212
1212
|
});
|
|
1213
|
-
const
|
|
1213
|
+
const customerData = await response.json();
|
|
1214
|
+
let customer;
|
|
1215
|
+
if (typeof basicCustomerStruct.password !== "string") {
|
|
1216
|
+
customer = { ...customerData.data };
|
|
1217
|
+
} else {
|
|
1218
|
+
customer = { ...customerData.data, password: basicCustomerStruct.password };
|
|
1219
|
+
}
|
|
1214
1220
|
this.addCreatedRecord("customer", customer.id);
|
|
1215
1221
|
return customer;
|
|
1216
1222
|
}
|
|
@@ -1271,6 +1277,46 @@ class TestDataService {
|
|
|
1271
1277
|
this.addCreatedRecord("promotion", promotion.id);
|
|
1272
1278
|
return promotionWithDiscount;
|
|
1273
1279
|
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Creates a new basic payment method.
|
|
1282
|
+
*
|
|
1283
|
+
* @param overrides - Specific data overrides that will be applied to the payment method data struct.
|
|
1284
|
+
*/
|
|
1285
|
+
async createBasicPaymentMethod(overrides = {}) {
|
|
1286
|
+
const basicPaymentMethod = this.getBasicPaymentMethodStruct(overrides);
|
|
1287
|
+
const paymentMethodResponse = await this.AdminApiClient.post("payment-method?_response=detail", {
|
|
1288
|
+
data: basicPaymentMethod
|
|
1289
|
+
});
|
|
1290
|
+
const { data: paymentMethod } = await paymentMethodResponse.json();
|
|
1291
|
+
this.addCreatedRecord("payment_method", paymentMethod.id);
|
|
1292
|
+
return paymentMethod;
|
|
1293
|
+
}
|
|
1294
|
+
/**
|
|
1295
|
+
* Creates a payment method with one randomly generated image.
|
|
1296
|
+
*
|
|
1297
|
+
* @param overrides - Specific data overrides that will be applied to the payment method data struct.
|
|
1298
|
+
*/
|
|
1299
|
+
async createPaymentMethodWithImage(overrides = {}) {
|
|
1300
|
+
const paymentMethod = await this.createBasicPaymentMethod(overrides);
|
|
1301
|
+
const media = await this.createMediaPNG();
|
|
1302
|
+
await this.assignPaymentMethodMedia(paymentMethod.id, media.id);
|
|
1303
|
+
return paymentMethod;
|
|
1304
|
+
}
|
|
1305
|
+
/**
|
|
1306
|
+
* Assigns a media resource to a payment method as a logo.
|
|
1307
|
+
*
|
|
1308
|
+
* @param paymentMethodId - The uuid of the payment method.
|
|
1309
|
+
* @param mediaId - The uuid of the media resource.
|
|
1310
|
+
*/
|
|
1311
|
+
async assignPaymentMethodMedia(paymentMethodId, mediaId) {
|
|
1312
|
+
const paymentMethodResponse = await this.AdminApiClient.patch(`payment-method/${paymentMethodId}?_response=basic`, {
|
|
1313
|
+
data: {
|
|
1314
|
+
mediaId
|
|
1315
|
+
}
|
|
1316
|
+
});
|
|
1317
|
+
const { data: paymentMethodMedia } = await paymentMethodResponse.json();
|
|
1318
|
+
return paymentMethodMedia;
|
|
1319
|
+
}
|
|
1274
1320
|
/**
|
|
1275
1321
|
* Assigns a media resource as the download of a digital product.
|
|
1276
1322
|
*
|
|
@@ -1708,6 +1754,17 @@ class TestDataService {
|
|
|
1708
1754
|
};
|
|
1709
1755
|
return Object.assign({}, basicManufacturer, overrides);
|
|
1710
1756
|
}
|
|
1757
|
+
getBasicPaymentMethodStruct(overrides = {}) {
|
|
1758
|
+
const { id: paymentMethodId, uuid: paymentMethodUuid } = this.IdProvider.getIdPair();
|
|
1759
|
+
const paymentMethodName = `${this.namePrefix}PaymentMethod-${paymentMethodId}${this.nameSuffix}`;
|
|
1760
|
+
const basicPaymentMethod = {
|
|
1761
|
+
id: paymentMethodUuid,
|
|
1762
|
+
name: paymentMethodName,
|
|
1763
|
+
technicalName: paymentMethodName.toLowerCase(),
|
|
1764
|
+
active: true
|
|
1765
|
+
};
|
|
1766
|
+
return Object.assign({}, basicPaymentMethod, overrides);
|
|
1767
|
+
}
|
|
1711
1768
|
getBasicCategoryStruct(overrides = {}, parentId = this.defaultCategoryId) {
|
|
1712
1769
|
const { id: categoryId, uuid: categoryUuid } = this.IdProvider.getIdPair();
|
|
1713
1770
|
const categoryName = `${this.namePrefix}Category-${categoryId}${this.nameSuffix}`;
|
|
@@ -1834,10 +1891,7 @@ class TestDataService {
|
|
|
1834
1891
|
}
|
|
1835
1892
|
});
|
|
1836
1893
|
const orderDelivery = this.getBasicOrderDeliveryStruct(deliveryState, shippingMethod, customerAddress);
|
|
1837
|
-
|
|
1838
|
-
if (orderDelivery.shippingCosts != null) {
|
|
1839
|
-
shippingCosts = orderDelivery.shippingCosts.totalPrice;
|
|
1840
|
-
}
|
|
1894
|
+
const shippingCosts = orderDelivery.shippingCosts?.totalPrice ?? 0;
|
|
1841
1895
|
totalPrice += shippingCosts;
|
|
1842
1896
|
const basicOrder = {
|
|
1843
1897
|
orderNumber: this.IdProvider.getIdPair().id,
|
|
@@ -1982,6 +2036,8 @@ class TestDataService {
|
|
|
1982
2036
|
const unitPrice = -Math.abs(promotionDiscountValue || 10);
|
|
1983
2037
|
const totalPrice = unitPrice * (lineItem.quantity || 1);
|
|
1984
2038
|
const basicPromotionLineItemStruct = {
|
|
2039
|
+
promotionId: promotion.id,
|
|
2040
|
+
referencedId: promotion.code,
|
|
1985
2041
|
payload: {
|
|
1986
2042
|
code: promotion.code
|
|
1987
2043
|
},
|
|
@@ -3592,9 +3648,9 @@ const test$3 = mergeTests(
|
|
|
3592
3648
|
|
|
3593
3649
|
const Login = test$e.extend({
|
|
3594
3650
|
Login: async ({ ShopCustomer, DefaultSalesChannel, StorefrontAccountLogin, StorefrontAccount }, use) => {
|
|
3595
|
-
const task = () => {
|
|
3651
|
+
const task = (customCustomer) => {
|
|
3596
3652
|
return async function Login2() {
|
|
3597
|
-
const
|
|
3653
|
+
const customer = customCustomer ? customCustomer : DefaultSalesChannel.customer;
|
|
3598
3654
|
await ShopCustomer.goesTo(StorefrontAccountLogin.url());
|
|
3599
3655
|
await StorefrontAccountLogin.emailInput.fill(customer.email);
|
|
3600
3656
|
await StorefrontAccountLogin.passwordInput.fill(customer.password);
|