@shopware-ag/acceptance-test-suite 11.33.1 → 11.33.2

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
@@ -763,7 +763,7 @@ declare class TestDataService {
763
763
  * @param productId - The uuid of the product.
764
764
  * @param manufacturerId - The uuid of the manufacturer.
765
765
  */
766
- assignProductManufacturer(productId: string, manufacturerId: string): Promise<void>;
766
+ assignProductManufacturer(productId: string, manufacturerId: string): Promise<any>;
767
767
  /**
768
768
  * Assigns a country to a currency with default roundings of 2.
769
769
  *
@@ -778,14 +778,14 @@ declare class TestDataService {
778
778
  * @param productId - The uuid of the product.
779
779
  * @param categoryId - The uuid of the category.
780
780
  */
781
- assignProductCategory(productId: string, categoryId: string): Promise<playwright_core.APIResponse>;
781
+ assignProductCategory(productId: string, categoryId: string): Promise<any>;
782
782
  /**
783
783
  * Assigns a tag to a product.
784
784
  *
785
785
  * @param productId - The uuid of the product.
786
786
  * @param tagId - The uuid of the tag.
787
787
  */
788
- assignProductTag(productId: string, tagId: string): Promise<playwright_core.APIResponse>;
788
+ assignProductTag(productId: string, tagId: string): Promise<any>;
789
789
  /**
790
790
  * Assigns a media resource to a manufacturer as a logo.
791
791
  *
@@ -1011,6 +1011,14 @@ declare class TestDataService {
1011
1011
  * @param array
1012
1012
  */
1013
1013
  combineAll: (array: Record<string, string>[][]) => Record<string, string>[][];
1014
+ /**
1015
+ * Generates a random alphanumeric string of a specified length.
1016
+ * Ensures at least one numeric character is included.
1017
+ *
1018
+ * @param length - The desired length of the random string (default: 3)
1019
+ * @returns A random alphanumeric string containing at least one digit
1020
+ */
1021
+ generateRandomId(length?: number): string;
1014
1022
  /**
1015
1023
  * @deprecated Use `getCountry` instead.
1016
1024
  * Retrieves a country Id based on its iso2 code.
@@ -5438,7 +5446,7 @@ declare class CheckoutFinish implements PageObject {
5438
5446
  constructor(page: Page);
5439
5447
  url(): string;
5440
5448
  getOrderNumber(): Promise<string | null>;
5441
- getOrderId(): string | null;
5449
+ getOrderId(): string;
5442
5450
  }
5443
5451
 
5444
5452
  declare class CheckoutRegister implements PageObject {
package/dist/index.d.ts CHANGED
@@ -763,7 +763,7 @@ declare class TestDataService {
763
763
  * @param productId - The uuid of the product.
764
764
  * @param manufacturerId - The uuid of the manufacturer.
765
765
  */
766
- assignProductManufacturer(productId: string, manufacturerId: string): Promise<void>;
766
+ assignProductManufacturer(productId: string, manufacturerId: string): Promise<any>;
767
767
  /**
768
768
  * Assigns a country to a currency with default roundings of 2.
769
769
  *
@@ -778,14 +778,14 @@ declare class TestDataService {
778
778
  * @param productId - The uuid of the product.
779
779
  * @param categoryId - The uuid of the category.
780
780
  */
781
- assignProductCategory(productId: string, categoryId: string): Promise<playwright_core.APIResponse>;
781
+ assignProductCategory(productId: string, categoryId: string): Promise<any>;
782
782
  /**
783
783
  * Assigns a tag to a product.
784
784
  *
785
785
  * @param productId - The uuid of the product.
786
786
  * @param tagId - The uuid of the tag.
787
787
  */
788
- assignProductTag(productId: string, tagId: string): Promise<playwright_core.APIResponse>;
788
+ assignProductTag(productId: string, tagId: string): Promise<any>;
789
789
  /**
790
790
  * Assigns a media resource to a manufacturer as a logo.
791
791
  *
@@ -1011,6 +1011,14 @@ declare class TestDataService {
1011
1011
  * @param array
1012
1012
  */
1013
1013
  combineAll: (array: Record<string, string>[][]) => Record<string, string>[][];
1014
+ /**
1015
+ * Generates a random alphanumeric string of a specified length.
1016
+ * Ensures at least one numeric character is included.
1017
+ *
1018
+ * @param length - The desired length of the random string (default: 3)
1019
+ * @returns A random alphanumeric string containing at least one digit
1020
+ */
1021
+ generateRandomId(length?: number): string;
1014
1022
  /**
1015
1023
  * @deprecated Use `getCountry` instead.
1016
1024
  * Retrieves a country Id based on its iso2 code.
@@ -5438,7 +5446,7 @@ declare class CheckoutFinish implements PageObject {
5438
5446
  constructor(page: Page);
5439
5447
  url(): string;
5440
5448
  getOrderNumber(): Promise<string | null>;
5441
- getOrderId(): string | null;
5449
+ getOrderId(): string;
5442
5450
  }
5443
5451
 
5444
5452
  declare class CheckoutRegister implements PageObject {
package/dist/index.mjs CHANGED
@@ -4294,11 +4294,14 @@ class TestDataService {
4294
4294
  * @param manufacturerId - The uuid of the manufacturer.
4295
4295
  */
4296
4296
  async assignProductManufacturer(productId, manufacturerId) {
4297
- await this.AdminApiClient.patch(`product/${productId}?_response=basic`, {
4297
+ const assignProductManufacturerResponse = await this.AdminApiClient.patch(`product/${productId}?_response=basic`, {
4298
4298
  data: {
4299
4299
  manufacturerId
4300
4300
  }
4301
4301
  });
4302
+ expect(assignProductManufacturerResponse.ok()).toBeTruthy();
4303
+ const { data: productManufacturer } = await assignProductManufacturerResponse.json();
4304
+ return productManufacturer;
4302
4305
  }
4303
4306
  /**
4304
4307
  * Assigns a country to a currency with default roundings of 2.
@@ -4344,7 +4347,7 @@ class TestDataService {
4344
4347
  * @param categoryId - The uuid of the category.
4345
4348
  */
4346
4349
  async assignProductCategory(productId, categoryId) {
4347
- return await this.AdminApiClient.patch(`product/${productId}?_response=basic`, {
4350
+ const assignProductCategoryResponse = await this.AdminApiClient.patch(`product/${productId}?_response=basic`, {
4348
4351
  data: {
4349
4352
  categories: [
4350
4353
  {
@@ -4353,6 +4356,9 @@ class TestDataService {
4353
4356
  ]
4354
4357
  }
4355
4358
  });
4359
+ expect(assignProductCategoryResponse.ok()).toBeTruthy();
4360
+ const { data: productCategory } = await assignProductCategoryResponse.json();
4361
+ return productCategory;
4356
4362
  }
4357
4363
  /**
4358
4364
  * Assigns a tag to a product.
@@ -4361,7 +4367,7 @@ class TestDataService {
4361
4367
  * @param tagId - The uuid of the tag.
4362
4368
  */
4363
4369
  async assignProductTag(productId, tagId) {
4364
- return await this.AdminApiClient.patch(`product/${productId}?_response=basic`, {
4370
+ const assignProductTagResponse = await this.AdminApiClient.patch(`product/${productId}?_response=basic`, {
4365
4371
  data: {
4366
4372
  tags: [
4367
4373
  {
@@ -4370,6 +4376,9 @@ class TestDataService {
4370
4376
  ]
4371
4377
  }
4372
4378
  });
4379
+ expect(assignProductTagResponse.ok()).toBeTruthy();
4380
+ const { data: productTag } = await assignProductTagResponse.json();
4381
+ return productTag;
4373
4382
  }
4374
4383
  /**
4375
4384
  * Assigns a media resource to a manufacturer as a logo.
@@ -5052,6 +5061,27 @@ class TestDataService {
5052
5061
  helper([], 0);
5053
5062
  return result;
5054
5063
  };
5064
+ /**
5065
+ * Generates a random alphanumeric string of a specified length.
5066
+ * Ensures at least one numeric character is included.
5067
+ *
5068
+ * @param length - The desired length of the random string (default: 3)
5069
+ * @returns A random alphanumeric string containing at least one digit
5070
+ */
5071
+ generateRandomId(length = 3) {
5072
+ const LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
5073
+ const DIGITS = "0123456789";
5074
+ const ALL_CHARS = LETTERS + DIGITS;
5075
+ const chars = Array.from(
5076
+ { length },
5077
+ () => ALL_CHARS.charAt(Math.floor(Math.random() * ALL_CHARS.length))
5078
+ );
5079
+ if (!chars.some((char) => DIGITS.includes(char))) {
5080
+ const randomIndex = Math.floor(Math.random() * length);
5081
+ chars[randomIndex] = DIGITS.charAt(Math.floor(Math.random() * DIGITS.length));
5082
+ }
5083
+ return chars.join("");
5084
+ }
5055
5085
  /**
5056
5086
  * @deprecated Use `getCountry` instead.
5057
5087
  * Retrieves a country Id based on its iso2 code.
@@ -5087,8 +5117,8 @@ class TestDataService {
5087
5117
  const basicCountry = {
5088
5118
  id: countryUuid,
5089
5119
  name: "Country-" + countryId,
5090
- iso: "" + countryId.substring(0, 2),
5091
- iso3: "" + countryId.substring(0, 3),
5120
+ iso: this.generateRandomId(2),
5121
+ iso3: this.generateRandomId(3),
5092
5122
  active: true,
5093
5123
  shippingAvailable: true
5094
5124
  };
@@ -5100,7 +5130,7 @@ class TestDataService {
5100
5130
  id: currencyUuid,
5101
5131
  name: "Currency-" + currencyId,
5102
5132
  shortName: "CUR" + currencyId,
5103
- isoCode: "" + currencyId.substring(0, 3),
5133
+ isoCode: this.generateRandomId(3),
5104
5134
  symbol: "C$",
5105
5135
  factor: 2.4,
5106
5136
  itemRounding: {
@@ -6525,7 +6555,7 @@ class CheckoutFinish {
6525
6555
  const url = this.page.url();
6526
6556
  const [, searchString] = url.split("?");
6527
6557
  const params = new URLSearchParams(searchString);
6528
- return params.get("orderId");
6558
+ return params.get("orderId") ?? "";
6529
6559
  }
6530
6560
  }
6531
6561
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware-ag/acceptance-test-suite",
3
- "version": "11.33.1",
3
+ "version": "11.33.2",
4
4
  "description": "Shopware Acceptance Test Suite",
5
5
  "author": "shopware AG",
6
6
  "license": "MIT",