@shopware-ag/acceptance-test-suite 2.4.0 → 2.5.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
@@ -1,3 +1,4 @@
1
+ import * as axe_core from 'axe-core';
1
2
  import * as _playwright_test from '@playwright/test';
2
3
  import { APIRequestContext, APIResponse, Page, Locator } from '@playwright/test';
3
4
  export * from '@playwright/test';
@@ -194,6 +195,9 @@ type Product = Omit<components['schemas']['Product'], 'price' | 'prices'> & {
194
195
  name: string;
195
196
  };
196
197
  };
198
+ type Manufacturer = components['schemas']['ProductManufacturer'] & {
199
+ id: string;
200
+ };
197
201
  type PropertyGroup = components['schemas']['PropertyGroup'] & {
198
202
  id: string;
199
203
  };
@@ -338,6 +342,18 @@ declare class TestDataService {
338
342
  * @param currencyId - The uuid of the currency to use for the product pricing.
339
343
  */
340
344
  createProductWithPriceRange(overrides?: Partial<Product>, taxId?: string, currencyId?: string): Promise<Product>;
345
+ /**
346
+ * Creates a basic manufacturer without images or other special configuration.
347
+ *
348
+ * @param overrides - Specific data overrides that will be applied to the manufacturer data struct.
349
+ */
350
+ createBasicManufacturer(overrides?: Partial<Manufacturer>): Promise<Manufacturer>;
351
+ /**
352
+ * Creates a basic manufacturer with one randomly generated image.
353
+ *
354
+ * @param overrides - Specific data overrides that will be applied to the manufacturer data struct.
355
+ */
356
+ createManufacturerWithImage(overrides?: Partial<Manufacturer>): Promise<Manufacturer>;
341
357
  /**
342
358
  * Creates a basic product category to assign products to.
343
359
  *
@@ -419,6 +435,20 @@ declare class TestDataService {
419
435
  * @param mediaId - The uuid of the media resource.
420
436
  */
421
437
  assignProductMedia(productId: string, mediaId: string): Promise<any>;
438
+ /**
439
+ * Assigns a media resource to a manufacturer as a logo.
440
+ *
441
+ * @param manufacturerId - The uuid of the manufacturer.
442
+ * @param mediaId - The uuid of the media resource.
443
+ */
444
+ assignManufacturerMedia(manufacturerId: string, mediaId: string): Promise<any>;
445
+ /**
446
+ * Assigns a manufacturer to a product.
447
+ *
448
+ * @param manufacturerId - The uuid of the manufacturer.
449
+ * @param productId - The uuid of the product.
450
+ */
451
+ assignManufacturerProduct(manufacturerId: string, productId: string): Promise<playwright_core.APIResponse>;
422
452
  /**
423
453
  * Assigns a product to a category.
424
454
  *
@@ -521,6 +551,7 @@ declare class TestDataService {
521
551
  convertDateTime(date: Date): string;
522
552
  getBasicProductStruct(taxId?: string, currencyId?: string, overrides?: Partial<Product>): Partial<Product>;
523
553
  getProductPriceRangeStruct(currencyId: string, ruleId: string): Partial<Product>;
554
+ getBasicManufacturerStruct(overrides?: Partial<Manufacturer>): Partial<Manufacturer>;
524
555
  getBasicCategoryStruct(overrides?: Partial<Category$1>, parentId?: string): {
525
556
  id: string;
526
557
  name: string;
@@ -1115,7 +1146,7 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
1115
1146
  } & {
1116
1147
  OpenSearchSuggestPage: Task;
1117
1148
  } & {
1118
- ValidateAccessibility: (pageName: string, assertViolations?: boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<void>;
1149
+ ValidateAccessibility: (pageName: string, assertViolations?: number | boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<axe_core.Result[]>;
1119
1150
  }, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & FixtureTypes>;
1120
1151
 
1121
- export { AdminPageObjects, type Category$1 as Category, type CreatedRecord, type Currency$1 as Currency, type Customer, type CustomerAddress, type DataServiceOptions, type FixtureTypes, type Media, type Order, type PageObject, type PaymentMethod, type Price, type Product, type ProductPrice, type Promotion, type PropertyGroup, type Rule, type SalesChannel, type Salutation, type ShippingMethod, type SimpleLineItem, type StateMachine, type StateMachineState, StorefrontPageObjects, type SyncApiOperation, type Tag, type Task, TestDataService, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, isSaaSInstance, isThemeCompiled, setOrderStatus, test };
1152
+ export { AdminPageObjects, 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 PageObject, type PaymentMethod, type Price, type Product, type ProductPrice, type Promotion, type PropertyGroup, type Rule, type SalesChannel, type Salutation, type ShippingMethod, type SimpleLineItem, type StateMachine, type StateMachineState, StorefrontPageObjects, type SyncApiOperation, type Tag, type Task, TestDataService, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, isSaaSInstance, isThemeCompiled, setOrderStatus, test };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as axe_core from 'axe-core';
1
2
  import * as _playwright_test from '@playwright/test';
2
3
  import { APIRequestContext, APIResponse, Page, Locator } from '@playwright/test';
3
4
  export * from '@playwright/test';
@@ -194,6 +195,9 @@ type Product = Omit<components['schemas']['Product'], 'price' | 'prices'> & {
194
195
  name: string;
195
196
  };
196
197
  };
198
+ type Manufacturer = components['schemas']['ProductManufacturer'] & {
199
+ id: string;
200
+ };
197
201
  type PropertyGroup = components['schemas']['PropertyGroup'] & {
198
202
  id: string;
199
203
  };
@@ -338,6 +342,18 @@ declare class TestDataService {
338
342
  * @param currencyId - The uuid of the currency to use for the product pricing.
339
343
  */
340
344
  createProductWithPriceRange(overrides?: Partial<Product>, taxId?: string, currencyId?: string): Promise<Product>;
345
+ /**
346
+ * Creates a basic manufacturer without images or other special configuration.
347
+ *
348
+ * @param overrides - Specific data overrides that will be applied to the manufacturer data struct.
349
+ */
350
+ createBasicManufacturer(overrides?: Partial<Manufacturer>): Promise<Manufacturer>;
351
+ /**
352
+ * Creates a basic manufacturer with one randomly generated image.
353
+ *
354
+ * @param overrides - Specific data overrides that will be applied to the manufacturer data struct.
355
+ */
356
+ createManufacturerWithImage(overrides?: Partial<Manufacturer>): Promise<Manufacturer>;
341
357
  /**
342
358
  * Creates a basic product category to assign products to.
343
359
  *
@@ -419,6 +435,20 @@ declare class TestDataService {
419
435
  * @param mediaId - The uuid of the media resource.
420
436
  */
421
437
  assignProductMedia(productId: string, mediaId: string): Promise<any>;
438
+ /**
439
+ * Assigns a media resource to a manufacturer as a logo.
440
+ *
441
+ * @param manufacturerId - The uuid of the manufacturer.
442
+ * @param mediaId - The uuid of the media resource.
443
+ */
444
+ assignManufacturerMedia(manufacturerId: string, mediaId: string): Promise<any>;
445
+ /**
446
+ * Assigns a manufacturer to a product.
447
+ *
448
+ * @param manufacturerId - The uuid of the manufacturer.
449
+ * @param productId - The uuid of the product.
450
+ */
451
+ assignManufacturerProduct(manufacturerId: string, productId: string): Promise<playwright_core.APIResponse>;
422
452
  /**
423
453
  * Assigns a product to a category.
424
454
  *
@@ -521,6 +551,7 @@ declare class TestDataService {
521
551
  convertDateTime(date: Date): string;
522
552
  getBasicProductStruct(taxId?: string, currencyId?: string, overrides?: Partial<Product>): Partial<Product>;
523
553
  getProductPriceRangeStruct(currencyId: string, ruleId: string): Partial<Product>;
554
+ getBasicManufacturerStruct(overrides?: Partial<Manufacturer>): Partial<Manufacturer>;
524
555
  getBasicCategoryStruct(overrides?: Partial<Category$1>, parentId?: string): {
525
556
  id: string;
526
557
  name: string;
@@ -1115,7 +1146,7 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
1115
1146
  } & {
1116
1147
  OpenSearchSuggestPage: Task;
1117
1148
  } & {
1118
- ValidateAccessibility: (pageName: string, assertViolations?: boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<void>;
1149
+ ValidateAccessibility: (pageName: string, assertViolations?: number | boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<axe_core.Result[]>;
1119
1150
  }, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & FixtureTypes>;
1120
1151
 
1121
- export { AdminPageObjects, type Category$1 as Category, type CreatedRecord, type Currency$1 as Currency, type Customer, type CustomerAddress, type DataServiceOptions, type FixtureTypes, type Media, type Order, type PageObject, type PaymentMethod, type Price, type Product, type ProductPrice, type Promotion, type PropertyGroup, type Rule, type SalesChannel, type Salutation, type ShippingMethod, type SimpleLineItem, type StateMachine, type StateMachineState, StorefrontPageObjects, type SyncApiOperation, type Tag, type Task, TestDataService, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, isSaaSInstance, isThemeCompiled, setOrderStatus, test };
1152
+ export { AdminPageObjects, 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 PageObject, type PaymentMethod, type Price, type Product, type ProductPrice, type Promotion, type PropertyGroup, type Rule, type SalesChannel, type Salutation, type ShippingMethod, type SimpleLineItem, type StateMachine, type StateMachineState, StorefrontPageObjects, type SyncApiOperation, type Tag, type Task, TestDataService, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, isSaaSInstance, isThemeCompiled, setOrderStatus, test };
package/dist/index.mjs CHANGED
@@ -1032,6 +1032,31 @@ class TestDataService {
1032
1032
  const productOverrides = Object.assign({}, priceRange, overrides);
1033
1033
  return this.createBasicProduct(productOverrides, taxId, currencyId);
1034
1034
  }
1035
+ /**
1036
+ * Creates a basic manufacturer without images or other special configuration.
1037
+ *
1038
+ * @param overrides - Specific data overrides that will be applied to the manufacturer data struct.
1039
+ */
1040
+ async createBasicManufacturer(overrides = {}) {
1041
+ const basicManufacturer = this.getBasicManufacturerStruct(overrides);
1042
+ const manufacturerResponse = await this.AdminApiClient.post("./product-manufacturer?_response=detail", {
1043
+ data: basicManufacturer
1044
+ });
1045
+ const { data: manufacturer } = await manufacturerResponse.json();
1046
+ this.addCreatedRecord("product-manufacturer", manufacturer.id);
1047
+ return manufacturer;
1048
+ }
1049
+ /**
1050
+ * Creates a basic manufacturer with one randomly generated image.
1051
+ *
1052
+ * @param overrides - Specific data overrides that will be applied to the manufacturer data struct.
1053
+ */
1054
+ async createManufacturerWithImage(overrides = {}) {
1055
+ const manufacturer = await this.createBasicManufacturer(overrides);
1056
+ const media = await this.createMediaPNG();
1057
+ await this.assignManufacturerMedia(manufacturer.id, media.id);
1058
+ return manufacturer;
1059
+ }
1035
1060
  /**
1036
1061
  * Creates a basic product category to assign products to.
1037
1062
  *
@@ -1289,6 +1314,34 @@ class TestDataService {
1289
1314
  const { data: productMedia } = await mediaResponse.json();
1290
1315
  return productMedia;
1291
1316
  }
1317
+ /**
1318
+ * Assigns a media resource to a manufacturer as a logo.
1319
+ *
1320
+ * @param manufacturerId - The uuid of the manufacturer.
1321
+ * @param mediaId - The uuid of the media resource.
1322
+ */
1323
+ async assignManufacturerMedia(manufacturerId, mediaId) {
1324
+ const mediaResponse = await this.AdminApiClient.patch(`product-manufacturer/${manufacturerId}?_response=basic`, {
1325
+ data: {
1326
+ mediaId
1327
+ }
1328
+ });
1329
+ const { data: manufacturerMedia } = await mediaResponse.json();
1330
+ return manufacturerMedia;
1331
+ }
1332
+ /**
1333
+ * Assigns a manufacturer to a product.
1334
+ *
1335
+ * @param manufacturerId - The uuid of the manufacturer.
1336
+ * @param productId - The uuid of the product.
1337
+ */
1338
+ async assignManufacturerProduct(manufacturerId, productId) {
1339
+ return await this.AdminApiClient.patch(`product/${productId}?_response=basic`, {
1340
+ data: {
1341
+ manufacturerId
1342
+ }
1343
+ });
1344
+ }
1292
1345
  /**
1293
1346
  * Assigns a product to a category.
1294
1347
  *
@@ -1643,6 +1696,21 @@ class TestDataService {
1643
1696
  }]
1644
1697
  };
1645
1698
  }
1699
+ getBasicManufacturerStruct(overrides = {}) {
1700
+ const { id: manufacturerId, uuid: manufacturerUuid } = this.IdProvider.getIdPair();
1701
+ const manufacturerName = `${this.namePrefix}Manufacturer-${manufacturerId}${this.nameSuffix}`;
1702
+ const description = `
1703
+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
1704
+ 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.
1705
+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
1706
+ 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();
1707
+ const basicManufacturer = {
1708
+ id: manufacturerUuid,
1709
+ name: manufacturerName,
1710
+ description
1711
+ };
1712
+ return Object.assign({}, basicManufacturer, overrides);
1713
+ }
1646
1714
  getBasicCategoryStruct(overrides = {}, parentId = this.defaultCategoryId) {
1647
1715
  const { id: categoryId, uuid: categoryUuid } = this.IdProvider.getIdPair();
1648
1716
  const categoryName = `${this.namePrefix}Category-${categoryId}${this.nameSuffix}`;
@@ -3657,6 +3725,7 @@ const ValidateAccessibility = test$d.extend({
3657
3725
  const task = (pageName, assertViolations = true, createReport = true, ruleTags = ["wcag2a", "wcag2aa", "wcag2aaa", "wcag21a", "wcag21aa", "best-practice"], outputDir = "test-results/AccessibilityReports") => {
3658
3726
  return async function ValidateAccessibility2() {
3659
3727
  const axeBuilder = new AxeBuilder({ page: ShopCustomer.page });
3728
+ axeBuilder.exclude(".sf-toolbar");
3660
3729
  const accessibilityResults = await axeBuilder.withTags(ruleTags).analyze();
3661
3730
  if (createReport) {
3662
3731
  createHtmlReport({
@@ -3668,9 +3737,12 @@ const ValidateAccessibility = test$d.extend({
3668
3737
  }
3669
3738
  });
3670
3739
  }
3671
- if (assertViolations) {
3740
+ if (typeof assertViolations === "number") {
3741
+ ShopCustomer.expects(accessibilityResults.violations.length).toBeLessThanOrEqual(assertViolations);
3742
+ } else if (assertViolations) {
3672
3743
  ShopCustomer.expects(accessibilityResults.violations).toEqual([]);
3673
3744
  }
3745
+ return accessibilityResults.violations;
3674
3746
  };
3675
3747
  };
3676
3748
  await use(task);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware-ag/acceptance-test-suite",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "Shopware Acceptance Test Suite",
5
5
  "author": "shopware AG",
6
6
  "license": "MIT",