@shopware-ag/acceptance-test-suite 1.2.0 → 1.3.1

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
@@ -590,6 +590,8 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
590
590
  OpenSearchResultPage: Task;
591
591
  } & {
592
592
  OpenSearchSuggestPage: Task;
593
+ } & {
594
+ ValidateAccessibility: (pageName: string, assertViolations?: boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<void>;
593
595
  }, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & HelperFixtureTypes & FixtureTypes>;
594
596
 
595
597
  export { AdminPageObjects, type FixtureTypes, type PageObject, StorefrontPageObjects, type Task, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, test };
package/dist/index.d.ts CHANGED
@@ -590,6 +590,8 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
590
590
  OpenSearchResultPage: Task;
591
591
  } & {
592
592
  OpenSearchSuggestPage: Task;
593
+ } & {
594
+ ValidateAccessibility: (pageName: string, assertViolations?: boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<void>;
593
595
  }, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & HelperFixtureTypes & FixtureTypes>;
594
596
 
595
597
  export { AdminPageObjects, type FixtureTypes, type PageObject, StorefrontPageObjects, type Task, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, test };
package/dist/index.mjs CHANGED
@@ -4,6 +4,8 @@ import crypto, { createHash } from 'crypto';
4
4
  import { stringify } from 'uuid';
5
5
  import { Image } from 'image-js';
6
6
  import fs from 'fs';
7
+ import { AxeBuilder } from '@axe-core/playwright';
8
+ import { createHtmlReport } from 'axe-html-reporter';
7
9
 
8
10
  const getLanguageData = async (languageCode, adminApiContext) => {
9
11
  const resp = await adminApiContext.post("search/language", {
@@ -365,6 +367,7 @@ const test$a = test$c.extend({
365
367
  email: `customer_${id}@example.com`,
366
368
  password: "shopware",
367
369
  salutationId: salutations.data[0].id,
370
+ languageId: SalesChannelBaseConfig.enGBLanguageId,
368
371
  defaultShippingAddress: {
369
372
  firstName: `${id} admin`,
370
373
  lastName: `${id} admin`,
@@ -1657,48 +1660,7 @@ const CategoryData = test$c.extend({
1657
1660
  });
1658
1661
 
1659
1662
  const DigitalProductData = test$c.extend({
1660
- DigitalProductData: async ({ IdProvider, AdminApiContext, SalesChannelBaseConfig, DefaultSalesChannel }, use) => {
1661
- const { id: productId, uuid: productUuid } = IdProvider.getIdPair();
1662
- const productName = `Digital_Product_test_${productId}`;
1663
- const productResponse = await AdminApiContext.post("./product?_response", {
1664
- data: {
1665
- active: true,
1666
- stock: 10,
1667
- taxId: SalesChannelBaseConfig.taxId,
1668
- id: productUuid,
1669
- name: productName,
1670
- productNumber: "Product-" + productId,
1671
- price: [
1672
- {
1673
- currencyId: SalesChannelBaseConfig.eurCurrencyId,
1674
- gross: 10,
1675
- linked: false,
1676
- net: 8.4
1677
- }
1678
- ],
1679
- purchasePrices: [
1680
- {
1681
- currencyId: SalesChannelBaseConfig.eurCurrencyId,
1682
- gross: 8,
1683
- linked: false,
1684
- net: 6.7
1685
- }
1686
- ],
1687
- visibilities: [
1688
- {
1689
- salesChannelId: DefaultSalesChannel.salesChannel.id,
1690
- visibility: 30
1691
- }
1692
- ],
1693
- categories: [
1694
- {
1695
- id: DefaultSalesChannel.salesChannel.navigationCategoryId
1696
- }
1697
- ]
1698
- }
1699
- });
1700
- expect(productResponse.ok()).toBeTruthy();
1701
- const { data: productData } = await productResponse.json();
1663
+ DigitalProductData: async ({ ProductData, IdProvider, AdminApiContext }, use) => {
1702
1664
  const newMediaResource = await AdminApiContext.post("./media?_response", {
1703
1665
  data: {
1704
1666
  private: false
@@ -1718,41 +1680,37 @@ const DigitalProductData = test$c.extend({
1718
1680
  expect(newMediaUpload.ok()).toBeTruthy();
1719
1681
  const productDownloadResponse = await AdminApiContext.post(`./product-download?_response`, {
1720
1682
  data: {
1721
- productId: productData.id,
1683
+ productId: ProductData.id,
1722
1684
  mediaId: newMediaId
1723
1685
  }
1724
1686
  });
1725
1687
  expect(productDownloadResponse.ok()).toBeTruthy();
1726
1688
  const { data: productDownload } = await productDownloadResponse.json();
1727
1689
  const returnData = {
1728
- product: productData,
1690
+ product: ProductData,
1729
1691
  fileContent
1730
1692
  };
1731
1693
  await use(returnData);
1732
1694
  const orderSearchResponse = await AdminApiContext.post("./search/order", {
1733
1695
  data: {
1734
1696
  limit: 10,
1735
- filter: [
1736
- {
1737
- type: "equals",
1738
- field: "lineItems.productId",
1739
- value: productData.id
1740
- }
1741
- ]
1697
+ filter: [{
1698
+ type: "equals",
1699
+ field: "lineItems.productId",
1700
+ value: ProductData.id
1701
+ }]
1742
1702
  }
1743
1703
  });
1744
1704
  expect(orderSearchResponse.ok()).toBeTruthy();
1745
1705
  const { data: ordersWithDigitalProduct } = await orderSearchResponse.json();
1746
1706
  for (const order of ordersWithDigitalProduct) {
1747
1707
  const deleteOrderResponse = await AdminApiContext.delete(`./order/${order.id}`);
1748
- expect(deleteOrderResponse.ok()).toBeTruthy();
1708
+ expect(deleteOrderResponse.status()).toBeLessThan(500);
1749
1709
  }
1750
1710
  const unlinkMediaResponse = await AdminApiContext.delete(`./product-download/${productDownload.id}`);
1751
1711
  expect(unlinkMediaResponse.ok()).toBeTruthy();
1752
1712
  const cleanupMediaResponse = await AdminApiContext.delete(`./media/${newMediaId}`);
1753
1713
  expect(cleanupMediaResponse.ok()).toBeTruthy();
1754
- const cleanupResponse = await AdminApiContext.delete(`./product/${productUuid}`);
1755
- expect(cleanupResponse.ok()).toBeTruthy();
1756
1714
  }
1757
1715
  });
1758
1716
 
@@ -2143,7 +2101,7 @@ const OrderData = test$c.extend({
2143
2101
  const { data: order } = await orderResponse.json();
2144
2102
  await use(order);
2145
2103
  const cleanupResponse = await AdminApiContext.delete(`./order/${order.id}`);
2146
- expect(cleanupResponse.ok()).toBeTruthy();
2104
+ expect(cleanupResponse.status()).toBeLessThan(500);
2147
2105
  }
2148
2106
  });
2149
2107
 
@@ -2423,6 +2381,31 @@ const OpenSearchSuggestPage = test$c.extend({
2423
2381
  }
2424
2382
  });
2425
2383
 
2384
+ const ValidateAccessibility = test$c.extend({
2385
+ ValidateAccessibility: async ({ ShopCustomer }, use) => {
2386
+ const task = (pageName, assertViolations = true, createReport = true, ruleTags = ["wcag2a", "wcag2aa", "wcag2aaa", "wcag21a", "wcag21aa", "best-practice"], outputDir = "test-results/AccessibilityReports") => {
2387
+ return async function ValidateAccessibility2() {
2388
+ const axeBuilder = new AxeBuilder({ page: ShopCustomer.page });
2389
+ const accessibilityResults = await axeBuilder.withTags(ruleTags).analyze();
2390
+ if (createReport) {
2391
+ createHtmlReport({
2392
+ results: accessibilityResults,
2393
+ options: {
2394
+ projectKey: pageName,
2395
+ reportFileName: `${pageName.replace(/[^a-zA-Z]/g, "")}.html`,
2396
+ outputDir
2397
+ }
2398
+ });
2399
+ }
2400
+ if (assertViolations) {
2401
+ ShopCustomer.expects(accessibilityResults.violations).toEqual([]);
2402
+ }
2403
+ };
2404
+ };
2405
+ await use(task);
2406
+ }
2407
+ });
2408
+
2426
2409
  const test$1 = mergeTests(
2427
2410
  Login,
2428
2411
  Logout,
@@ -2438,7 +2421,8 @@ const test$1 = mergeTests(
2438
2421
  SelectExpressShippingOption,
2439
2422
  SubmitOrder,
2440
2423
  OpenSearchResultPage,
2441
- OpenSearchSuggestPage
2424
+ OpenSearchSuggestPage,
2425
+ ValidateAccessibility
2442
2426
  );
2443
2427
 
2444
2428
  const test = mergeTests(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware-ag/acceptance-test-suite",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "Shopware Acceptance Test Suite",
5
5
  "author": "shopware AG",
6
6
  "license": "MIT",
@@ -38,6 +38,8 @@
38
38
  "dependencies": {
39
39
  "@playwright/test": "1.44.0",
40
40
  "@shopware/api-client": "0.5.0",
41
+ "@axe-core/playwright": "4.9.1",
42
+ "axe-html-reporter": "2.2.3",
41
43
  "image-js": "0.35.5",
42
44
  "uuid": "9.0.1"
43
45
  },