@shopware-ag/acceptance-test-suite 2.4.0 → 2.6.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 CHANGED
@@ -1,3 +1,4 @@
1
+ import * as axe_core from 'axe-core';
1
2
  import * as _playwright_test from '@playwright/test';
2
3
  import { APIRequestContext, APIResponse, Page, Locator } from '@playwright/test';
3
4
  export * from '@playwright/test';
@@ -194,6 +195,20 @@ type Product = Omit<components['schemas']['Product'], 'price' | 'prices'> & {
194
195
  name: string;
195
196
  };
196
197
  };
198
+ type OrderDelivery = Omit<components['schemas']['OrderDelivery'], 'shippingOrderAddress' | 'shippingCosts'> & {
199
+ id: string;
200
+ shippingOrderAddress: Partial<components['schemas']['OrderAddress']>;
201
+ shippingCosts: {
202
+ unitPrice: number;
203
+ totalPrice: number;
204
+ quantity: number;
205
+ calculatedTaxes: CalculatedTaxes[];
206
+ taxRules: TaxRules[];
207
+ };
208
+ };
209
+ type Manufacturer = components['schemas']['ProductManufacturer'] & {
210
+ id: string;
211
+ };
197
212
  type PropertyGroup = components['schemas']['PropertyGroup'] & {
198
213
  id: string;
199
214
  };
