@shopware-ag/acceptance-test-suite 3.8.0 → 3.8.1

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
@@ -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.
@@ -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>;
@@ -1333,4 +1368,4 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
1333
1368
  ValidateAccessibility: (pageName: string, assertViolations?: number | boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<axe_core.Result[]>;
1334
1369
  }, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & FixtureTypes>;
1335
1370
 
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 };
1371
+ 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.
@@ -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>;
@@ -1333,4 +1368,4 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
1333
1368
  ValidateAccessibility: (pageName: string, assertViolations?: number | boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<axe_core.Result[]>;
1334
1369
  }, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & FixtureTypes>;
1335
1370
 
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 };
1371
+ 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
@@ -1340,6 +1340,8 @@ class TestDataService {
1340
1340
  /**
1341
1341
  * Creates basic variant products based on property group.
1342
1342
  *
1343
+ * @param parentProduct Parent product of the variants
1344
+ * @param propertyGroups Property group collection which contain options
1343
1345
  * @param overrides - Specific data overrides that will be applied to the variant data struct.
1344
1346
  */
1345
1347
  async createVariantProducts(parentProduct, propertyGroups, overrides = {}) {
@@ -1367,6 +1369,35 @@ class TestDataService {
1367
1369
  }
1368
1370
  return variantProducts;
1369
1371
  }
1372
+ /**
1373
+ * Creates a shipping method with one randomly generated image.
1374
+ *
1375
+ * @param overrides - Specific data overrides that will be applied to the shipping method data struct.
1376
+ */
1377
+ async createShippingMethodWithImage(overrides = {}) {
1378
+ const shippingMethod = await this.createBasicShippingMethod(overrides);
1379
+ const media = await this.createMediaPNG();
1380
+ await this.assignShippingMethodMedia(shippingMethod.id, media.id);
1381
+ return shippingMethod;
1382
+ }
1383
+ /**
1384
+ * Creates a new basic shipping method with random delivery time.
1385
+ *
1386
+ * @param overrides - Specific data overrides that will be applied to the shipping method data struct.
1387
+ */
1388
+ async createBasicShippingMethod(overrides = {}) {
1389
+ const deliveryTime = await this.getAllDeliveryTimeResources();
1390
+ const basicShippingMethod = this.getBasicShippingMethodStruct(
1391
+ deliveryTime[0].id,
1392
+ overrides
1393
+ );
1394
+ const shippingMethodResponse = await this.AdminApiClient.post("shipping-method?_response=detail", {
1395
+ data: basicShippingMethod
1396
+ });
1397
+ const { data: shippingMethod } = await shippingMethodResponse.json();
1398
+ this.addCreatedRecord("shipping_method", shippingMethod.id);
1399
+ return shippingMethod;
1400
+ }
1370
1401
  /**
1371
1402
  * Assigns a media resource to a payment method as a logo.
1372
1403
  *
@@ -1537,6 +1568,29 @@ class TestDataService {
1537
1568
  const { data: result } = await response.json();
1538
1569
  return result[0];
1539
1570
  }
1571
+ /**
1572
+ * Assigns a media resource to a shipping method as a logo.
1573
+ *
1574
+ * @param shippingMethodId - The uuid of the shipping method.
1575
+ * @param mediaId - The uuid of the media resource.
1576
+ */
1577
+ async assignShippingMethodMedia(shippingMethodId, mediaId) {
1578
+ const shippingMethodResponse = await this.AdminApiClient.patch(`shipping-method/${shippingMethodId}?_response=basic`, {
1579
+ data: {
1580
+ mediaId
1581
+ }
1582
+ });
1583
+ const { data: shippingMethodMedia } = await shippingMethodResponse.json();
1584
+ return shippingMethodMedia;
1585
+ }
1586
+ /**
1587
+ * Retrieves all delivery time resources.
1588
+ */
1589
+ async getAllDeliveryTimeResources() {
1590
+ const response = await this.AdminApiClient.get("delivery-time");
1591
+ const { data: deliveryTimeResources } = await response.json();
1592
+ return deliveryTimeResources;
1593
+ }
1540
1594
  /**
1541
1595
  * Retrieves a payment method by its name.
1542
1596
  *
@@ -1983,6 +2037,18 @@ class TestDataService {
1983
2037
  }
1984
2038
  };
1985
2039
  }
2040
+ getBasicShippingMethodStruct(deliveryTimeId, overrides = {}) {
2041
+ const { id: shippingMethodId, uuid: shippingMethodUuid } = this.IdProvider.getIdPair();
2042
+ const shippingMethodName = `${this.namePrefix}ShippingMethod-${shippingMethodId}${this.nameSuffix}`;
2043
+ const basicShippingMethod = {
2044
+ id: shippingMethodUuid,
2045
+ name: shippingMethodName,
2046
+ technicalName: shippingMethodName.toLowerCase(),
2047
+ deliveryTimeId,
2048
+ active: true
2049
+ };
2050
+ return Object.assign({}, basicShippingMethod, overrides);
2051
+ }
1986
2052
  isProduct(item) {
1987
2053
  return item.productNumber !== void 0;
1988
2054
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware-ag/acceptance-test-suite",
3
- "version": "3.8.0",
3
+ "version": "3.8.1",
4
4
  "description": "Shopware Acceptance Test Suite",
5
5
  "author": "shopware AG",
6
6
  "license": "MIT",