@shopware-ag/acceptance-test-suite 3.6.1 → 3.7.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
@@ -191,13 +191,14 @@ interface ProductPrice {
191
191
  quantityStart: number;
192
192
  quantityEnd: number | null;
193
193
  }
194
- type Product = Omit<components['schemas']['Product'], 'price' | 'prices'> & {
194
+ type Product = Omit<components['schemas']['Product'], 'price' | 'prices' | 'options'> & {
195
195
  id: string;
196
196
  price: Price[];
197
197
  prices?: ProductPrice[];
198
198
  translated: {
199
199
  name: string;
200
200
  };
201
+ options?: Record<string, string>[];
201
202
  };
202
203
  type OrderDelivery = Omit<components['schemas']['OrderDelivery'], 'shippingOrderAddress' | 'shippingCosts'> & {
203
204
  id: string;
@@ -288,6 +289,9 @@ type PromotionDiscount = components['schemas']['PromotionDiscount'] & {
288
289
  type OrderLineItem = components['schemas']['OrderLineItem'] & {
289
290
  id: string;
290
291
  };
292
+ type PropertyGroupOption = components['schemas']['PropertyGroupOption'] & {
293
+ id: string;
294
+ };
291
295
 
292
296
  interface CreatedRecord {
293
297
  resource: string;
@@ -482,6 +486,18 @@ declare class TestDataService {
482
486
  * @param overrides - Specific data overrides that will be applied to the payment method data struct.
483
487
  */
484
488
  createPaymentMethodWithImage(overrides?: Partial<PaymentMethod>): Promise<PaymentMethod>;
489
+ /**
490
+ * Creates basic variant products based on property group.
491
+ *
492
+ * @param overrides - Specific data overrides that will be applied to the variant data struct.
493
+ */
494
+ createVariantProducts(parentProduct: Product, propertyGroups: PropertyGroup[], overrides?: Partial<Product>): Promise<Product[]>;
495
+ /**
496
+ * Function that generates combinations from n number of arrays
497
+ * with m number of elements in them.
498
+ * @param array
499
+ */
500
+ combineAll: (array: Record<string, string>[][]) => Record<string, string>[][];
485
501
  /**
486
502
  * Assigns a media resource to a payment method as a logo.
487
503
  *
@@ -592,6 +608,12 @@ declare class TestDataService {
592
608
  * @param stateName - The name of the state. Default is "open".
593
609
  */
594
610
  getStateMachineState(stateMachineId: string, stateName?: 'open' | 'completed' | 'in_progress' | 'cancelled'): Promise<StateMachineState>;
611
+ /**
612
+ * Retrieves all corresponding property group options.
613
+ *
614
+ * @param propertyGroupId - The uuid of the property group.
615
+ */
616
+ getPropertyGroupOptions(propertyGroupId: string): Promise<PropertyGroupOption[]>;
595
617
  /**
596
618
  * Adds an entity reference to the registry of created records.
597
619
  * All entities added to the registry will be deleted by the cleanup call.
@@ -806,6 +828,7 @@ declare class CheckoutCart implements PageObject {
806
828
  readonly cartQuantityNumber: Locator;
807
829
  constructor(page: Page);
808
830
  url(): string;
831
+ getLineItemByProductNumber(productNumber: string): Promise<Record<string, Locator>>;
809
832
  }
810
833
 
811
834
  declare class CheckoutConfirm implements PageObject {
@@ -1291,4 +1314,4 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
1291
1314
  ValidateAccessibility: (pageName: string, assertViolations?: number | boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<axe_core.Result[]>;
1292
1315
  }, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & FixtureTypes>;
1293
1316
 
1294
- 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 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 };
1317
+ 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 };
package/dist/index.d.ts CHANGED
@@ -191,13 +191,14 @@ interface ProductPrice {
191
191
  quantityStart: number;
192
192
  quantityEnd: number | null;
193
193
  }
194
- type Product = Omit<components['schemas']['Product'], 'price' | 'prices'> & {
194
+ type Product = Omit<components['schemas']['Product'], 'price' | 'prices' | 'options'> & {
195
195
  id: string;
196
196
  price: Price[];
197
197
  prices?: ProductPrice[];
198
198
  translated: {
199
199
  name: string;
200
200
  };
201
+ options?: Record<string, string>[];
201
202
  };
202
203
  type OrderDelivery = Omit<components['schemas']['OrderDelivery'], 'shippingOrderAddress' | 'shippingCosts'> & {
203
204
  id: string;
@@ -288,6 +289,9 @@ type PromotionDiscount = components['schemas']['PromotionDiscount'] & {
288
289
  type OrderLineItem = components['schemas']['OrderLineItem'] & {
289
290
  id: string;
290
291
  };
292
+ type PropertyGroupOption = components['schemas']['PropertyGroupOption'] & {
293
+ id: string;
294
+ };
291
295
 
292
296
  interface CreatedRecord {
293
297
  resource: string;
@@ -482,6 +486,18 @@ declare class TestDataService {
482
486
  * @param overrides - Specific data overrides that will be applied to the payment method data struct.
483
487
  */
484
488
  createPaymentMethodWithImage(overrides?: Partial<PaymentMethod>): Promise<PaymentMethod>;
489
+ /**
490
+ * Creates basic variant products based on property group.
491
+ *
492
+ * @param overrides - Specific data overrides that will be applied to the variant data struct.
493
+ */
494
+ createVariantProducts(parentProduct: Product, propertyGroups: PropertyGroup[], overrides?: Partial<Product>): Promise<Product[]>;
495
+ /**
496
+ * Function that generates combinations from n number of arrays
497
+ * with m number of elements in them.
498
+ * @param array
499
+ */
500
+ combineAll: (array: Record<string, string>[][]) => Record<string, string>[][];
485
501
  /**
486
502
  * Assigns a media resource to a payment method as a logo.
487
503
  *
@@ -592,6 +608,12 @@ declare class TestDataService {
592
608
  * @param stateName - The name of the state. Default is "open".
593
609
  */
594
610
  getStateMachineState(stateMachineId: string, stateName?: 'open' | 'completed' | 'in_progress' | 'cancelled'): Promise<StateMachineState>;
611
+ /**
612
+ * Retrieves all corresponding property group options.
613
+ *
614
+ * @param propertyGroupId - The uuid of the property group.
615
+ */
616
+ getPropertyGroupOptions(propertyGroupId: string): Promise<PropertyGroupOption[]>;
595
617
  /**
596
618
  * Adds an entity reference to the registry of created records.
597
619
  * All entities added to the registry will be deleted by the cleanup call.
@@ -806,6 +828,7 @@ declare class CheckoutCart implements PageObject {
806
828
  readonly cartQuantityNumber: Locator;
807
829
  constructor(page: Page);
808
830
  url(): string;
831
+ getLineItemByProductNumber(productNumber: string): Promise<Record<string, Locator>>;
809
832
  }
810
833
 
811
834
  declare class CheckoutConfirm implements PageObject {
@@ -1291,4 +1314,4 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
1291
1314
  ValidateAccessibility: (pageName: string, assertViolations?: number | boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<axe_core.Result[]>;
1292
1315
  }, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & FixtureTypes>;
1293
1316
 
1294
- 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 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 };
1317
+ 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 };
package/dist/index.mjs CHANGED
@@ -943,6 +943,27 @@ class TestDataService {
943
943
  * @private
944
944
  */
945
945
  __publicField$q(this, "createdRecords", []);
946
+ /**
947
+ * Function that generates combinations from n number of arrays
948
+ * with m number of elements in them.
949
+ * @param array
950
+ */
951
+ __publicField$q(this, "combineAll", (array) => {
952
+ const result = [];
953
+ const max = array.length - 1;
954
+ const helper = (tmpArray, i) => {
955
+ for (let j = 0, l = array[i].length; j < l; j++) {
956
+ const copy = tmpArray.slice(0);
957
+ copy.push(array[i][j]);
958
+ if (i == max)
959
+ result.push(copy);
960
+ else
961
+ helper(copy, i + 1);
962
+ }
963
+ };
964
+ helper([], 0);
965
+ return result;
966
+ });
946
967
  this.AdminApiClient = AdminApiClient;
947
968
  this.IdProvider = IdProvider;
948
969
  this.defaultSalesChannel = options.defaultSalesChannel;
@@ -1316,6 +1337,36 @@ class TestDataService {
1316
1337
  await this.assignPaymentMethodMedia(paymentMethod.id, media.id);
1317
1338
  return paymentMethod;
1318
1339
  }
1340
+ /**
1341
+ * Creates basic variant products based on property group.
1342
+ *
1343
+ * @param overrides - Specific data overrides that will be applied to the variant data struct.
1344
+ */
1345
+ async createVariantProducts(parentProduct, propertyGroups, overrides = {}) {
1346
+ const productVariantCandidates = [];
1347
+ for (const propertyGroup of propertyGroups) {
1348
+ const propertyGroupOptions = await this.getPropertyGroupOptions(propertyGroup.id);
1349
+ const propertyGroupOptionsCollection = [];
1350
+ for (const propertyGroupOption of propertyGroupOptions) {
1351
+ propertyGroupOptionsCollection.push({ id: propertyGroupOption.id });
1352
+ }
1353
+ productVariantCandidates.push(propertyGroupOptionsCollection);
1354
+ }
1355
+ const productVariantCombinations = this.combineAll(productVariantCandidates);
1356
+ const variantProducts = [];
1357
+ let index = 1;
1358
+ for (const productVariantCombination of productVariantCombinations) {
1359
+ const variantOverrides = {
1360
+ parentId: parentProduct.id,
1361
+ productNumber: parentProduct.productNumber + "." + index,
1362
+ options: productVariantCombination
1363
+ };
1364
+ const overrideCollection = Object.assign({}, overrides, variantOverrides);
1365
+ variantProducts.push(await this.createBasicProduct(overrideCollection));
1366
+ index++;
1367
+ }
1368
+ return variantProducts;
1369
+ }
1319
1370
  /**
1320
1371
  * Assigns a media resource to a payment method as a logo.
1321
1372
  *
@@ -1595,6 +1646,25 @@ class TestDataService {
1595
1646
  const { data: result } = await response.json();
1596
1647
  return result[0];
1597
1648
  }
1649
+ /**
1650
+ * Retrieves all corresponding property group options.
1651
+ *
1652
+ * @param propertyGroupId - The uuid of the property group.
1653
+ */
1654
+ async getPropertyGroupOptions(propertyGroupId) {
1655
+ const response = await this.AdminApiClient.post("search/property-group-option", {
1656
+ data: {
1657
+ limit: 50,
1658
+ filter: [{
1659
+ type: "equals",
1660
+ field: "groupId",
1661
+ value: propertyGroupId
1662
+ }]
1663
+ }
1664
+ });
1665
+ const { data: result } = await response.json();
1666
+ return result;
1667
+ }
1598
1668
  /**
1599
1669
  * Adds an entity reference to the registry of created records.
1600
1670
  * All entities added to the registry will be deleted by the cleanup call.
@@ -2284,7 +2354,7 @@ let ProductDetail$1 = class ProductDetail {
2284
2354
  this.quantitySelect = page.getByLabel("Quantity", { exact: true });
2285
2355
  this.productSingleImage = page.locator(".gallery-slider-single-image");
2286
2356
  this.productSinglePrice = page.locator(".product-detail-price");
2287
- this.productPriceRangesRow = page.locator(".product-block-prices-row > th");
2357
+ this.productPriceRangesRow = page.locator(".product-block-prices-row");
2288
2358
  this.offCanvas = page.locator("offcanvas-body");
2289
2359
  this.offCanvasCartTitle = page.getByText("Shopping cart", { exact: true });
2290
2360
  this.offCanvasCart = page.getByRole("dialog");
@@ -2353,6 +2423,31 @@ class CheckoutCart {
2353
2423
  url() {
2354
2424
  return "checkout/cart";
2355
2425
  }
2426
+ async getLineItemByProductNumber(productNumber) {
2427
+ const lineItem = this.page.locator(".line-item-product", { hasText: productNumber });
2428
+ const lineItemImage = lineItem.locator("line-item-img-container");
2429
+ const productNameLabel = lineItem.locator(".line-item-label");
2430
+ const productNumberLabel = lineItem.locator(".line-item-product-number");
2431
+ const productDeliveryDateLabel = lineItem.locator(".line-item-delivery-date");
2432
+ const productQuantityMinusButton = lineItem.locator(".btn-minus");
2433
+ const productQuantityPlusButton = lineItem.locator(".btn-plus");
2434
+ const productQuantityInput = lineItem.locator(".quantity-selector-group-input");
2435
+ const productUnitPriceValue = lineItem.locator(".line-item-unit-price-value");
2436
+ const productTotalPriceValue = lineItem.locator(".line-item-total-price-value");
2437
+ const removeButton = lineItem.locator(".line-item-remove-button");
2438
+ return {
2439
+ lineItemImage,
2440
+ productNameLabel,
2441
+ productNumberLabel,
2442
+ productDeliveryDateLabel,
2443
+ productQuantityMinusButton,
2444
+ productQuantityPlusButton,
2445
+ productQuantityInput,
2446
+ productUnitPriceValue,
2447
+ productTotalPriceValue,
2448
+ removeButton
2449
+ };
2450
+ }
2356
2451
  }
2357
2452
 
2358
2453
  var __defProp$k = Object.defineProperty;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware-ag/acceptance-test-suite",
3
- "version": "3.6.1",
3
+ "version": "3.7.0",
4
4
  "description": "Shopware Acceptance Test Suite",
5
5
  "author": "shopware AG",
6
6
  "license": "MIT",