@shopware-ag/acceptance-test-suite 1.2.0 → 1.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
@@ -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", {
@@ -2423,6 +2425,31 @@ const OpenSearchSuggestPage = test$c.extend({
2423
2425
  }
2424
2426
  });
2425
2427
 
2428
+ const ValidateAccessibility = test$c.extend({
2429
+ ValidateAccessibility: async ({ ShopCustomer }, use) => {
2430
+ const task = (pageName, assertViolations = true, createReport = true, ruleTags = ["wcag2a", "wcag2aa", "wcag2aaa", "wcag21a", "wcag21aa", "best-practice"], outputDir = "test-results/AccessibilityReports") => {
2431
+ return async function ValidateAccessibility2() {
2432
+ const axeBuilder = new AxeBuilder({ page: ShopCustomer.page });
2433
+ const accessibilityResults = await axeBuilder.withTags(ruleTags).analyze();
2434
+ if (createReport) {
2435
+ createHtmlReport({
2436
+ results: accessibilityResults,
2437
+ options: {
2438
+ projectKey: pageName,
2439
+ reportFileName: `${pageName.replace(/[^a-zA-Z]/g, "")}.html`,
2440
+ outputDir
2441
+ }
2442
+ });
2443
+ }
2444
+ if (assertViolations) {
2445
+ ShopCustomer.expects(accessibilityResults.violations).toEqual([]);
2446
+ }
2447
+ };
2448
+ };
2449
+ await use(task);
2450
+ }
2451
+ });
2452
+
2426
2453
  const test$1 = mergeTests(
2427
2454
  Login,
2428
2455
  Logout,
@@ -2438,7 +2465,8 @@ const test$1 = mergeTests(
2438
2465
  SelectExpressShippingOption,
2439
2466
  SubmitOrder,
2440
2467
  OpenSearchResultPage,
2441
- OpenSearchSuggestPage
2468
+ OpenSearchSuggestPage,
2469
+ ValidateAccessibility
2442
2470
  );
2443
2471
 
2444
2472
  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.0",
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
  },