@@ -212,7 +227,16 @@ type Rule = components['schemas']['Rule'] & {
212
227
  type Currency$1 = components['schemas']['Currency'] & {
213
228
  id: string;
214
229
  };
215
- type Order = components['schemas']['Order'] & {
230
+ interface CalculatedTaxes {
231
+ tax: number;
232
+ taxRate: number;
233
+ price: number;
234
+ }
235
+ interface TaxRules {
236
+ taxRate: number;
237
+ percentage: number;
238
+ }
239
+ type Order = Omit<components['schemas']['Order'], 'deliveries' | 'price'> & {
216
240
  id: string;
217
241
  orderCustomer: {
218
242
  firstName: string;
@@ -225,7 +249,10 @@ type Order = components['schemas']['Order'] & {
225
249
  rawTotal: number;
226
250
  taxStatus: string;
227
251
  totalPrice: number;
252
+ calculatedTaxes: CalculatedTaxes[];
253
+ taxRules: TaxRules[];
228
254
  };
255
+ deliveries: Record<string, unknown>[];
229
256
  };
230
257
  type ShippingMethod = components['schemas']['ShippingMethod'] & {
231
258
  id: string;
@@ -239,7 +266,19 @@ type StateMachine = components['schemas']['StateMachine'] & {
239
266
  type StateMachineState = components['schemas']['StateMachineState'] & {
240
267
  id: string;
241
268
  };
242
- type Promotion = components['schemas']['Promotion'] & {
269
+ type Promotion = Omit<components['schemas']['Promotion'], 'discounts'> & {
270
+ id: string;
271
+ discounts: [
272
+ {
273
+ id?: string;
274
+ scope: string;
275
+ type: string;
276
+ value: number;
277
+ considerAdvancedRules: boolean;
278
+ }
279
+ ];
280
+ };
281
+ type PromotionDiscount = components['schemas']['PromotionDiscount'] & {
243
282
  id: string;
244
283
  };
245
284
 
@@ -248,7 +287,7 @@ interface CreatedRecord {
248
287
  payload: Record<string, string>;
249
288
  }
250
289
  interface SimpleLineItem {
251
- product: Product;
290
+ product: Product | Promotion;
252
291
  quantity?: number;
253
292
  position?: number;
254
293
  }
@@ -338,6 +377,18 @@ declare class TestDataService {
338
377
  * @param currencyId - The uuid of the currency to use for the product pricing.
339
378
  */
340
379
  createProductWithPriceRange(overrides?: Partial<Product>, taxId?: string, currencyId?: string): Promise<Product>;
380
+ /**
381
+ * Creates a basic manufacturer without images or other special configuration.
382
+ *
383
+ * @param overrides - Specific data overrides that will be applied to the manufacturer data struct.
384
+ */
385
+ createBasicManufacturer(overrides?: Partial<Manufacturer>): Promise<Manufacturer>;
386
+ /**
387
+ * Creates a basic manufacturer with one randomly generated image.
388
+ *
389
+ * @param overrides - Specific data overrides that will be applied to the manufacturer data struct.
390
+ */
391
+ createManufacturerWithImage(overrides?: Partial<Manufacturer>): Promise<Manufacturer>;
341
392
  /**
342
393
  * Creates a basic product category to assign products to.
343
394
  *
@@ -394,12 +445,12 @@ declare class TestDataService {
394
445
  *
395
446
  * @param lineItems - Products that should be added to the order.
396
447
  * @param customer - The customer to which the order should be assigned.
397
- * @param salesChannel - The sales channel in which the order should be created.
398
448
  * @param overrides - Specific data overrides that will be applied to the order data struct.
449
+ * @param salesChannel - The sales channel in which the order should be created.
399
450
  */
400
451
  createOrder(lineItems: SimpleLineItem[], customer: Customer, overrides?: Partial<Order>, salesChannel?: SalesChannel): Promise<Order>;
401
452
  /**
402
- * Creates a new promotion with a promotion code.
453
+ * Creates a new promotion with a promotion code and only single discount option.
403
454
  *
404
455
  * @param overrides - Specific data overrides that will be applied to the promotion data struct.
405
456
  * @param salesChannelId - The uuid of the sales channel in which the promotion should be active.
@@ -419,6 +470,20 @@ declare class TestDataService {
419
470
  * @param mediaId - The uuid of the media resource.
420
471
  */
421
472
  assignProductMedia(productId: string, mediaId: string): Promise<any>;
473
+ /**
474
+ * Assigns a media resource to a manufacturer as a logo.
475
+ *
476
+ * @param manufacturerId - The uuid of the manufacturer.
477
+ * @param mediaId - The uuid of the media resource.
478
+ */
479
+ assignManufacturerMedia(manufacturerId: string, mediaId: string): Promise<any>;
480
+ /**
481
+ * Assigns a manufacturer to a product.
482
+ *
483
+ * @param manufacturerId - The uuid of the manufacturer.
484
+ * @param productId - The uuid of the product.
485
+ */
486
+ assignManufacturerProduct(manufacturerId: string, productId: string): Promise<playwright_core.APIResponse>;
422
487
  /**
423
488
  * Assigns a product to a category.
424
489
  *
@@ -521,6 +586,7 @@ declare class TestDataService {
521
586
  convertDateTime(date: Date): string;
522
587
  getBasicProductStruct(taxId?: string, currencyId?: string, overrides?: Partial<Product>): Partial<Product>;
523
588
  getProductPriceRangeStruct(currencyId: string, ruleId: string): Partial<Product>;
589
+ getBasicManufacturerStruct(overrides?: Partial<Manufacturer>): Partial<Manufacturer>;
524
590
  getBasicCategoryStruct(overrides?: Partial<Category$1>, parentId?: string): {
525
591
  id: string;
526
592
  name: string;
@@ -532,6 +598,9 @@ declare class TestDataService {
532
598
  active: boolean;
533
599
  } & Partial<Category$1>;
534
600
  getBasicCustomerStruct(salesChannelId: string, customerGroupId: string, languageId: string, countryId: string, defaultPaymentMethodId: string, salutationId: string, overrides?: Partial<Customer>): Partial<Customer>;
601
+ getBasicOrderDeliveryStruct(deliveryState: StateMachineState, shippingMethod: ShippingMethod, customerAddress: CustomerAddress): Partial<OrderDelivery>;
602
+ isProduct(item: Product | Promotion): item is Product;
603
+ isPromotion(item: Product | Promotion): item is Promotion;
535
604
  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>;
536
605
  getBasicProductLineItemStruct(lineItem: SimpleLineItem): {
537
606
  productId: string;
@@ -571,6 +640,36 @@ declare class TestDataService {
571
640
  referencePriceDefinition: null;
572
641
  };
573
642
  };
643
+ getBasicPromotionLineItemStruct(lineItem: SimpleLineItem): {
644
+ payload: {
645
+ code: string | undefined;
646
+ };
647
+ identifier: string | undefined;
648
+ type: string;
649
+ label: string;
650
+ description: string;
651
+ quantity: number;
652
+ position: number;
653
+ price: {
654
+ unitPrice: number;
655
+ totalPrice: number;
656
+ quantity: number | undefined;
657
+ calculatedTaxes: {
658
+ tax: number;
659
+ taxRate: number;
660
+ price: number;
661
+ }[];
662
+ taxRules: {
663
+ taxRate: number;
664
+ percentage: number;
665
+ }[];
666
+ };
667
+ priceDefinition: {
668
+ type: string;
669
+ price: number;
670
+ percentage: number | null;
671
+ };
672
+ };
574
673
  getBasicPromotionStruct(salesChannelId?: string, overrides?: Partial<Promotion>): Partial<Promotion>;
575
674
  }
576
675
 
@@ -1076,6 +1175,10 @@ declare const getMediaId: (fileName: string, adminApiContext: AdminApiContext) =
1076
1175
  declare function extractIdFromUrl(url: string): string | null;
1077
1176
  type OrderStatus = 'cancel' | 'complete' | 'reopen' | 'process';
1078
1177
  declare const setOrderStatus: (orderId: string, orderStatus: OrderStatus, adminApiContext: AdminApiContext) => Promise<APIResponse>;
1178
+ /**
1179
+ * Return a single promotion entity with a fetched single discount entity
1180
+ */
1181
+ declare const getPromotionWithDiscount: (promotionId: string, adminApiContext: AdminApiContext) => Promise<Promotion>;
1079
1182
 
1080
1183
  declare const isSaaSInstance: (adminApiContext: AdminApiContext) => Promise<boolean>;
1081
1184
  declare const isThemeCompiled: (context: AdminApiContext, storefrontUrl: string) => Promise<boolean>;
@@ -1115,7 +1218,7 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
1115
1218
  } & {
1116
1219
  OpenSearchSuggestPage: Task;
1117
1220
  } & {
1118
- ValidateAccessibility: (pageName: string, assertViolations?: boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<void>;
1221
+ ValidateAccessibility: (pageName: string, assertViolations?: number | boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<axe_core.Result[]>;
1119
1222
  }, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & FixtureTypes>;
1120
1223
 
1121
- export { AdminPageObjects, type Category$1 as Category, type CreatedRecord, type Currency$1 as Currency, type Customer, type CustomerAddress, type DataServiceOptions, type FixtureTypes, type Media, type Order, type PageObject, type PaymentMethod, type Price, type Product, type ProductPrice, type Promotion, type PropertyGroup, type Rule, type SalesChannel, type Salutation, type ShippingMethod, type SimpleLineItem, type StateMachine, type StateMachineState, StorefrontPageObjects, type SyncApiOperation, type Tag, type Task, TestDataService, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, isSaaSInstance, isThemeCompiled, setOrderStatus, test };
1224
+ 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 PageObject, type PaymentMethod, type Price, type Product, type ProductPrice, type Promotion, type PromotionDiscount, type PropertyGroup, 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
@@ -1,3 +1,4 @@
1
+ import * as axe_core from 'axe-core';
1
2
  import * as _playwright_test from '@playwright/test';
2
3
  import { APIRequestContext, APIResponse, Page, Locator } from '@playwright/test';
3
4
  export * from '@playwright/test';
@@ -194,6 +195,20 @@ type Product = Omit<components['schemas']['Product'], 'price' | 'prices'> & {
194
195
  name: string;
195
196
  };
196
197
  };
198
+ type OrderDelivery = Omit<components['schemas']['OrderDelivery'], 'shippingOrderAddress' | 'shippingCosts'> & {
199
+ id: string;
200
+ shippingOrderAddress: Partial<components['schemas']['OrderAddress']>;
201
+ shippingCosts: {
202
+ unitPrice: number;
203
+ totalPrice: number;
204
+ quantity: number;
205
+ calculatedTaxes: CalculatedTaxes[];
206
+ taxRules: TaxRules[];
207
+ };
208
+ };
209
+ type Manufacturer = components['schemas']['ProductManufacturer'] & {
210
+ id: string;
211
+ };
197
212
  type PropertyGroup = components['schemas']['PropertyGroup'] & {
198
213
  id: string;
199
214
  };
@@ -212,7 +227,16 @@ type Rule = components['schemas']['Rule'] & {
212
227
  type Currency$1 = components['schemas']['Currency'] & {
213
228
  id: string;
214
229
  };
215
- type Order = components['schemas']['Order'] & {
230
+ interface CalculatedTaxes {
231
+ tax: number;
232
+ taxRate: number;
233
+ price: number;
234
+ }
235
+ interface TaxRules {
236
+ taxRate: number;
237
+ percentage: number;
238
+ }
239
+ type Order = Omit<components['schemas']['Order'], 'deliveries' | 'price'> & {
216
240
  id: string;
217
241
  orderCustomer: {
218
242
  firstName: string;
@@ -225,7 +249,10 @@ type Order = components['schemas']['Order'] & {
225
249
  rawTotal: number;
226
250
  taxStatus: string;
227
251
  totalPrice: number;
252
+ calculatedTaxes: CalculatedTaxes[];
253
+ taxRules: TaxRules[];
228
254
  };
255
+ deliveries: Record<string, unknown>[];
229
256
  };
230
257
  type ShippingMethod = components['schemas']['ShippingMethod'] & {
231
258
  id: string;
@@ -239,7 +266,19 @@ type StateMachine = components['schemas']['StateMachine'] & {
239
266
  type StateMachineState = components['schemas']['StateMachineState'] & {
240
267
  id: string;
241
268
  };
242
- type Promotion = components['schemas']['Promotion'] & {
269
+ type Promotion = Omit<components['schemas']['Promotion'], 'discounts'> & {
270
+ id: string;
271
+ discounts: [
272
+ {
273
+ id?: string;
274
+ scope: string;
275
+ type: string;
276
+ value: number;
277
+ considerAdvancedRules: boolean;
278
+ }
279
+ ];
280
+ };
281
+ type PromotionDiscount = components['schemas']['PromotionDiscount'] & {
243
282
  id: string;
244
283
  };
245
284
 
@@ -248,7 +287,7 @@ interface CreatedRecord {
248
287
  payload: Record<string, string>;
249
288
  }
250
289
  interface SimpleLineItem {
251
- product: Product;
290
+ product: Product | Promotion;
252
291
  quantity?: number;
253
292
  position?: number;
254
293
  }
@@ -338,6 +377,18 @@ declare class TestDataService {
338
377
  * @param currencyId - The uuid of the currency to use for the product pricing.
339
378
  */
340
379
  createProductWithPriceRange(overrides?: Partial<Product>, taxId?: string, currencyId?: string): Promise<Product>;
380
+ /**
381
+ * Creates a basic manufacturer without images or other special configuration.
382
+ *
383
+ * @param overrides - Specific data overrides that will be applied to the manufacturer data struct.
384
+ */
385
+ createBasicManufacturer(overrides?: Partial<Manufacturer>): Promise<Manufacturer>;
386
+ /**
387
+ * Creates a basic manufacturer with one randomly generated image.
388
+ *
389
+ * @param overrides - Specific data overrides that will be applied to the manufacturer data struct.
390
+ */
391
+ createManufacturerWithImage(overrides?: Partial<Manufacturer>): Promise<Manufacturer>;
341
392
  /**
342
393
  * Creates a basic product category to assign products to.
343
394
  *
@@ -394,12 +445,12 @@ declare class TestDataService {
394
445
  *
395
446
  * @param lineItems - Products that should be added to the order.
396
447
  * @param customer - The customer to which the order should be assigned.
397
- * @param salesChannel - The sales channel in which the order should be created.
398
448
  * @param overrides - Specific data overrides that will be applied to the order data struct.
449
+ * @param salesChannel - The sales channel in which the order should be created.
399
450
  */
400
451
  createOrder(lineItems: SimpleLineItem[], customer: Customer, overrides?: Partial<Order>, salesChannel?: SalesChannel): Promise<Order>;
401
452
  /**
402
- * Creates a new promotion with a promotion code.
453
+ * Creates a new promotion with a promotion code and only single discount option.
403
454
  *
404
455
  * @param overrides - Specific data overrides that will be applied to the promotion data struct.
405
456
  * @param salesChannelId - The uuid of the sales channel in which the promotion should be active.
@@ -419,6 +470,20 @@ declare class TestDataService {
419
470
  * @param mediaId - The uuid of the media resource.
420
471
  */
421
472
  assignProductMedia(productId: string, mediaId: string): Promise<any>;
473
+ /**
474
+ * Assigns a media resource to a manufacturer as a logo.
475
+ *
476
+ * @param manufacturerId - The uuid of the manufacturer.
477
+ * @param mediaId - The uuid of the media resource.
478
+ */
479
+ assignManufacturerMedia(manufacturerId: string, mediaId: string): Promise<any>;
480
+ /**
481
+ * Assigns a manufacturer to a product.
482
+ *
483
+ * @param manufacturerId - The uuid of the manufacturer.
484
+ * @param productId - The uuid of the product.
485
+ */
486
+ assignManufacturerProduct(manufacturerId: string, productId: string): Promise<playwright_core.APIResponse>;
422
487
  /**
423
488
  * Assigns a product to a category.
424
489
  *
@@ -521,6 +586,7 @@ declare class TestDataService {
521
586
  convertDateTime(date: Date): string;
522
587
  getBasicProductStruct(taxId?: string, currencyId?: string, overrides?: Partial<Product>): Partial<Product>;
523
588
  getProductPriceRangeStruct(currencyId: string, ruleId: string): Partial<Product>;
589
+ getBasicManufacturerStruct(overrides?: Partial<Manufacturer>): Partial<Manufacturer>;
524
590
  getBasicCategoryStruct(overrides?: Partial<Category$1>, parentId?: string): {
525
591
  id: string;
526
592
  name: string;
@@ -532,6 +598,9 @@ declare class TestDataService {
532
598
  active: boolean;
533
599
  } & Partial<Category$1>;
534
600
  getBasicCustomerStruct(salesChannelId: string, customerGroupId: string, languageId: string, countryId: string, defaultPaymentMethodId: string, salutationId: string, overrides?: Partial<Customer>): Partial<Customer>;
601
+ getBasicOrderDeliveryStruct(deliveryState: StateMachineState, shippingMethod: ShippingMethod, customerAddress: CustomerAddress): Partial<OrderDelivery>;
602
+ isProduct(item: Product | Promotion): item is Product;
603
+ isPromotion(item: Product | Promotion): item is Promotion;
535
604
  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>;
536
605
  getBasicProductLineItemStruct(lineItem: SimpleLineItem): {
537
606
  productId: string;
@@ -571,6 +640,36 @@ declare class TestDataService {
571
640
  referencePriceDefinition: null;
572
641
  };
573
642
  };
643
+ getBasicPromotionLineItemStruct(lineItem: SimpleLineItem): {
644
+ payload: {
645
+ code: string | undefined;
646
+ };
647
+ identifier: string | undefined;
648
+ type: string;
649
+ label: string;
650
+ description: string;
651
+ quantity: number;
652
+ position: number;
653
+ price: {
654
+ unitPrice: number;
655
+ totalPrice: number;
656
+ quantity: number | undefined;
657
+ calculatedTaxes: {
658
+ tax: number;
659
+ taxRate: number;
660
+ price: number;
661
+ }[];
662
+ taxRules: {
663
+ taxRate: number;
664
+ percentage: number;
665
+ }[];
666
+ };
667
+ priceDefinition: {
668
+ type: string;
669
+ price: number;
670
+ percentage: number | null;
671
+ };
672
+ };
574
673
  getBasicPromotionStruct(salesChannelId?: string, overrides?: Partial<Promotion>): Partial<Promotion>;
575
674
  }
576
675
 
@@ -1076,6 +1175,10 @@ declare const getMediaId: (fileName: string, adminApiContext: AdminApiContext) =
1076
1175
  declare function extractIdFromUrl(url: string): string | null;
1077
1176
  type OrderStatus = 'cancel' | 'complete' | 'reopen' | 'process';
1078
1177
  declare const setOrderStatus: (orderId: string, orderStatus: OrderStatus, adminApiContext: AdminApiContext) => Promise<APIResponse>;
1178
+ /**
1179
+ * Return a single promotion entity with a fetched single discount entity
1180
+ */
1181
+ declare const getPromotionWithDiscount: (promotionId: string, adminApiContext: AdminApiContext) => Promise<Promotion>;
1079
1182
 
1080
1183
  declare const isSaaSInstance: (adminApiContext: AdminApiContext) => Promise<boolean>;
1081
1184
  declare const isThemeCompiled: (context: AdminApiContext, storefrontUrl: string) => Promise<boolean>;
@@ -1115,7 +1218,7 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
1115
1218
  } & {
1116
1219
  OpenSearchSuggestPage: Task;
1117
1220
  } & {
1118
- ValidateAccessibility: (pageName: string, assertViolations?: boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<void>;
1221
+ ValidateAccessibility: (pageName: string, assertViolations?: number | boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<axe_core.Result[]>;
1119
1222
  }, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & FixtureTypes>;
1120
1223
 
1121
- export { AdminPageObjects, type Category$1 as Category, type CreatedRecord, type Currency$1 as Currency, type Customer, type CustomerAddress, type DataServiceOptions, type FixtureTypes, type Media, type Order, type PageObject, type PaymentMethod, type Price, type Product, type ProductPrice, type Promotion, type PropertyGroup, type Rule, type SalesChannel, type Salutation, type ShippingMethod, type SimpleLineItem, type StateMachine, type StateMachineState, StorefrontPageObjects, type SyncApiOperation, type Tag, type Task, TestDataService, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, isSaaSInstance, isThemeCompiled, setOrderStatus, test };
1224
+ 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 PageObject, type PaymentMethod, type Price, type Product, type ProductPrice, type Promotion, type PromotionDiscount, type PropertyGroup, 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
@@ -202,6 +202,28 @@ function extractIdFromUrl(url) {
202
202
  const setOrderStatus = async (orderId, orderStatus, adminApiContext) => {
203
203
  return await adminApiContext.post(`./_action/order/${orderId}/state/${orderStatus}`);
204
204
  };
205
+ const getPromotionWithDiscount = async (promotionId, adminApiContext) => {
206
+ const resp = await adminApiContext.post("search/promotion", {
207
+ data: {
208
+ limit: 1,
209
+ associations: {
210
+ discounts: {
211
+ limit: 10,
212
+ type: "equals",
213
+ field: "promotionId",
214
+ value: promotionId
215
+ }
216
+ },
217
+ filter: [{
218
+ type: "equals",
219
+ field: "id",
220
+ value: promotionId
221
+ }]
222
+ }
223
+ });
224
+ const { data: promotion } = await resp.json();
225
+ return promotion[0];
226
+ };
205
227
 
206
228
  const test$b = test$d.extend({
207
229
  SalesChannelBaseConfig: [
@@ -247,51 +269,6 @@ const test$b = test$d.extend({
247
269
  const { uuid: customerUuid } = IdProvider.getWorkerDerivedStableId("customer");
248
270
  const baseUrl = `${SalesChannelBaseConfig.appUrl}test-${uuid}/`;
249
271
  await AdminApiContext.delete(`./customer/${customerUuid}`);
250
- const ordersResp = await AdminApiContext.post(`./search/order`, {
251
- data: {
252
- filter: [{
253
- type: "equals",
254
- field: "salesChannelId",
255
- value: uuid
256
- }]
257
- }
258
- });
259
- const orders = await ordersResp.json();
260
- if (orders.data) {
261
- for (const order of orders.data) {
262
- const deleteOrderResp = await AdminApiContext.delete(`./order/${order.id}`);
263
- expect(deleteOrderResp.ok()).toBeTruthy();
264
- }
265
- }
266
- const versionsResp = await AdminApiContext.post(`./search/version`);
267
- expect(versionsResp.ok()).toBeTruthy();
268
- const versions = await versionsResp.json();
269
- const versionIds = versions.data.map((v) => v.id);
270
- for (const versionId of versionIds) {
271
- const ordersResp2 = await AdminApiContext.post(`./search/order`, {
272
- data: {
273
- filter: [
274
- {
275
- type: "equals",
276
- field: "salesChannelId",
277
- value: uuid
278
- }
279
- ]
280
- },
281
- headers: {
282
- "sw-version-id": versionId
283
- }
284
- });
285
- const orders2 = await ordersResp2.json();
286
- if (orders2.data) {
287
- for (const order of orders2.data) {
288
- const deleteOrderResp = await AdminApiContext.post(
289
- `./_action/version/${versionId}/order/${order.id}`
290
- );
291
- expect(deleteOrderResp.ok()).toBeTruthy();
292
- }
293
- }
294
- }
295
272
  const syncResp = await AdminApiContext.post("./_action/sync", {
296
273
  data: {
297
274
  "write-sales-channel": {
@@ -1032,6 +1009,31 @@ class TestDataService {
1032
1009
  const productOverrides = Object.assign({}, priceRange, overrides);
1033
1010
  return this.createBasicProduct(productOverrides, taxId, currencyId);
1034
1011
  }
1012
+ /**
1013
+ * Creates a basic manufacturer without images or other special configuration.
1014
+ *
1015
+ * @param overrides - Specific data overrides that will be applied to the manufacturer data struct.
1016
+ */
1017
+ async createBasicManufacturer(overrides = {}) {
1018
+ const basicManufacturer = this.getBasicManufacturerStruct(overrides);
1019
+ const manufacturerResponse = await this.AdminApiClient.post("./product-manufacturer?_response=detail", {
1020
+ data: basicManufacturer
1021
+ });
1022
+ const { data: manufacturer } = await manufacturerResponse.json();
1023
+ this.addCreatedRecord("product-manufacturer", manufacturer.id);
1024
+ return manufacturer;
1025
+ }
1026
+ /**
1027
+ * Creates a basic manufacturer with one randomly generated image.
1028
+ *
1029
+ * @param overrides - Specific data overrides that will be applied to the manufacturer data struct.
1030
+ */
1031
+ async createManufacturerWithImage(overrides = {}) {
1032
+ const manufacturer = await this.createBasicManufacturer(overrides);
1033
+ const media = await this.createMediaPNG();
1034
+ await this.assignManufacturerMedia(manufacturer.id, media.id);
1035
+ return manufacturer;
1036
+ }
1035
1037
  /**
1036
1038
  * Creates a basic product category to assign products to.
1037
1039
  *
@@ -1198,8 +1200,8 @@ class TestDataService {
1198
1200
  *
1199
1201
  * @param lineItems - Products that should be added to the order.
1200
1202
  * @param customer - The customer to which the order should be assigned.
1201
- * @param salesChannel - The sales channel in which the order should be created.
1202
1203
  * @param overrides - Specific data overrides that will be applied to the order data struct.
1204
+ * @param salesChannel - The sales channel in which the order should be created.
1203
1205
  */
1204
1206
  async createOrder(lineItems, customer, overrides = {}, salesChannel = this.defaultSalesChannel) {
1205
1207
  const orderStateMachine = await this.getOrderStateMachine();
@@ -1235,7 +1237,7 @@ class TestDataService {
1235
1237
  return order;
1236
1238
  }
1237
1239
  /**
1238
- * Creates a new promotion with a promotion code.
1240
+ * Creates a new promotion with a promotion code and only single discount option.
1239
1241
  *
1240
1242
  * @param overrides - Specific data overrides that will be applied to the promotion data struct.
1241
1243
  * @param salesChannelId - The uuid of the sales channel in which the promotion should be active.
@@ -1246,8 +1248,9 @@ class TestDataService {
1246
1248
  data: basicPromotion
1247
1249
  });
1248
1250
  const { data: promotion } = await promotionResponse.json();
1251
+ const promotionWithDiscount = await getPromotionWithDiscount(promotion.id, this.AdminApiClient);
1249
1252
  this.addCreatedRecord("promotion", promotion.id);
1250
- return promotion;
1253
+ return promotionWithDiscount;
1251
1254
  }
1252
1255
  /**
1253
1256
  * Assigns a media resource as the download of a digital product.
@@ -1289,6 +1292,34 @@ class TestDataService {
1289
1292
  const { data: productMedia } = await mediaResponse.json();
1290
1293
  return productMedia;
1291
1294
  }
1295
+ /**
1296
+ * Assigns a media resource to a manufacturer as a logo.
1297
+ *
1298
+ * @param manufacturerId - The uuid of the manufacturer.
1299
+ * @param mediaId - The uuid of the media resource.
1300
+ */
1301
+ async assignManufacturerMedia(manufacturerId, mediaId) {
1302
+ const mediaResponse = await this.AdminApiClient.patch(`product-manufacturer/${manufacturerId}?_response=basic`, {
1303
+ data: {
1304
+ mediaId
1305
+ }
1306
+ });
1307
+ const { data: manufacturerMedia } = await mediaResponse.json();
1308
+ return manufacturerMedia;
1309
+ }
1310
+ /**
1311
+ * Assigns a manufacturer to a product.
1312
+ *
1313
+ * @param manufacturerId - The uuid of the manufacturer.
1314
+ * @param productId - The uuid of the product.
1315
+ */
1316
+ async assignManufacturerProduct(manufacturerId, productId) {
1317
+ return await this.AdminApiClient.patch(`product/${productId}?_response=basic`, {
1318
+ data: {
1319
+ manufacturerId
1320
+ }
1321
+ });
1322
+ }
1292
1323
  /**
1293
1324
  * Assigns a product to a category.
1294
1325
  *
@@ -1643,6 +1674,21 @@ class TestDataService {
1643
1674
  }]
1644
1675
  };
1645
1676
  }
1677
+ getBasicManufacturerStruct(overrides = {}) {
1678
+ const { id: manufacturerId, uuid: manufacturerUuid } = this.IdProvider.getIdPair();
1679
+ const manufacturerName = `${this.namePrefix}Manufacturer-${manufacturerId}${this.nameSuffix}`;
1680
+ const description = `
1681
+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
1682
+ At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
1683
+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
1684
+ At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.`.trim();
1685
+ const basicManufacturer = {
1686
+ id: manufacturerUuid,
1687
+ name: manufacturerName,
1688
+ description
1689
+ };
1690
+ return Object.assign({}, basicManufacturer, overrides);
1691
+ }
1646
1692
  getBasicCategoryStruct(overrides = {}, parentId = this.defaultCategoryId) {
1647
1693
  const { id: categoryId, uuid: categoryUuid } = this.IdProvider.getIdPair();
1648
1694
  const categoryName = `${this.namePrefix}Category-${categoryId}${this.nameSuffix}`;
@@ -1695,18 +1741,84 @@ class TestDataService {
1695
1741
  };
1696
1742
  return Object.assign({}, basicCustomer, overrides);
1697
1743
  }
1744
+ getBasicOrderDeliveryStruct(deliveryState, shippingMethod, customerAddress) {
1745
+ const date = /* @__PURE__ */ new Date();
1746
+ const shippingDate = new Date(date);
1747
+ shippingDate.setDate(shippingDate.getDate() + 3);
1748
+ const shippingDateTime = this.convertDateTime(shippingDate);
1749
+ const shippingCosts = 8.99;
1750
+ return {
1751
+ stateId: deliveryState.id,
1752
+ shippingMethodId: shippingMethod.id,
1753
+ shippingOrderAddress: {
1754
+ id: customerAddress.id,
1755
+ salutationId: customerAddress.salutationId,
1756
+ firstName: customerAddress.firstName,
1757
+ lastName: customerAddress.lastName,
1758
+ street: customerAddress.street,
1759
+ zipcode: customerAddress.zipcode,
1760
+ city: customerAddress.city,
1761
+ countryId: customerAddress.countryId,
1762
+ phoneNumber: customerAddress.phoneNumber
1763
+ },
1764
+ shippingDateEarliest: shippingDateTime,
1765
+ shippingDateLatest: shippingDateTime,
1766
+ shippingCosts: {
1767
+ unitPrice: shippingCosts,
1768
+ totalPrice: shippingCosts,
1769
+ quantity: 1,
1770
+ calculatedTaxes: [
1771
+ {
1772
+ tax: 0,
1773
+ taxRate: 0,
1774
+ price: shippingCosts
1775
+ }
1776
+ ],
1777
+ taxRules: [
1778
+ {
1779
+ taxRate: 0,
1780
+ percentage: 100
1781
+ }
1782
+ ]
1783
+ }
1784
+ };
1785
+ }
1786
+ isProduct(item) {
1787
+ return item.productNumber !== void 0;
1788
+ }
1789
+ isPromotion(item) {
1790
+ return item.code !== void 0;
1791
+ }
1698
1792
  getBasicOrderStruct(lineItems, languageId, currency, paymentMethod, shippingMethod, orderState, deliveryState, transactionState, customer, customerAddress, salesChannelId = this.defaultSalesChannel.id, overrides = {}) {
1699
1793
  const date = /* @__PURE__ */ new Date();
1700
1794
  const orderDateTime = this.convertDateTime(date);
1701
- const shippingDate = new Date(date.getDate() + 3);
1702
- const shippingDateTime = this.convertDateTime(shippingDate);
1703
1795
  let totalPrice = 0;
1704
- const lineItemProducts = [];
1796
+ const orderLineItems = [];
1705
1797
  lineItems.forEach((lineItem) => {
1706
- lineItemProducts.push(this.getBasicProductLineItemStruct(lineItem));
1707
- totalPrice += lineItem.product.price[0].gross * (lineItem.quantity || 1);
1798
+ if (this.isProduct(lineItem.product)) {
1799
+ const product = lineItem.product;
1800
+ orderLineItems.push(this.getBasicProductLineItemStruct(lineItem));
1801
+ totalPrice += product.price[0].gross * (lineItem.quantity || 1);
1802
+ }
1803
+ if (this.isPromotion(lineItem.product)) {
1804
+ const promotion = lineItem.product;
1805
+ orderLineItems.push(this.getBasicPromotionLineItemStruct(lineItem));
1806
+ const promotionDiscountValue = promotion.discounts[0].value;
1807
+ const promotionDiscountType = promotion.discounts[0].type;
1808
+ if (promotionDiscountType === "absolute") {
1809
+ totalPrice -= (promotionDiscountValue || 10) * (lineItem.quantity || 1);
1810
+ } else if (promotionDiscountType === "percentage") {
1811
+ totalPrice -= promotionDiscountValue * totalPrice / 100 * (lineItem.quantity || 1);
1812
+ } else if (promotionDiscountType === "fixed_unit") {
1813
+ totalPrice = (promotionDiscountValue || 10) * (lineItem.quantity || 1);
1814
+ }
1815
+ }
1708
1816
  });
1709
- const shippingCosts = 8.99;
1817
+ const orderDelivery = this.getBasicOrderDeliveryStruct(deliveryState, shippingMethod, customerAddress);
1818
+ let shippingCosts = 0;
1819
+ if (orderDelivery.shippingCosts != null) {
1820
+ shippingCosts = orderDelivery.shippingCosts.totalPrice;
1821
+ }
1710
1822
  totalPrice += shippingCosts;
1711
1823
  const basicOrder = {
1712
1824
  orderNumber: this.IdProvider.getIdPair().id,
@@ -1764,44 +1876,8 @@ class TestDataService {
1764
1876
  percentage: 100
1765
1877
  }]
1766
1878
  },
1767
- lineItems: lineItemProducts,
1768
- deliveries: [
1769
- {
1770
- stateId: deliveryState.id,
1771
- shippingMethodId: shippingMethod.id,
1772
- shippingOrderAddress: {
1773
- id: customerAddress.id,
1774
- salutationId: customerAddress.salutationId,
1775
- firstName: customerAddress.firstName,
1776
- lastName: customerAddress.lastName,
1777
- street: customerAddress.street,
1778
- zipcode: customerAddress.zipcode,
1779
- city: customerAddress.city,
1780
- countryId: customerAddress.countryId,
1781
- phoneNumber: customerAddress.phoneNumber
1782
- },
1783
- shippingDateEarliest: shippingDateTime,
1784
- shippingDateLatest: shippingDateTime,
1785
- shippingCosts: {
1786
- unitPrice: shippingCosts,
1787
- totalPrice: shippingCosts,
1788
- quantity: 1,
1789
- calculatedTaxes: [
1790
- {
1791
- tax: 0,
1792
- taxRate: 0,
1793
- price: shippingCosts
1794
- }
1795
- ],
1796
- taxRules: [
1797
- {
1798
- taxRate: 0,
1799
- percentage: 100
1800
- }
1801
- ]
1802
- }
1803
- }
1804
- ],
1879
+ lineItems: orderLineItems,
1880
+ deliveries: [orderDelivery],
1805
1881
  transactions: [
1806
1882
  {
1807
1883
  paymentMethodId: paymentMethod.id,
@@ -1830,17 +1906,21 @@ class TestDataService {
1830
1906
  return Object.assign({}, basicOrder, overrides);
1831
1907
  }
1832
1908
  getBasicProductLineItemStruct(lineItem) {
1833
- const unitPrice = lineItem.product.price[0].gross || 10;
1909
+ if (!this.isProduct(lineItem.product)) {
1910
+ console.error("Error: Object is not of type Product");
1911
+ }
1912
+ const product = lineItem.product;
1913
+ const unitPrice = product.price[0].gross || 10;
1834
1914
  const totalPrice = unitPrice * (lineItem.quantity || 1);
1835
1915
  return {
1836
- productId: lineItem.product.id,
1837
- referencedId: lineItem.product.id,
1916
+ productId: product.id,
1917
+ referencedId: product.id,
1838
1918
  payload: {
1839
- productNumber: lineItem.product.productNumber
1919
+ productNumber: product.productNumber
1840
1920
  },
1841
- identifier: lineItem.product.id,
1921
+ identifier: product.id,
1842
1922
  type: "product",
1843
- label: lineItem.product.name,
1923
+ label: product.name,
1844
1924
  quantity: lineItem.quantity || 1,
1845
1925
  position: lineItem.position || 1,
1846
1926
  price: {
@@ -1871,6 +1951,47 @@ class TestDataService {
1871
1951
  }
1872
1952
  };
1873
1953
  }
1954
+ getBasicPromotionLineItemStruct(lineItem) {
1955
+ if (!this.isPromotion(lineItem.product)) {
1956
+ console.error("Error: Object is not of type Promotion");
1957
+ }
1958
+ const promotion = lineItem.product;
1959
+ const promotionDiscountValue = promotion.discounts[0].value;
1960
+ const promotionDiscountType = promotion.discounts[0].type;
1961
+ const promotionDiscountId = promotion.discounts[0].id;
1962
+ const unitPrice = -Math.abs(promotionDiscountValue || 10);
1963
+ const totalPrice = unitPrice * (lineItem.quantity || 1);
1964
+ return {
1965
+ payload: {
1966
+ code: promotion.code
1967
+ },
1968
+ identifier: promotionDiscountId,
1969
+ type: "promotion",
1970
+ label: promotion.name,
1971
+ description: promotion.name,
1972
+ quantity: lineItem.quantity || 1,
1973
+ position: lineItem.position || 1,
1974
+ price: {
1975
+ unitPrice,
1976
+ totalPrice,
1977
+ quantity: lineItem.quantity,
1978
+ calculatedTaxes: [{
1979
+ tax: 0,
1980
+ taxRate: 0,
1981
+ price: totalPrice
1982
+ }],
1983
+ taxRules: [{
1984
+ taxRate: 0,
1985
+ percentage: 100
1986
+ }]
1987
+ },
1988
+ priceDefinition: {
1989
+ type: promotionDiscountType,
1990
+ price: totalPrice,
1991
+ percentage: promotionDiscountType === "percentage" ? promotionDiscountValue : null
1992
+ }
1993
+ };
1994
+ }
1874
1995
  getBasicPromotionStruct(salesChannelId = this.defaultSalesChannel.id, overrides = {}) {
1875
1996
  const promotionCode = `${this.IdProvider.getIdPair().id}`;
1876
1997
  const promotionName = `${this.namePrefix}Promotion-${promotionCode}${this.nameSuffix}`;
@@ -3657,6 +3778,7 @@ const ValidateAccessibility = test$d.extend({
3657
3778
  const task = (pageName, assertViolations = true, createReport = true, ruleTags = ["wcag2a", "wcag2aa", "wcag2aaa", "wcag21a", "wcag21aa", "best-practice"], outputDir = "test-results/AccessibilityReports") => {
3658
3779
  return async function ValidateAccessibility2() {
3659
3780
  const axeBuilder = new AxeBuilder({ page: ShopCustomer.page });
3781
+ axeBuilder.exclude(".sf-toolbar");
3660
3782
  const accessibilityResults = await axeBuilder.withTags(ruleTags).analyze();
3661
3783
  if (createReport) {
3662
3784
  createHtmlReport({
@@ -3668,9 +3790,12 @@ const ValidateAccessibility = test$d.extend({
3668
3790
  }
3669
3791
  });
3670
3792
  }
3671
- if (assertViolations) {
3793
+ if (typeof assertViolations === "number") {
3794
+ ShopCustomer.expects(accessibilityResults.violations.length).toBeLessThanOrEqual(assertViolations);
3795
+ } else if (assertViolations) {
3672
3796
  ShopCustomer.expects(accessibilityResults.violations).toEqual([]);
3673
3797
  }
3798
+ return accessibilityResults.violations;
3674
3799
  };
3675
3800
  };
3676
3801
  await use(task);
@@ -3710,4 +3835,4 @@ const test = mergeTests(
3710
3835
  test$1
3711
3836
  );
3712
3837
 
3713
- export { AdminPageObjects, StorefrontPageObjects, TestDataService, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, isSaaSInstance, isThemeCompiled, setOrderStatus, test };
3838
+ export { AdminPageObjects, StorefrontPageObjects, TestDataService, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getPromotionWithDiscount, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, isSaaSInstance, isThemeCompiled, setOrderStatus, test };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware-ag/acceptance-test-suite",
3
- "version": "2.4.0",
3
+ "version": "2.6.0",
4
4
  "description": "Shopware Acceptance Test Suite",
5
5
  "author": "shopware AG",
6
6
  "license": "MIT",