@shopware-ag/acceptance-test-suite 3.8.0 → 3.8.2
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 +41 -2
- package/dist/index.d.ts +41 -2
- package/dist/index.mjs +138 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -292,6 +292,9 @@ type OrderLineItem = components['schemas']['OrderLineItem'] & {
|
|
|
292
292
|
type PropertyGroupOption = components['schemas']['PropertyGroupOption'] & {
|
|
293
293
|
id: string;
|
|
294
294
|
};
|
|
295
|
+
type DeliveryTime = components['schemas']['DeliveryTime'] & {
|
|
296
|
+
id: string;
|
|
297
|
+
};
|
|
295
298
|
|
|
296
299
|
interface CreatedRecord {
|
|
297
300
|
resource: string;
|
|
@@ -489,9 +492,23 @@ declare class TestDataService {
|
|
|
489
492
|
/**
|
|
490
493
|
* Creates basic variant products based on property group.
|
|
491
494
|
*
|
|
495
|
+
* @param parentProduct Parent product of the variants
|
|
496
|
+
* @param propertyGroups Property group collection which contain options
|
|
492
497
|
* @param overrides - Specific data overrides that will be applied to the variant data struct.
|
|
493
498
|
*/
|
|
494
499
|
createVariantProducts(parentProduct: Product, propertyGroups: PropertyGroup[], overrides?: Partial<Product>): Promise<Product[]>;
|
|
500
|
+
/**
|
|
501
|
+
* Creates a shipping method with one randomly generated image.
|
|
502
|
+
*
|
|
503
|
+
* @param overrides - Specific data overrides that will be applied to the shipping method data struct.
|
|
504
|
+
*/
|
|
505
|
+
createShippingMethodWithImage(overrides?: Partial<ShippingMethod>): Promise<ShippingMethod>;
|
|
506
|
+
/**
|
|
507
|
+
* Creates a new basic shipping method with random delivery time.
|
|
508
|
+
*
|
|
509
|
+
* @param overrides - Specific data overrides that will be applied to the shipping method data struct.
|
|
510
|
+
*/
|
|
511
|
+
createBasicShippingMethod(overrides?: Partial<ShippingMethod>): Promise<ShippingMethod>;
|
|
495
512
|
/**
|
|
496
513
|
* Function that generates combinations from n number of arrays
|
|
497
514
|
* with m number of elements in them.
|
|
@@ -532,7 +549,7 @@ declare class TestDataService {
|
|
|
532
549
|
* @param manufacturerId - The uuid of the manufacturer.
|
|
533
550
|
* @param productId - The uuid of the product.
|
|
534
551
|
*/
|
|
535
|
-
assignManufacturerProduct(manufacturerId: string, productId: string): Promise<
|
|
552
|
+
assignManufacturerProduct(manufacturerId: string, productId: string): Promise<void>;
|
|
536
553
|
/**
|
|
537
554
|
* Assigns a product to a category.
|
|
538
555
|
*
|
|
@@ -565,6 +582,17 @@ declare class TestDataService {
|
|
|
565
582
|
* @param name - The name of the shipping method. Default is "Standard".
|
|
566
583
|
*/
|
|
567
584
|
getShippingMethod(name?: string): Promise<ShippingMethod>;
|
|
585
|
+
/**
|
|
586
|
+
* Assigns a media resource to a shipping method as a logo.
|
|
587
|
+
*
|
|
588
|
+
* @param shippingMethodId - The uuid of the shipping method.
|
|
589
|
+
* @param mediaId - The uuid of the media resource.
|
|
590
|
+
*/
|
|
591
|
+
assignShippingMethodMedia(shippingMethodId: string, mediaId: string): Promise<any>;
|
|
592
|
+
/**
|
|
593
|
+
* Retrieves all delivery time resources.
|
|
594
|
+
*/
|
|
595
|
+
getAllDeliveryTimeResources(): Promise<DeliveryTime[]>;
|
|
568
596
|
/**
|
|
569
597
|
* Retrieves a payment method by its name.
|
|
570
598
|
*
|
|
@@ -661,6 +689,13 @@ declare class TestDataService {
|
|
|
661
689
|
} & Partial<Category$1>;
|
|
662
690
|
getBasicCustomerStruct(salesChannelId: string, customerGroupId: string, languageId: string, countryId: string, defaultPaymentMethodId: string, salutationId: string, overrides?: Partial<Customer>): Partial<Customer>;
|
|
663
691
|
getBasicOrderDeliveryStruct(deliveryState: StateMachineState, shippingMethod: ShippingMethod, customerAddress: CustomerAddress): Partial<OrderDelivery>;
|
|
692
|
+
getBasicShippingMethodStruct(deliveryTimeId: string, overrides?: Partial<ShippingMethod>): {
|
|
693
|
+
id: string;
|
|
694
|
+
name: string;
|
|
695
|
+
technicalName: string;
|
|
696
|
+
deliveryTimeId: string;
|
|
697
|
+
active: boolean;
|
|
698
|
+
} & Partial<ShippingMethod>;
|
|
664
699
|
isProduct(item: Product | Promotion): item is Product;
|
|
665
700
|
isPromotion(item: Product | Promotion): item is Promotion;
|
|
666
701
|
getBasicOrderStruct(lineItems: SimpleLineItem[], languageId: string, currency: Currency$1, paymentMethod: PaymentMethod, shippingMethod: ShippingMethod, orderState: StateMachineState, deliveryState: StateMachineState, transactionState: StateMachineState, customer: Customer, customerAddress: CustomerAddress, salesChannelId?: string, overrides?: Partial<Order>): Partial<Order>;
|
|
@@ -744,6 +779,10 @@ interface TestDataFixtureTypes {
|
|
|
744
779
|
interface HelperFixtureTypes {
|
|
745
780
|
IdProvider: IdProvider;
|
|
746
781
|
SaaSInstanceSetup: () => Promise<void>;
|
|
782
|
+
InstanceMeta: {
|
|
783
|
+
version: string;
|
|
784
|
+
isSaaS: boolean;
|
|
785
|
+
};
|
|
747
786
|
}
|
|
748
787
|
|
|
749
788
|
interface StoreBaseConfig {
|
|
@@ -1333,4 +1372,4 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
|
|
|
1333
1372
|
ValidateAccessibility: (pageName: string, assertViolations?: number | boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<axe_core.Result[]>;
|
|
1334
1373
|
}, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & FixtureTypes>;
|
|
1335
1374
|
|
|
1336
|
-
export { AdminPageObjects, type CalculatedTaxes, type Category$1 as Category, type CreatedRecord, type Currency$1 as Currency, type Customer, type CustomerAddress, type DataServiceOptions, type FixtureTypes, type Manufacturer, type Media, type Order, type OrderDelivery, type OrderLineItem, type OrderStatus, type PageObject, type PaymentMethod, type Price, type Product, type ProductPrice, type Promotion, type PromotionDiscount, type PropertyGroup, type PropertyGroupOption, type Rule, type SalesChannel, type Salutation, type ShippingMethod, type SimpleLineItem, type StateMachine, type StateMachineState, StorefrontPageObjects, type SyncApiOperation, type Tag, type Task, type TaxRules, TestDataService, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getPromotionWithDiscount, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, isSaaSInstance, isThemeCompiled, setOrderStatus, test };
|
|
1375
|
+
export { AdminPageObjects, type CalculatedTaxes, type Category$1 as Category, type CreatedRecord, type Currency$1 as Currency, type Customer, type CustomerAddress, type DataServiceOptions, type DeliveryTime, type FixtureTypes, type Manufacturer, type Media, type Order, type OrderDelivery, type OrderLineItem, type OrderStatus, type PageObject, type PaymentMethod, type Price, type Product, type ProductPrice, type Promotion, type PromotionDiscount, type PropertyGroup, type PropertyGroupOption, type Rule, type SalesChannel, type Salutation, type ShippingMethod, type SimpleLineItem, type StateMachine, type StateMachineState, StorefrontPageObjects, type SyncApiOperation, type Tag, type Task, type TaxRules, TestDataService, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getPromotionWithDiscount, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, isSaaSInstance, isThemeCompiled, setOrderStatus, test };
|
package/dist/index.d.ts
CHANGED
|
@@ -292,6 +292,9 @@ type OrderLineItem = components['schemas']['OrderLineItem'] & {
|
|
|
292
292
|
type PropertyGroupOption = components['schemas']['PropertyGroupOption'] & {
|
|
293
293
|
id: string;
|
|
294
294
|
};
|
|
295
|
+
type DeliveryTime = components['schemas']['DeliveryTime'] & {
|
|
296
|
+
id: string;
|
|
297
|
+
};
|
|
295
298
|
|
|
296
299
|
interface CreatedRecord {
|
|
297
300
|
resource: string;
|
|
@@ -489,9 +492,23 @@ declare class TestDataService {
|
|
|
489
492
|
/**
|
|
490
493
|
* Creates basic variant products based on property group.
|
|
491
494
|
*
|
|
495
|
+
* @param parentProduct Parent product of the variants
|
|
496
|
+
* @param propertyGroups Property group collection which contain options
|
|
492
497
|
* @param overrides - Specific data overrides that will be applied to the variant data struct.
|
|
493
498
|
*/
|
|
494
499
|
createVariantProducts(parentProduct: Product, propertyGroups: PropertyGroup[], overrides?: Partial<Product>): Promise<Product[]>;
|
|
500
|
+
/**
|
|
501
|
+
* Creates a shipping method with one randomly generated image.
|
|
502
|
+
*
|
|
503
|
+
* @param overrides - Specific data overrides that will be applied to the shipping method data struct.
|
|
504
|
+
*/
|
|
505
|
+
createShippingMethodWithImage(overrides?: Partial<ShippingMethod>): Promise<ShippingMethod>;
|
|
506
|
+
/**
|
|
507
|
+
* Creates a new basic shipping method with random delivery time.
|
|
508
|
+
*
|
|
509
|
+
* @param overrides - Specific data overrides that will be applied to the shipping method data struct.
|
|
510
|
+
*/
|
|
511
|
+
createBasicShippingMethod(overrides?: Partial<ShippingMethod>): Promise<ShippingMethod>;
|
|
495
512
|
/**
|
|
496
513
|
* Function that generates combinations from n number of arrays
|
|
497
514
|
* with m number of elements in them.
|
|
@@ -532,7 +549,7 @@ declare class TestDataService {
|
|
|
532
549
|
* @param manufacturerId - The uuid of the manufacturer.
|
|
533
550
|
* @param productId - The uuid of the product.
|
|
534
551
|
*/
|
|
535
|
-
assignManufacturerProduct(manufacturerId: string, productId: string): Promise<
|
|
552
|
+
assignManufacturerProduct(manufacturerId: string, productId: string): Promise<void>;
|
|
536
553
|
/**
|
|
537
554
|
* Assigns a product to a category.
|
|
538
555
|
*
|
|
@@ -565,6 +582,17 @@ declare class TestDataService {
|
|
|
565
582
|
* @param name - The name of the shipping method. Default is "Standard".
|
|
566
583
|
*/
|
|
567
584
|
getShippingMethod(name?: string): Promise<ShippingMethod>;
|
|
585
|
+
/**
|
|
586
|
+
* Assigns a media resource to a shipping method as a logo.
|
|
587
|
+
*
|
|
588
|
+
* @param shippingMethodId - The uuid of the shipping method.
|
|
589
|
+
* @param mediaId - The uuid of the media resource.
|
|
590
|
+
*/
|
|
591
|
+
assignShippingMethodMedia(shippingMethodId: string, mediaId: string): Promise<any>;
|
|
592
|
+
/**
|
|
593
|
+
* Retrieves all delivery time resources.
|
|
594
|
+
*/
|
|
595
|
+
getAllDeliveryTimeResources(): Promise<DeliveryTime[]>;
|
|
568
596
|
/**
|
|
569
597
|
* Retrieves a payment method by its name.
|
|
570
598
|
*
|
|
@@ -661,6 +689,13 @@ declare class TestDataService {
|
|
|
661
689
|
} & Partial<Category$1>;
|
|
662
690
|
getBasicCustomerStruct(salesChannelId: string, customerGroupId: string, languageId: string, countryId: string, defaultPaymentMethodId: string, salutationId: string, overrides?: Partial<Customer>): Partial<Customer>;
|
|
663
691
|
getBasicOrderDeliveryStruct(deliveryState: StateMachineState, shippingMethod: ShippingMethod, customerAddress: CustomerAddress): Partial<OrderDelivery>;
|
|
692
|
+
getBasicShippingMethodStruct(deliveryTimeId: string, overrides?: Partial<ShippingMethod>): {
|
|
693
|
+
id: string;
|
|
694
|
+
name: string;
|
|
695
|
+
technicalName: string;
|
|
696
|
+
deliveryTimeId: string;
|
|
697
|
+
active: boolean;
|
|
698
|
+
} & Partial<ShippingMethod>;
|
|
664
699
|
isProduct(item: Product | Promotion): item is Product;
|
|
665
700
|
isPromotion(item: Product | Promotion): item is Promotion;
|
|
666
701
|
getBasicOrderStruct(lineItems: SimpleLineItem[], languageId: string, currency: Currency$1, paymentMethod: PaymentMethod, shippingMethod: ShippingMethod, orderState: StateMachineState, deliveryState: StateMachineState, transactionState: StateMachineState, customer: Customer, customerAddress: CustomerAddress, salesChannelId?: string, overrides?: Partial<Order>): Partial<Order>;
|
|
@@ -744,6 +779,10 @@ interface TestDataFixtureTypes {
|
|
|
744
779
|
interface HelperFixtureTypes {
|
|
745
780
|
IdProvider: IdProvider;
|
|
746
781
|
SaaSInstanceSetup: () => Promise<void>;
|
|
782
|
+
InstanceMeta: {
|
|
783
|
+
version: string;
|
|
784
|
+
isSaaS: boolean;
|
|
785
|
+
};
|
|
747
786
|
}
|
|
748
787
|
|
|
749
788
|
interface StoreBaseConfig {
|
|
@@ -1333,4 +1372,4 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
|
|
|
1333
1372
|
ValidateAccessibility: (pageName: string, assertViolations?: number | boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<axe_core.Result[]>;
|
|
1334
1373
|
}, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & FixtureTypes>;
|
|
1335
1374
|
|
|
1336
|
-
export { AdminPageObjects, type CalculatedTaxes, type Category$1 as Category, type CreatedRecord, type Currency$1 as Currency, type Customer, type CustomerAddress, type DataServiceOptions, type FixtureTypes, type Manufacturer, type Media, type Order, type OrderDelivery, type OrderLineItem, type OrderStatus, type PageObject, type PaymentMethod, type Price, type Product, type ProductPrice, type Promotion, type PromotionDiscount, type PropertyGroup, type PropertyGroupOption, type Rule, type SalesChannel, type Salutation, type ShippingMethod, type SimpleLineItem, type StateMachine, type StateMachineState, StorefrontPageObjects, type SyncApiOperation, type Tag, type Task, type TaxRules, TestDataService, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getPromotionWithDiscount, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, isSaaSInstance, isThemeCompiled, setOrderStatus, test };
|
|
1375
|
+
export { AdminPageObjects, type CalculatedTaxes, type Category$1 as Category, type CreatedRecord, type Currency$1 as Currency, type Customer, type CustomerAddress, type DataServiceOptions, type DeliveryTime, type FixtureTypes, type Manufacturer, type Media, type Order, type OrderDelivery, type OrderLineItem, type OrderStatus, type PageObject, type PaymentMethod, type Price, type Product, type ProductPrice, type Promotion, type PromotionDiscount, type PropertyGroup, type PropertyGroupOption, type Rule, type SalesChannel, type Salutation, type ShippingMethod, type SimpleLineItem, type StateMachine, type StateMachineState, StorefrontPageObjects, type SyncApiOperation, type Tag, type Task, type TaxRules, TestDataService, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getPromotionWithDiscount, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, isSaaSInstance, isThemeCompiled, setOrderStatus, test };
|
package/dist/index.mjs
CHANGED
|
@@ -269,6 +269,21 @@ const test$c = test$e.extend({
|
|
|
269
269
|
const { uuid: customerUuid } = IdProvider.getWorkerDerivedStableId("customer");
|
|
270
270
|
const baseUrl = `${SalesChannelBaseConfig.appUrl}test-${uuid}/`;
|
|
271
271
|
await AdminApiContext.delete(`./customer/${customerUuid}`);
|
|
272
|
+
const wantedLanguages = /* @__PURE__ */ new Set([SalesChannelBaseConfig.enGBLanguageId, SalesChannelBaseConfig.defaultLanguageId]);
|
|
273
|
+
const languages = [];
|
|
274
|
+
const result = await AdminApiContext.get(`./sales-channel/${uuid}/languages`);
|
|
275
|
+
if (result.ok()) {
|
|
276
|
+
const salesChannelLanguages = await result.json();
|
|
277
|
+
wantedLanguages.forEach((l) => {
|
|
278
|
+
if (!salesChannelLanguages.data.find((i) => i.id === l)) {
|
|
279
|
+
languages.push({ id: l });
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
} else {
|
|
283
|
+
wantedLanguages.forEach((l) => {
|
|
284
|
+
languages.push({ id: l });
|
|
285
|
+
});
|
|
286
|
+
}
|
|
272
287
|
const syncResp = await AdminApiContext.post("./_action/sync", {
|
|
273
288
|
data: {
|
|
274
289
|
"write-sales-channel": {
|
|
@@ -304,7 +319,7 @@ const test$c = test$e.extend({
|
|
|
304
319
|
id: customerGroupUuid,
|
|
305
320
|
name: `${id} Acceptance test`
|
|
306
321
|
},
|
|
307
|
-
languages
|
|
322
|
+
languages,
|
|
308
323
|
countries: [{ id: SalesChannelBaseConfig.deCountryId }],
|
|
309
324
|
shippingMethods: [{ id: SalesChannelBaseConfig.defaultShippingMethod }],
|
|
310
325
|
paymentMethods: [{ id: SalesChannelBaseConfig.invoicePaymentMethodId }],
|
|
@@ -999,6 +1014,7 @@ class TestDataService {
|
|
|
999
1014
|
const productResponse = await this.AdminApiClient.post("./product?_response=detail", {
|
|
1000
1015
|
data: basicProduct
|
|
1001
1016
|
});
|
|
1017
|
+
expect(productResponse.ok()).toBeTruthy();
|
|
1002
1018
|
const { data: product } = await productResponse.json();
|
|
1003
1019
|
this.addCreatedRecord("product", product.id);
|
|
1004
1020
|
return product;
|
|
@@ -1059,6 +1075,7 @@ class TestDataService {
|
|
|
1059
1075
|
const manufacturerResponse = await this.AdminApiClient.post("./product-manufacturer?_response=detail", {
|
|
1060
1076
|
data: basicManufacturer
|
|
1061
1077
|
});
|
|
1078
|
+
expect(manufacturerResponse.ok()).toBeTruthy();
|
|
1062
1079
|
const { data: manufacturer } = await manufacturerResponse.json();
|
|
1063
1080
|
this.addCreatedRecord("product_manufacturer", manufacturer.id);
|
|
1064
1081
|
return manufacturer;
|
|
@@ -1085,6 +1102,7 @@ class TestDataService {
|
|
|
1085
1102
|
const response = await this.AdminApiClient.post("category?_response=detail", {
|
|
1086
1103
|
data: basicCategory
|
|
1087
1104
|
});
|
|
1105
|
+
expect(response.ok()).toBeTruthy();
|
|
1088
1106
|
const { data: category } = await response.json();
|
|
1089
1107
|
this.addCreatedRecord("category", category.id);
|
|
1090
1108
|
return category;
|
|
@@ -1099,10 +1117,11 @@ class TestDataService {
|
|
|
1099
1117
|
const image = createRandomImage(width, height);
|
|
1100
1118
|
const media = await this.createMediaResource();
|
|
1101
1119
|
const filename = `${this.namePrefix}Media-${media.id}${this.nameSuffix}`;
|
|
1102
|
-
await this.AdminApiClient.post(`_action/media/${media.id}/upload?extension=png&fileName=${filename}`, {
|
|
1120
|
+
const response = await this.AdminApiClient.post(`_action/media/${media.id}/upload?extension=png&fileName=${filename}`, {
|
|
1103
1121
|
data: Buffer.from(image.toBuffer()),
|
|
1104
1122
|
headers: { "content-type": "image/png" }
|
|
1105
1123
|
});
|
|
1124
|
+
expect(response.ok()).toBeTruthy();
|
|
1106
1125
|
this.addCreatedRecord("media", media.id);
|
|
1107
1126
|
return media;
|
|
1108
1127
|
}
|
|
@@ -1114,10 +1133,11 @@ class TestDataService {
|
|
|
1114
1133
|
async createMediaTXT(content = "Lorem ipsum dolor") {
|
|
1115
1134
|
const media = await this.createMediaResource();
|
|
1116
1135
|
const filename = `${this.namePrefix}Media-${media.id}${this.nameSuffix}`;
|
|
1117
|
-
await this.AdminApiClient.post(`_action/media/${media.id}/upload?extension=txt&fileName=${filename}`, {
|
|
1136
|
+
const response = await this.AdminApiClient.post(`_action/media/${media.id}/upload?extension=txt&fileName=${filename}`, {
|
|
1118
1137
|
data: content,
|
|
1119
1138
|
headers: { "content-type": "application/octet-stream" }
|
|
1120
1139
|
});
|
|
1140
|
+
expect(response.ok()).toBeTruthy();
|
|
1121
1141
|
this.addCreatedRecord("media", media.id);
|
|
1122
1142
|
return media;
|
|
1123
1143
|
}
|
|
@@ -1134,6 +1154,7 @@ class TestDataService {
|
|
|
1134
1154
|
title: `Title-${id}`
|
|
1135
1155
|
}
|
|
1136
1156
|
});
|
|
1157
|
+
expect(mediaResponse.ok()).toBeTruthy();
|
|
1137
1158
|
const { data: media } = await mediaResponse.json();
|
|
1138
1159
|
return media;
|
|
1139
1160
|
}
|
|
@@ -1163,6 +1184,7 @@ class TestDataService {
|
|
|
1163
1184
|
const propertyGroupResponse = await this.AdminApiClient.post("property-group?_response=detail", {
|
|
1164
1185
|
data: Object.assign({}, colorPropertyGroup, overrides)
|
|
1165
1186
|
});
|
|
1187
|
+
expect(propertyGroupResponse.ok()).toBeTruthy();
|
|
1166
1188
|
const { data: propertyGroup } = await propertyGroupResponse.json();
|
|
1167
1189
|
this.addCreatedRecord("property_group", propertyGroup.id);
|
|
1168
1190
|
return propertyGroup;
|
|
@@ -1190,6 +1212,7 @@ class TestDataService {
|
|
|
1190
1212
|
const propertyGroupResponse = await this.AdminApiClient.post("property-group?_response=detail", {
|
|
1191
1213
|
data: Object.assign({}, textPropertyGroup, overrides)
|
|
1192
1214
|
});
|
|
1215
|
+
expect(propertyGroupResponse.ok()).toBeTruthy();
|
|
1193
1216
|
const { data: propertyGroup } = await propertyGroupResponse.json();
|
|
1194
1217
|
this.addCreatedRecord("property_group", propertyGroup.id);
|
|
1195
1218
|
return propertyGroup;
|
|
@@ -1206,6 +1229,7 @@ class TestDataService {
|
|
|
1206
1229
|
name: tagName
|
|
1207
1230
|
}
|
|
1208
1231
|
});
|
|
1232
|
+
expect(response.ok()).toBeTruthy();
|
|
1209
1233
|
const { data: tag } = await response.json();
|
|
1210
1234
|
this.addCreatedRecord("tag", tag.id);
|
|
1211
1235
|
return tag;
|
|
@@ -1231,6 +1255,7 @@ class TestDataService {
|
|
|
1231
1255
|
const response = await this.AdminApiClient.post("customer?_response=detail", {
|
|
1232
1256
|
data: basicCustomerStruct
|
|
1233
1257
|
});
|
|
1258
|
+
expect(response.ok()).toBeTruthy();
|
|
1234
1259
|
const customerData = await response.json();
|
|
1235
1260
|
let customer;
|
|
1236
1261
|
if (typeof basicCustomerStruct.password !== "string") {
|
|
@@ -1278,6 +1303,7 @@ class TestDataService {
|
|
|
1278
1303
|
const orderResponse = await this.AdminApiClient.post("order?_response=detail", {
|
|
1279
1304
|
data: basicOrder
|
|
1280
1305
|
});
|
|
1306
|
+
expect(orderResponse.ok()).toBeTruthy();
|
|
1281
1307
|
const { data: order } = await orderResponse.json();
|
|
1282
1308
|
this.addCreatedRecord("order", order.id);
|
|
1283
1309
|
return order;
|
|
@@ -1293,6 +1319,7 @@ class TestDataService {
|
|
|
1293
1319
|
const promotionResponse = await this.AdminApiClient.post("promotion?_response=detail", {
|
|
1294
1320
|
data: basicPromotion
|
|
1295
1321
|
});
|
|
1322
|
+
expect(promotionResponse.ok()).toBeTruthy();
|
|
1296
1323
|
const { data: promotion } = await promotionResponse.json();
|
|
1297
1324
|
const promotionWithDiscount = await getPromotionWithDiscount(promotion.id, this.AdminApiClient);
|
|
1298
1325
|
this.addCreatedRecord("promotion", promotion.id);
|
|
@@ -1308,6 +1335,7 @@ class TestDataService {
|
|
|
1308
1335
|
const paymentMethodResponse = await this.AdminApiClient.post("payment-method?_response=detail", {
|
|
1309
1336
|
data: basicPaymentMethod
|
|
1310
1337
|
});
|
|
1338
|
+
expect(paymentMethodResponse.ok()).toBeTruthy();
|
|
1311
1339
|
const { data: paymentMethod } = await paymentMethodResponse.json();
|
|
1312
1340
|
this.addCreatedRecord("payment_method", paymentMethod.id);
|
|
1313
1341
|
return paymentMethod;
|
|
@@ -1322,6 +1350,7 @@ class TestDataService {
|
|
|
1322
1350
|
const ruleResponse = await this.AdminApiClient.post("rule?_response=detail", {
|
|
1323
1351
|
data: basicRule
|
|
1324
1352
|
});
|
|
1353
|
+
expect(ruleResponse.ok()).toBeTruthy();
|
|
1325
1354
|
const { data: rule } = await ruleResponse.json();
|
|
1326
1355
|
this.addCreatedRecord("rule", rule.id);
|
|
1327
1356
|
return rule;
|
|
@@ -1340,6 +1369,8 @@ class TestDataService {
|
|
|
1340
1369
|
/**
|
|
1341
1370
|
* Creates basic variant products based on property group.
|
|
1342
1371
|
*
|
|
1372
|
+
* @param parentProduct Parent product of the variants
|
|
1373
|
+
* @param propertyGroups Property group collection which contain options
|
|
1343
1374
|
* @param overrides - Specific data overrides that will be applied to the variant data struct.
|
|
1344
1375
|
*/
|
|
1345
1376
|
async createVariantProducts(parentProduct, propertyGroups, overrides = {}) {
|
|
@@ -1349,6 +1380,14 @@ class TestDataService {
|
|
|
1349
1380
|
const propertyGroupOptionsCollection = [];
|
|
1350
1381
|
for (const propertyGroupOption of propertyGroupOptions) {
|
|
1351
1382
|
propertyGroupOptionsCollection.push({ id: propertyGroupOption.id });
|
|
1383
|
+
const productConfiguratorResponse = await this.AdminApiClient.post("product-configurator-setting?_response=detail", {
|
|
1384
|
+
data: {
|
|
1385
|
+
id: this.IdProvider.getIdPair().uuid,
|
|
1386
|
+
productId: parentProduct.id,
|
|
1387
|
+
optionId: propertyGroupOption.id
|
|
1388
|
+
}
|
|
1389
|
+
});
|
|
1390
|
+
expect(productConfiguratorResponse.ok()).toBeTruthy();
|
|
1352
1391
|
}
|
|
1353
1392
|
productVariantCandidates.push(propertyGroupOptionsCollection);
|
|
1354
1393
|
}
|
|
@@ -1367,6 +1406,37 @@ class TestDataService {
|
|
|
1367
1406
|
}
|
|
1368
1407
|
return variantProducts;
|
|
1369
1408
|
}
|
|
1409
|
+
/**
|
|
1410
|
+
* Creates a shipping method with one randomly generated image.
|
|
1411
|
+
*
|
|
1412
|
+
* @param overrides - Specific data overrides that will be applied to the shipping method data struct.
|
|
1413
|
+
*/
|
|
1414
|
+
async createShippingMethodWithImage(overrides = {}) {
|
|
1415
|
+
const shippingMethod = await this.createBasicShippingMethod(overrides);
|
|
1416
|
+
const media = await this.createMediaPNG();
|
|
1417
|
+
await this.assignShippingMethodMedia(shippingMethod.id, media.id);
|
|
1418
|
+
return shippingMethod;
|
|
1419
|
+
}
|
|
1420
|
+
/**
|
|
1421
|
+
* Creates a new basic shipping method with random delivery time.
|
|
1422
|
+
*
|
|
1423
|
+
* @param overrides - Specific data overrides that will be applied to the shipping method data struct.
|
|
1424
|
+
*/
|
|
1425
|
+
async createBasicShippingMethod(overrides = {}) {
|
|
1426
|
+
const deliveryTime = await this.getAllDeliveryTimeResources();
|
|
1427
|
+
overrides.availabilityRuleId ?? (overrides.availabilityRuleId = (await this.getRule("Always valid (Default)")).id);
|
|
1428
|
+
const basicShippingMethod = this.getBasicShippingMethodStruct(
|
|
1429
|
+
deliveryTime[0].id,
|
|
1430
|
+
overrides
|
|
1431
|
+
);
|
|
1432
|
+
const shippingMethodResponse = await this.AdminApiClient.post("shipping-method?_response=detail", {
|
|
1433
|
+
data: basicShippingMethod
|
|
1434
|
+
});
|
|
1435
|
+
expect(shippingMethodResponse.ok()).toBeTruthy();
|
|
1436
|
+
const { data: shippingMethod } = await shippingMethodResponse.json();
|
|
1437
|
+
this.addCreatedRecord("shipping_method", shippingMethod.id);
|
|
1438
|
+
return shippingMethod;
|
|
1439
|
+
}
|
|
1370
1440
|
/**
|
|
1371
1441
|
* Assigns a media resource to a payment method as a logo.
|
|
1372
1442
|
*
|
|
@@ -1379,6 +1449,7 @@ class TestDataService {
|
|
|
1379
1449
|
mediaId
|
|
1380
1450
|
}
|
|
1381
1451
|
});
|
|
1452
|
+
expect(paymentMethodResponse.ok()).toBeTruthy();
|
|
1382
1453
|
const { data: paymentMethodMedia } = await paymentMethodResponse.json();
|
|
1383
1454
|
return paymentMethodMedia;
|
|
1384
1455
|
}
|
|
@@ -1395,6 +1466,7 @@ class TestDataService {
|
|
|
1395
1466
|
mediaId
|
|
1396
1467
|
}
|
|
1397
1468
|
});
|
|
1469
|
+
expect(downloadResponse.ok()).toBeTruthy();
|
|
1398
1470
|
const { data: productDownload } = await downloadResponse.json();
|
|
1399
1471
|
return productDownload;
|
|
1400
1472
|
}
|
|
@@ -1419,6 +1491,7 @@ class TestDataService {
|
|
|
1419
1491
|
]
|
|
1420
1492
|
}
|
|
1421
1493
|
});
|
|
1494
|
+
expect(mediaResponse.ok()).toBeTruthy();
|
|
1422
1495
|
const { data: productMedia } = await mediaResponse.json();
|
|
1423
1496
|
return productMedia;
|
|
1424
1497
|
}
|
|
@@ -1434,6 +1507,7 @@ class TestDataService {
|
|
|
1434
1507
|
mediaId
|
|
1435
1508
|
}
|
|
1436
1509
|
});
|
|
1510
|
+
expect(mediaResponse.ok()).toBeTruthy();
|
|
1437
1511
|
const { data: manufacturerMedia } = await mediaResponse.json();
|
|
1438
1512
|
return manufacturerMedia;
|
|
1439
1513
|
}
|
|
@@ -1444,7 +1518,7 @@ class TestDataService {
|
|
|
1444
1518
|
* @param productId - The uuid of the product.
|
|
1445
1519
|
*/
|
|
1446
1520
|
async assignManufacturerProduct(manufacturerId, productId) {
|
|
1447
|
-
|
|
1521
|
+
await this.AdminApiClient.patch(`product/${productId}?_response=basic`, {
|
|
1448
1522
|
data: {
|
|
1449
1523
|
manufacturerId
|
|
1450
1524
|
}
|
|
@@ -1496,6 +1570,7 @@ class TestDataService {
|
|
|
1496
1570
|
}]
|
|
1497
1571
|
}
|
|
1498
1572
|
});
|
|
1573
|
+
expect(currencyResponse.ok()).toBeTruthy();
|
|
1499
1574
|
const { data: result } = await currencyResponse.json();
|
|
1500
1575
|
return result[0];
|
|
1501
1576
|
}
|
|
@@ -1515,6 +1590,7 @@ class TestDataService {
|
|
|
1515
1590
|
}]
|
|
1516
1591
|
}
|
|
1517
1592
|
});
|
|
1593
|
+
expect(response.ok()).toBeTruthy();
|
|
1518
1594
|
const { data: result } = await response.json();
|
|
1519
1595
|
return result[0];
|
|
1520
1596
|
}
|
|
@@ -1534,9 +1610,35 @@ class TestDataService {
|
|
|
1534
1610
|
}]
|
|
1535
1611
|
}
|
|
1536
1612
|
});
|
|
1613
|
+
expect(response.ok()).toBeTruthy();
|
|
1537
1614
|
const { data: result } = await response.json();
|
|
1538
1615
|
return result[0];
|
|
1539
1616
|
}
|
|
1617
|
+
/**
|
|
1618
|
+
* Assigns a media resource to a shipping method as a logo.
|
|
1619
|
+
*
|
|
1620
|
+
* @param shippingMethodId - The uuid of the shipping method.
|
|
1621
|
+
* @param mediaId - The uuid of the media resource.
|
|
1622
|
+
*/
|
|
1623
|
+
async assignShippingMethodMedia(shippingMethodId, mediaId) {
|
|
1624
|
+
const shippingMethodResponse = await this.AdminApiClient.patch(`shipping-method/${shippingMethodId}?_response=basic`, {
|
|
1625
|
+
data: {
|
|
1626
|
+
mediaId
|
|
1627
|
+
}
|
|
1628
|
+
});
|
|
1629
|
+
expect(shippingMethodResponse.ok()).toBeTruthy();
|
|
1630
|
+
const { data: shippingMethodMedia } = await shippingMethodResponse.json();
|
|
1631
|
+
return shippingMethodMedia;
|
|
1632
|
+
}
|
|
1633
|
+
/**
|
|
1634
|
+
* Retrieves all delivery time resources.
|
|
1635
|
+
*/
|
|
1636
|
+
async getAllDeliveryTimeResources() {
|
|
1637
|
+
const response = await this.AdminApiClient.get("delivery-time");
|
|
1638
|
+
expect(response.ok()).toBeTruthy();
|
|
1639
|
+
const { data: deliveryTimeResources } = await response.json();
|
|
1640
|
+
return deliveryTimeResources;
|
|
1641
|
+
}
|
|
1540
1642
|
/**
|
|
1541
1643
|
* Retrieves a payment method by its name.
|
|
1542
1644
|
*
|
|
@@ -1553,6 +1655,7 @@ class TestDataService {
|
|
|
1553
1655
|
}]
|
|
1554
1656
|
}
|
|
1555
1657
|
});
|
|
1658
|
+
expect(response.ok()).toBeTruthy();
|
|
1556
1659
|
const { data: result } = await response.json();
|
|
1557
1660
|
return result[0];
|
|
1558
1661
|
}
|
|
@@ -1563,6 +1666,7 @@ class TestDataService {
|
|
|
1563
1666
|
*/
|
|
1564
1667
|
async getCustomerAddress(addressId) {
|
|
1565
1668
|
const response = await this.AdminApiClient.get(`customer-address/${addressId}`);
|
|
1669
|
+
expect(response.ok()).toBeTruthy();
|
|
1566
1670
|
const { data: address } = await response.json();
|
|
1567
1671
|
return address;
|
|
1568
1672
|
}
|
|
@@ -1582,6 +1686,7 @@ class TestDataService {
|
|
|
1582
1686
|
}]
|
|
1583
1687
|
}
|
|
1584
1688
|
});
|
|
1689
|
+
expect(response.ok()).toBeTruthy();
|
|
1585
1690
|
const { data: result } = await response.json();
|
|
1586
1691
|
return result[0];
|
|
1587
1692
|
}
|
|
@@ -1619,6 +1724,7 @@ class TestDataService {
|
|
|
1619
1724
|
}]
|
|
1620
1725
|
}
|
|
1621
1726
|
});
|
|
1727
|
+
expect(response.ok()).toBeTruthy();
|
|
1622
1728
|
const { data: result } = await response.json();
|
|
1623
1729
|
return result[0];
|
|
1624
1730
|
}
|
|
@@ -1643,6 +1749,7 @@ class TestDataService {
|
|
|
1643
1749
|
}]
|
|
1644
1750
|
}
|
|
1645
1751
|
});
|
|
1752
|
+
expect(response.ok()).toBeTruthy();
|
|
1646
1753
|
const { data: result } = await response.json();
|
|
1647
1754
|
return result[0];
|
|
1648
1755
|
}
|
|
@@ -1662,6 +1769,7 @@ class TestDataService {
|
|
|
1662
1769
|
}]
|
|
1663
1770
|
}
|
|
1664
1771
|
});
|
|
1772
|
+
expect(response.ok()).toBeTruthy();
|
|
1665
1773
|
const { data: result } = await response.json();
|
|
1666
1774
|
return result;
|
|
1667
1775
|
}
|
|
@@ -1983,6 +2091,18 @@ class TestDataService {
|
|
|
1983
2091
|
}
|
|
1984
2092
|
};
|
|
1985
2093
|
}
|
|
2094
|
+
getBasicShippingMethodStruct(deliveryTimeId, overrides = {}) {
|
|
2095
|
+
const { id: shippingMethodId, uuid: shippingMethodUuid } = this.IdProvider.getIdPair();
|
|
2096
|
+
const shippingMethodName = `${this.namePrefix}ShippingMethod-${shippingMethodId}${this.nameSuffix}`;
|
|
2097
|
+
const basicShippingMethod = {
|
|
2098
|
+
id: shippingMethodUuid,
|
|
2099
|
+
name: shippingMethodName,
|
|
2100
|
+
technicalName: shippingMethodName.toLowerCase(),
|
|
2101
|
+
deliveryTimeId,
|
|
2102
|
+
active: true
|
|
2103
|
+
};
|
|
2104
|
+
return Object.assign({}, basicShippingMethod, overrides);
|
|
2105
|
+
}
|
|
1986
2106
|
isProduct(item) {
|
|
1987
2107
|
return item.productNumber !== void 0;
|
|
1988
2108
|
}
|
|
@@ -2308,6 +2428,18 @@ const test$7 = test$e.extend({
|
|
|
2308
2428
|
await use(SetupInstance);
|
|
2309
2429
|
},
|
|
2310
2430
|
{ scope: "worker" }
|
|
2431
|
+
],
|
|
2432
|
+
InstanceMeta: [
|
|
2433
|
+
async ({ AdminApiContext: context }, use) => {
|
|
2434
|
+
const response = await context.get("./_info/config");
|
|
2435
|
+
expect(response.ok(), "/_info/config request failed").toBeTruthy();
|
|
2436
|
+
const config = await response.json();
|
|
2437
|
+
use({
|
|
2438
|
+
version: config.version,
|
|
2439
|
+
isSaaS: await isSaaSInstance(context)
|
|
2440
|
+
});
|
|
2441
|
+
},
|
|
2442
|
+
{ scope: "worker" }
|
|
2311
2443
|
]
|
|
2312
2444
|
});
|
|
2313
2445
|
|
|
@@ -2388,7 +2520,7 @@ class Category {
|
|
|
2388
2520
|
this.noProductsFoundAlert = page.getByText("No products found.");
|
|
2389
2521
|
}
|
|
2390
2522
|
url(categoryName) {
|
|
2391
|
-
return `${categoryName}
|
|
2523
|
+
return `${categoryName}/`;
|
|
2392
2524
|
}
|
|
2393
2525
|
}
|
|
2394
2526
|
|
|
@@ -2770,7 +2902,7 @@ class AccountAddresses {
|
|
|
2770
2902
|
__publicField$d(this, "editShippingAddressButton");
|
|
2771
2903
|
__publicField$d(this, "useDefaultBillingAddressButton");
|
|
2772
2904
|
__publicField$d(this, "useDefaultShippingAddressButton");
|
|
2773
|
-
this.addNewAddressButton = page.getByRole("link", { name:
|
|
2905
|
+
this.addNewAddressButton = page.getByRole("link", { name: /Add (new )?address/ });
|
|
2774
2906
|
this.editBillingAddressButton = page.getByRole("link", { name: "Edit address" }).first();
|
|
2775
2907
|
this.editShippingAddressButton = page.getByRole("link", { name: "Edit address" }).nth(1);
|
|
2776
2908
|
this.useDefaultBillingAddressButton = page.getByRole("button", { name: "Use as default billing address" });
|