@shopware-ag/acceptance-test-suite 8.1.0 → 8.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -330,6 +330,9 @@ type CmsPage = components['schemas']['CmsPage'] & {
330
330
  type CustomerGroup = components['schemas']['CustomerGroup'] & {
331
331
  id: string;
332
332
  };
333
+ type SalesChannelAnalytics = components['schemas']['SalesChannelAnalytics'] & {
334
+ id: string;
335
+ };
333
336
  interface RegistrationData {
334
337
  salutation: string;
335
338
  firstName: string;
@@ -345,6 +348,10 @@ interface RegistrationData {
345
348
  vatRegNo: string;
346
349
  }
347
350
 
351
+ interface SalesChannelRecord {
352
+ salesChannelId: string;
353
+ field: string;
354
+ }
348
355
  interface CreatedRecord {
349
356
  resource: string;
350
357
  payload: Record<string, string>;
@@ -403,6 +410,12 @@ declare class TestDataService {
403
410
  * @private
404
411
  */
405
412
  private createdRecords;
413
+ /**
414
+ * A registry of all created sales channel records.
415
+ *
416
+ * @private
417
+ */
418
+ private createdSalesChannelRecords;
406
419
  constructor(AdminApiClient: AdminApiContext, IdProvider: IdProvider, options: DataServiceOptions);
407
420
  /**
408
421
  * Creates a basic product without images or other special configuration.
@@ -592,6 +605,12 @@ declare class TestDataService {
592
605
  * @param salesChannelId - Unique identity of sales channel.
593
606
  */
594
607
  createSystemConfigEntry(configurationKey: string, configurationValue?: {}, salesChannelId?: string): Promise<SystemConfig>;
608
+ /**
609
+ * Creates a random sales channel analytics entity
610
+ *
611
+ * @param overrides - Specific data overrides that will be applied to the sales channel analytics data struct.
612
+ */
613
+ createSalesChannelAnalytics(overrides?: Partial<SalesChannelAnalytics>): Promise<SalesChannelAnalytics>;
595
614
  /**
596
615
  * Assigns a media resource as the download of a digital product.
597
616
  *
@@ -658,6 +677,13 @@ declare class TestDataService {
658
677
  * @param currencyId - The uuid of the currency.
659
678
  */
660
679
  assignSalesChannelCurrency(salesChannelId: string, currencyId: string): Promise<any>;
680
+ /**
681
+ * Assigns a sales channel analytics entity to a sales channel.
682
+ *
683
+ * @param salesChannelId - The uuid of the sales channel.
684
+ * @param salesChannelAnalyticsId - The uuid of the sales channel analytics entity.
685
+ */
686
+ assignSalesChannelAnalytics(salesChannelId: string, salesChannelAnalyticsId: string): Promise<SalesChannel>;
661
687
  /**
662
688
  * Assigns a country to a sales channel.
663
689
  *
@@ -758,6 +784,14 @@ declare class TestDataService {
758
784
  * @param payload - You can pass a payload object for the delete operation or simply pass the uuid of the entity.
759
785
  */
760
786
  addCreatedRecord(resource: string, payload: string | Record<string, string>): void;
787
+ /**
788
+ * Adds a sales channel related property to the registry of created sales channel records.
789
+ * The property added to the registry will be overridden with null value by the cleanup call.
790
+ *
791
+ * @param salesChannelId - The sales channel id where the property pair is located
792
+ * @param field - The database field which has to be overridden
793
+ */
794
+ addCreatedSalesChannelRecord(salesChannelId: string, field: string): void;
761
795
  /**
762
796
  * Set the configuration of automated data clean up.
763
797
  * If set to "true" the data service will delete all entities created by it.
@@ -894,6 +928,7 @@ declare class TestDataService {
894
928
  getBasicPromotionStruct(salesChannelId?: string, overrides?: Partial<Promotion>): Partial<Promotion>;
895
929
  getBasicCmsStruct(cmsType: string, overrides: Partial<CmsPage>): Partial<CmsPage>;
896
930
  getBasicCustomerGroupStruct(overrides?: Partial<CustomerGroup>): Partial<CustomerGroup>;
931
+ getSalesChannelAnalyticsStruct(overrides?: Partial<SalesChannelAnalytics>): Partial<SalesChannelAnalytics>;
897
932
  clearCaches(): Promise<void>;
898
933
  }
899
934
 
@@ -2009,4 +2044,4 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
2009
2044
  ValidateAccessibility: (pageName: string, assertViolations?: number | boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<axe_core.Result[]>;
2010
2045
  }, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & FixtureTypes>;
2011
2046
 
2012
- export { AdminPageObjects, type CalculatedTaxes, type Category$1 as Category, type CmsPage, type Country, type CreatedRecord, type Currency$1 as Currency, type Customer, type CustomerAddress, type CustomerGroup, 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 RegistrationData, type Rule, type SalesChannel, type Salutation, type ShippingMethod, type SimpleLineItem, type StateMachine, type StateMachineState, StorefrontPageObjects, type SyncApiOperation, type SystemConfig, 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 };
2047
+ export { AdminPageObjects, type CalculatedTaxes, type Category$1 as Category, type CmsPage, type Country, type CreatedRecord, type Currency$1 as Currency, type Customer, type CustomerAddress, type CustomerGroup, 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 RegistrationData, type Rule, type SalesChannel, type SalesChannelAnalytics, type SalesChannelRecord, type Salutation, type ShippingMethod, type SimpleLineItem, type StateMachine, type StateMachineState, StorefrontPageObjects, type SyncApiOperation, type SystemConfig, 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
@@ -330,6 +330,9 @@ type CmsPage = components['schemas']['CmsPage'] & {
330
330
  type CustomerGroup = components['schemas']['CustomerGroup'] & {
331
331
  id: string;
332
332
  };
333
+ type SalesChannelAnalytics = components['schemas']['SalesChannelAnalytics'] & {
334
+ id: string;
335
+ };
333
336
  interface RegistrationData {
334
337
  salutation: string;
335
338
  firstName: string;
@@ -345,6 +348,10 @@ interface RegistrationData {
345
348
  vatRegNo: string;
346
349
  }
347
350
 
351
+ interface SalesChannelRecord {
352
+ salesChannelId: string;
353
+ field: string;
354
+ }
348
355
  interface CreatedRecord {
349
356
  resource: string;
350
357
  payload: Record<string, string>;
@@ -403,6 +410,12 @@ declare class TestDataService {
403
410
  * @private
404
411
  */
405
412
  private createdRecords;
413
+ /**
414
+ * A registry of all created sales channel records.
415
+ *
416
+ * @private
417
+ */
418
+ private createdSalesChannelRecords;
406
419
  constructor(AdminApiClient: AdminApiContext, IdProvider: IdProvider, options: DataServiceOptions);
407
420
  /**
408
421
  * Creates a basic product without images or other special configuration.
@@ -592,6 +605,12 @@ declare class TestDataService {
592
605
  * @param salesChannelId - Unique identity of sales channel.
593
606
  */
594
607
  createSystemConfigEntry(configurationKey: string, configurationValue?: {}, salesChannelId?: string): Promise<SystemConfig>;
608
+ /**
609
+ * Creates a random sales channel analytics entity
610
+ *
611
+ * @param overrides - Specific data overrides that will be applied to the sales channel analytics data struct.
612
+ */
613
+ createSalesChannelAnalytics(overrides?: Partial<SalesChannelAnalytics>): Promise<SalesChannelAnalytics>;
595
614
  /**
596
615
  * Assigns a media resource as the download of a digital product.
597
616
  *
@@ -658,6 +677,13 @@ declare class TestDataService {
658
677
  * @param currencyId - The uuid of the currency.
659
678
  */
660
679
  assignSalesChannelCurrency(salesChannelId: string, currencyId: string): Promise<any>;
680
+ /**
681
+ * Assigns a sales channel analytics entity to a sales channel.
682
+ *
683
+ * @param salesChannelId - The uuid of the sales channel.
684
+ * @param salesChannelAnalyticsId - The uuid of the sales channel analytics entity.
685
+ */
686
+ assignSalesChannelAnalytics(salesChannelId: string, salesChannelAnalyticsId: string): Promise<SalesChannel>;
661
687
  /**
662
688
  * Assigns a country to a sales channel.
663
689
  *
@@ -758,6 +784,14 @@ declare class TestDataService {
758
784
  * @param payload - You can pass a payload object for the delete operation or simply pass the uuid of the entity.
759
785
  */
760
786
  addCreatedRecord(resource: string, payload: string | Record<string, string>): void;
787
+ /**
788
+ * Adds a sales channel related property to the registry of created sales channel records.
789
+ * The property added to the registry will be overridden with null value by the cleanup call.
790
+ *
791
+ * @param salesChannelId - The sales channel id where the property pair is located
792
+ * @param field - The database field which has to be overridden
793
+ */
794
+ addCreatedSalesChannelRecord(salesChannelId: string, field: string): void;
761
795
  /**
762
796
  * Set the configuration of automated data clean up.
763
797
  * If set to "true" the data service will delete all entities created by it.
@@ -894,6 +928,7 @@ declare class TestDataService {
894
928
  getBasicPromotionStruct(salesChannelId?: string, overrides?: Partial<Promotion>): Partial<Promotion>;
895
929
  getBasicCmsStruct(cmsType: string, overrides: Partial<CmsPage>): Partial<CmsPage>;
896
930
  getBasicCustomerGroupStruct(overrides?: Partial<CustomerGroup>): Partial<CustomerGroup>;
931
+ getSalesChannelAnalyticsStruct(overrides?: Partial<SalesChannelAnalytics>): Partial<SalesChannelAnalytics>;
897
932
  clearCaches(): Promise<void>;
898
933
  }
899
934
 
@@ -2009,4 +2044,4 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
2009
2044
  ValidateAccessibility: (pageName: string, assertViolations?: number | boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<axe_core.Result[]>;
2010
2045
  }, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & FixtureTypes>;
2011
2046
 
2012
- export { AdminPageObjects, type CalculatedTaxes, type Category$1 as Category, type CmsPage, type Country, type CreatedRecord, type Currency$1 as Currency, type Customer, type CustomerAddress, type CustomerGroup, 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 RegistrationData, type Rule, type SalesChannel, type Salutation, type ShippingMethod, type SimpleLineItem, type StateMachine, type StateMachineState, StorefrontPageObjects, type SyncApiOperation, type SystemConfig, 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 };
2047
+ export { AdminPageObjects, type CalculatedTaxes, type Category$1 as Category, type CmsPage, type Country, type CreatedRecord, type Currency$1 as Currency, type Customer, type CustomerAddress, type CustomerGroup, 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 RegistrationData, type Rule, type SalesChannel, type SalesChannelAnalytics, type SalesChannelRecord, type Salutation, type ShippingMethod, type SimpleLineItem, type StateMachine, type StateMachineState, StorefrontPageObjects, type SyncApiOperation, type SystemConfig, 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
@@ -966,13 +966,19 @@ class TestDataService {
966
966
  *
967
967
  * @private
968
968
  */
969
- __publicField$L(this, "highPriorityEntities", ["order", "product", "landing_page"]);
969
+ __publicField$L(this, "highPriorityEntities", ["order", "product", "landing_page", "sales_channel_currency", "sales_channel_country"]);
970
970
  /**
971
971
  * A registry of all created records.
972
972
  *
973
973
  * @private
974
974
  */
975
975
  __publicField$L(this, "createdRecords", []);
976
+ /**
977
+ * A registry of all created sales channel records.
978
+ *
979
+ * @private
980
+ */
981
+ __publicField$L(this, "createdSalesChannelRecords", []);
976
982
  /**
977
983
  * Function that generates combinations from n number of arrays
978
984
  * with m number of elements in them.
@@ -1542,6 +1548,21 @@ class TestDataService {
1542
1548
  await this.clearCaches();
1543
1549
  return systemConfigEntry;
1544
1550
  }
1551
+ /**
1552
+ * Creates a random sales channel analytics entity
1553
+ *
1554
+ * @param overrides - Specific data overrides that will be applied to the sales channel analytics data struct.
1555
+ */
1556
+ async createSalesChannelAnalytics(overrides = {}) {
1557
+ const basicSalesChannelAnalyticsStruct = this.getSalesChannelAnalyticsStruct(overrides);
1558
+ const response = await this.AdminApiClient.post("sales-channel-analytics?_response=detail", {
1559
+ data: basicSalesChannelAnalyticsStruct
1560
+ });
1561
+ expect(response.ok()).toBeTruthy();
1562
+ const { data: salesChannelAnalytics } = await response.json();
1563
+ this.addCreatedRecord("sales_channel_analytics", salesChannelAnalytics.id);
1564
+ return salesChannelAnalytics;
1565
+ }
1545
1566
  /**
1546
1567
  * Assigns a media resource as the download of a digital product.
1547
1568
  *
@@ -1700,13 +1721,39 @@ class TestDataService {
1700
1721
  async assignSalesChannelCurrency(salesChannelId, currencyId) {
1701
1722
  const syncSalesChannelResponse = await this.AdminApiClient.post("./_action/sync", {
1702
1723
  data: {
1703
- "write-sales-channel": {
1704
- entity: "sales_channel",
1724
+ "write-sales-channel-currency": {
1725
+ entity: "sales_channel_currency",
1726
+ action: "upsert",
1727
+ payload: [
1728
+ {
1729
+ salesChannelId,
1730
+ currencyId
1731
+ }
1732
+ ]
1733
+ }
1734
+ }
1735
+ });
1736
+ expect(syncSalesChannelResponse.ok()).toBeTruthy();
1737
+ const { data: salesChannel } = await syncSalesChannelResponse.json();
1738
+ this.addCreatedRecord("sales_channel_currency", { salesChannelId, currencyId });
1739
+ return salesChannel;
1740
+ }
1741
+ /**
1742
+ * Assigns a sales channel analytics entity to a sales channel.
1743
+ *
1744
+ * @param salesChannelId - The uuid of the sales channel.
1745
+ * @param salesChannelAnalyticsId - The uuid of the sales channel analytics entity.
1746
+ */
1747
+ async assignSalesChannelAnalytics(salesChannelId, salesChannelAnalyticsId) {
1748
+ const syncSalesChannelResponse = await this.AdminApiClient.post("./_action/sync", {
1749
+ data: {
1750
+ "write-sales-channel-analytics": {
1751
+ entity: "sales_channel_analytics",
1705
1752
  action: "upsert",
1706
1753
  payload: [
1707
1754
  {
1708
- id: salesChannelId,
1709
- currencies: [{ id: currencyId }]
1755
+ salesChannel: { id: salesChannelId },
1756
+ id: salesChannelAnalyticsId
1710
1757
  }
1711
1758
  ]
1712
1759
  }
@@ -1714,6 +1761,7 @@ class TestDataService {
1714
1761
  });
1715
1762
  expect(syncSalesChannelResponse.ok()).toBeTruthy();
1716
1763
  const { data: salesChannel } = await syncSalesChannelResponse.json();
1764
+ this.addCreatedSalesChannelRecord(salesChannelId, "analyticsId");
1717
1765
  return salesChannel;
1718
1766
  }
1719
1767
  /**
@@ -1725,13 +1773,13 @@ class TestDataService {
1725
1773
  async assignSalesChannelCountry(salesChannelId, countryId) {
1726
1774
  const syncSalesChannelResponse = await this.AdminApiClient.post("./_action/sync", {
1727
1775
  data: {
1728
- "write-sales-channel": {
1729
- entity: "sales_channel",
1776
+ "write-sales-channel-country": {
1777
+ entity: "sales_channel_country",
1730
1778
  action: "upsert",
1731
1779
  payload: [
1732
1780
  {
1733
- id: salesChannelId,
1734
- countries: [{ id: countryId }]
1781
+ salesChannelId,
1782
+ countryId
1735
1783
  }
1736
1784
  ]
1737
1785
  }
@@ -1739,6 +1787,7 @@ class TestDataService {
1739
1787
  });
1740
1788
  expect(syncSalesChannelResponse.ok()).toBeTruthy();
1741
1789
  const { data: salesChannel } = await syncSalesChannelResponse.json();
1790
+ this.addCreatedRecord("sales_channel_country", { salesChannelId, countryId });
1742
1791
  return salesChannel;
1743
1792
  }
1744
1793
  /**
@@ -1994,6 +2043,16 @@ class TestDataService {
1994
2043
  this.createdRecords.push({ resource: res, payload });
1995
2044
  }
1996
2045
  }
2046
+ /**
2047
+ * Adds a sales channel related property to the registry of created sales channel records.
2048
+ * The property added to the registry will be overridden with null value by the cleanup call.
2049
+ *
2050
+ * @param salesChannelId - The sales channel id where the property pair is located
2051
+ * @param field - The database field which has to be overridden
2052
+ */
2053
+ addCreatedSalesChannelRecord(salesChannelId, field) {
2054
+ this.createdSalesChannelRecords.push({ salesChannelId, field });
2055
+ }
1997
2056
  /**
1998
2057
  * Set the configuration of automated data clean up.
1999
2058
  * If set to "true" the data service will delete all entities created by it.
@@ -2010,8 +2069,18 @@ class TestDataService {
2010
2069
  if (!this.shouldCleanUp) {
2011
2070
  return null;
2012
2071
  }
2013
- const priorityDeleteOperations = {};
2014
2072
  const deleteOperations = {};
2073
+ const priorityDeleteOperations = {};
2074
+ if (this.createdSalesChannelRecords) {
2075
+ for (const salesChannelRecord of this.createdSalesChannelRecords) {
2076
+ const salesChannelResponse = await this.AdminApiClient.patch(`sales-channel/${salesChannelRecord.salesChannelId}`, {
2077
+ data: {
2078
+ [salesChannelRecord.field]: null
2079
+ }
2080
+ });
2081
+ expect(salesChannelResponse.ok()).toBeTruthy();
2082
+ }
2083
+ }
2015
2084
  this.createdRecords.forEach((record) => {
2016
2085
  if (this.highPriorityEntities.includes(record.resource)) {
2017
2086
  if (!priorityDeleteOperations[`delete-${record.resource}`]) {
@@ -2652,6 +2721,18 @@ class TestDataService {
2652
2721
  };
2653
2722
  return Object.assign({}, basicCustomerGroup, overrides);
2654
2723
  }
2724
+ getSalesChannelAnalyticsStruct(overrides = {}) {
2725
+ const salesChannelAnalyticsUuid = this.IdProvider.getIdPair().uuid;
2726
+ const trackingId = this.IdProvider.getIdPair().id;
2727
+ const basicSalesChannelAnalyticsStruct = {
2728
+ id: salesChannelAnalyticsUuid,
2729
+ trackingId,
2730
+ active: true,
2731
+ trackOrders: false,
2732
+ anonymizeIp: true
2733
+ };
2734
+ return Object.assign({}, basicSalesChannelAnalyticsStruct, overrides);
2735
+ }
2655
2736
  async clearCaches() {
2656
2737
  await this.AdminApiClient.delete("_action/cache");
2657
2738
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware-ag/acceptance-test-suite",
3
- "version": "8.1.0",
3
+ "version": "8.2.0",
4
4
  "description": "Shopware Acceptance Test Suite",
5
5
  "author": "shopware AG",
6
6
  "license": "MIT",