@shopware-ag/acceptance-test-suite 3.2.0 → 3.3.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
@@ -470,6 +470,12 @@ declare class TestDataService {
470
470
  * @param overrides - Specific data overrides that will be applied to the payment method data struct.
471
471
  */
472
472
  createBasicPaymentMethod(overrides?: Partial<PaymentMethod>): Promise<PaymentMethod>;
473
+ /**
474
+ * Creates a new basic rule with the condition cart amount >= 1.
475
+ *
476
+ * @param overrides - Specific data overrides that will be applied to the payment method data struct.
477
+ */
478
+ createBasicRule(overrides?: Partial<Rule>): Promise<Rule>;
473
479
  /**
474
480
  * Creates a payment method with one randomly generated image.
475
481
  *
@@ -612,6 +618,7 @@ declare class TestDataService {
612
618
  */
613
619
  convertDateTime(date: Date): string;
614
620
  getBasicProductStruct(taxId?: string, currencyId?: string, overrides?: Partial<Product>): Partial<Product>;
621
+ getBasicRuleStruct(overrides?: Partial<Rule>, conditionType?: string, operator?: string, amount?: number): Partial<Rule>;
615
622
  getProductPriceRangeStruct(currencyId: string, ruleId: string): Partial<Product>;
616
623
  getBasicManufacturerStruct(overrides?: Partial<Manufacturer>): Partial<Manufacturer>;
617
624
  getBasicPaymentMethodStruct(overrides?: Partial<PaymentMethod>): {
package/dist/index.d.ts CHANGED
@@ -470,6 +470,12 @@ declare class TestDataService {
470
470
  * @param overrides - Specific data overrides that will be applied to the payment method data struct.
471
471
  */
472
472
  createBasicPaymentMethod(overrides?: Partial<PaymentMethod>): Promise<PaymentMethod>;
473
+ /**
474
+ * Creates a new basic rule with the condition cart amount >= 1.
475
+ *
476
+ * @param overrides - Specific data overrides that will be applied to the payment method data struct.
477
+ */
478
+ createBasicRule(overrides?: Partial<Rule>): Promise<Rule>;
473
479
  /**
474
480
  * Creates a payment method with one randomly generated image.
475
481
  *
@@ -612,6 +618,7 @@ declare class TestDataService {
612
618
  */
613
619
  convertDateTime(date: Date): string;
614
620
  getBasicProductStruct(taxId?: string, currencyId?: string, overrides?: Partial<Product>): Partial<Product>;
621
+ getBasicRuleStruct(overrides?: Partial<Rule>, conditionType?: string, operator?: string, amount?: number): Partial<Rule>;
615
622
  getProductPriceRangeStruct(currencyId: string, ruleId: string): Partial<Product>;
616
623
  getBasicManufacturerStruct(overrides?: Partial<Manufacturer>): Partial<Manufacturer>;
617
624
  getBasicPaymentMethodStruct(overrides?: Partial<PaymentMethod>): {
package/dist/index.mjs CHANGED
@@ -1291,6 +1291,20 @@ class TestDataService {
1291
1291
  this.addCreatedRecord("payment_method", paymentMethod.id);
1292
1292
  return paymentMethod;
1293
1293
  }
1294
+ /**
1295
+ * Creates a new basic rule with the condition cart amount >= 1.
1296
+ *
1297
+ * @param overrides - Specific data overrides that will be applied to the payment method data struct.
1298
+ */
1299
+ async createBasicRule(overrides = {}) {
1300
+ const basicRule = this.getBasicRuleStruct(overrides);
1301
+ const ruleResponse = await this.AdminApiClient.post("rule?_response=detail", {
1302
+ data: basicRule
1303
+ });
1304
+ const { data: rule } = await ruleResponse.json();
1305
+ this.addCreatedRecord("rule", rule.id);
1306
+ return rule;
1307
+ }
1294
1308
  /**
1295
1309
  * Creates a payment method with one randomly generated image.
1296
1310
  *
@@ -1704,6 +1718,41 @@ class TestDataService {
1704
1718
  }
1705
1719
  return Object.assign({}, basicProduct, overrides);
1706
1720
  }
1721
+ getBasicRuleStruct(overrides = {}, conditionType = "cartCartAmount", operator = ">=", amount = 1) {
1722
+ const { id: ruleId, uuid: ruleUuid } = this.IdProvider.getIdPair();
1723
+ const ruleName = `${this.namePrefix}Rule-${ruleId}${this.nameSuffix}`;
1724
+ const description = `
1725
+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
1726
+ 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.
1727
+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
1728
+ 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();
1729
+ const basicRuleStruct = {
1730
+ id: ruleUuid,
1731
+ name: ruleName,
1732
+ priority: 1,
1733
+ description,
1734
+ conditions: [
1735
+ {
1736
+ type: "orContainer",
1737
+ children: [
1738
+ {
1739
+ type: "andContainer",
1740
+ children: [
1741
+ {
1742
+ type: conditionType,
1743
+ value: {
1744
+ operator,
1745
+ amount
1746
+ }
1747
+ }
1748
+ ]
1749
+ }
1750
+ ]
1751
+ }
1752
+ ]
1753
+ };
1754
+ return Object.assign({}, basicRuleStruct, overrides);
1755
+ }
1707
1756
  getProductPriceRangeStruct(currencyId, ruleId) {
1708
1757
  const p = (gross, net) => [
1709
1758
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware-ag/acceptance-test-suite",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "description": "Shopware Acceptance Test Suite",
5
5
  "author": "shopware AG",
6
6
  "license": "MIT",