@grafana/plugin-e2e 3.4.3 → 3.4.5-canary.2523.22899282924.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.
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var AxeBuilder = require('@axe-core/playwright');
4
-
5
3
  const DEFAULT_A11Y_TAGS = [
6
4
  "wcag2a",
7
5
  "wcag2aa",
@@ -9,9 +7,18 @@ const DEFAULT_A11Y_TAGS = [
9
7
  "wcag21aa"
10
8
  /* 'best-practice' */
11
9
  ];
10
+ let AxeBuilder;
12
11
  const scanForA11yViolations = async ({ page }, use, testInfo) => {
13
12
  let inc = 1;
14
13
  await use(async (context) => {
14
+ if (!AxeBuilder) {
15
+ try {
16
+ const { AxeBuilder: _AxeBuilder } = await import('@axe-core/playwright');
17
+ AxeBuilder = _AxeBuilder;
18
+ } catch (error) {
19
+ throw new Error("@axe-core/playwright must be installed as a peer dependency to use a11y scanning.");
20
+ }
21
+ }
15
22
  const builder = new AxeBuilder({ page }).withTags(DEFAULT_A11Y_TAGS);
16
23
  if (context?.options) {
17
24
  builder.options(context.options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/plugin-e2e",
3
- "version": "3.4.3",
3
+ "version": "3.4.5-canary.2523.22899282924.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -33,23 +33,26 @@
33
33
  "engines": {
34
34
  "node": ">=20 <=24"
35
35
  },
36
+ "peerDependenciesMeta": {
37
+ "@axe-core/playwright": {
38
+ "optional": true
39
+ }
40
+ },
36
41
  "peerDependencies": {
37
42
  "@axe-core/playwright": "^4.11.1",
38
- "@playwright/test": "^1.52.0",
39
- "axe-core": "^4.11.1"
43
+ "@playwright/test": "^1.52.0"
40
44
  },
41
45
  "devDependencies": {
42
46
  "@axe-core/playwright": "^4.11.1",
43
47
  "@playwright/test": "^1.58.1",
44
48
  "@types/uuid": "^11.0.0",
45
- "axe-core": "^4.11.1",
46
49
  "dotenv": "^17.2.4"
47
50
  },
48
51
  "dependencies": {
49
- "@grafana/e2e-selectors": "13.0.0-22732949497",
52
+ "@grafana/e2e-selectors": "13.0.0-22898798261",
50
53
  "semver": "^7.5.4",
51
54
  "uuid": "^13.0.0",
52
55
  "yaml": "^2.3.4"
53
56
  },
54
- "gitHead": "4b70b2d34f082d6639d6e3f3a8a99e456462e504"
57
+ "gitHead": "739976590c2f48ffd6cece75d3b90aea3ad099b0"
55
58
  }