@axe-core/watcher 3.19.1 → 3.20.1-rc.8c45df99

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.
Files changed (63) hide show
  1. package/LICENSES-3RD-PARTY.md +1 -1
  2. package/dist/Controller.d.ts +3 -0
  3. package/dist/Controller.js +29 -11
  4. package/dist/Controller.js.map +1 -1
  5. package/dist/cypress.d.ts +2 -0
  6. package/dist/cypress.js +12 -8
  7. package/dist/cypress.js.map +1 -1
  8. package/dist/cypressCommands.js +34 -24
  9. package/dist/cypressCommands.js.map +1 -1
  10. package/dist/git.js +7 -7
  11. package/dist/git.js.map +1 -1
  12. package/dist/puppeteer.d.ts +3 -3
  13. package/dist/puppeteer.js +1 -1
  14. package/dist/puppeteer.js.map +1 -1
  15. package/dist/sendResultsToServer.d.ts +4 -1
  16. package/dist/sendResultsToServer.js +37 -4
  17. package/dist/sendResultsToServer.js.map +1 -1
  18. package/dist/utils/constants.d.ts +1 -0
  19. package/dist/utils/constants.js +2 -1
  20. package/dist/utils/constants.js.map +1 -1
  21. package/dist/utils/initializeSession.d.ts +4 -5
  22. package/dist/utils/initializeSession.js +31 -66
  23. package/dist/utils/initializeSession.js.map +1 -1
  24. package/dist/utils/linearBackoff.d.ts +10 -0
  25. package/dist/utils/linearBackoff.js +47 -0
  26. package/dist/utils/linearBackoff.js.map +1 -0
  27. package/dist/utils/validateHeadlessPlaywright.js +9 -3
  28. package/dist/utils/validateHeadlessPlaywright.js.map +1 -1
  29. package/dist/utils/writeExtensionManifest.d.ts +6 -4
  30. package/dist/utils/writeExtensionManifest.js +13 -3
  31. package/dist/utils/writeExtensionManifest.js.map +1 -1
  32. package/dist/utils/writeVariables.d.ts +16 -7
  33. package/dist/utils/writeVariables.js +41 -15
  34. package/dist/utils/writeVariables.js.map +1 -1
  35. package/dist/wdio.js +3 -4
  36. package/dist/wdio.js.map +1 -1
  37. package/dist/webdriver.js +2 -3
  38. package/dist/webdriver.js.map +1 -1
  39. package/extension/axe-versions/axe-core@4.10.3/axe.min.js +12 -0
  40. package/extension/axe-versions/axe-core@4.10.3/locales/README.md +9 -0
  41. package/extension/axe-versions/axe-core@4.10.3/locales/_template.json +1123 -0
  42. package/extension/axe-versions/axe-core@4.10.3/locales/da.json +799 -0
  43. package/extension/axe-versions/axe-core@4.10.3/locales/de.json +1123 -0
  44. package/extension/axe-versions/axe-core@4.10.3/locales/el.json +1069 -0
  45. package/extension/axe-versions/axe-core@4.10.3/locales/es.json +790 -0
  46. package/extension/axe-versions/axe-core@4.10.3/locales/eu.json +789 -0
  47. package/extension/axe-versions/axe-core@4.10.3/locales/fr.json +994 -0
  48. package/extension/axe-versions/axe-core@4.10.3/locales/he.json +1017 -0
  49. package/extension/axe-versions/axe-core@4.10.3/locales/it.json +1108 -0
  50. package/extension/axe-versions/axe-core@4.10.3/locales/ja.json +1118 -0
  51. package/extension/axe-versions/axe-core@4.10.3/locales/ko.json +1003 -0
  52. package/extension/axe-versions/axe-core@4.10.3/locales/nl.json +48 -0
  53. package/extension/axe-versions/axe-core@4.10.3/locales/no_NB.json +799 -0
  54. package/extension/axe-versions/axe-core@4.10.3/locales/pl.json +1109 -0
  55. package/extension/axe-versions/axe-core@4.10.3/locales/pt_BR.json +970 -0
  56. package/extension/axe-versions/axe-core@4.10.3/locales/zh_CN.json +1116 -0
  57. package/extension/axe-versions/axe-core@4.10.3/locales/zh_TW.json +1108 -0
  58. package/extension/axe-versions-mapper.js +2 -1
  59. package/extension/axe.js +1 -1
  60. package/extension/axe.js.LICENSE.txt +2 -2
  61. package/extension/background.js +1 -1
  62. package/extension/content.js +1 -1
  63. package/package.json +8 -8
@@ -3,12 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.sendResultsToServer = exports.MAX_PAGE_STATES_PER_REQUEST = void 0;
6
+ exports.sendResultsToServer = exports.MAX_RETRIES = exports.MAX_PAGE_STATES_PER_REQUEST = void 0;
7
7
  const node_fetch_1 = __importDefault(require("node-fetch"));
8
8
  const uuid_1 = require("uuid");
9
9
  const readVariables_1 = __importDefault(require("./utils/readVariables"));
10
+ const linearBackoff_1 = __importDefault(require("./utils/linearBackoff"));
10
11
  const { version } = require('../package.json');
11
12
  exports.MAX_PAGE_STATES_PER_REQUEST = 5;
13
+ exports.MAX_RETRIES = 3;
12
14
  const sendResultsToServer = async ({ results, debugLogger }) => {
13
15
  const { server_url, api_key, session_id, git_data } = (0, readVariables_1.default)();
14
16
  const resultsURL = new URL(`/api-pub/watcher/sessions/${session_id}`, server_url);
@@ -18,7 +20,7 @@ const sendResultsToServer = async ({ results, debugLogger }) => {
18
20
  totalBytes: Buffer.byteLength(JSON.stringify(results))
19
21
  });
20
22
  debugLogger('SendResultsToServer: Session ID', { session_id });
21
- const putResults = async (bodyResults = []) => {
23
+ const putResults = async (bodyResults = [], retryAttempt = 0) => {
22
24
  const body = {
23
25
  axe_watcher_version: version,
24
26
  results: bodyResults,
@@ -50,17 +52,48 @@ const sendResultsToServer = async ({ results, debugLogger }) => {
50
52
  resStatusText: res.statusText
51
53
  });
52
54
  }
55
+ const is500 = res.status === 500;
56
+ const is408 = res.status === 408;
57
+ const is429 = res.status === 429;
58
+ if ((is500 || is408 || is429) && retryAttempt !== exports.MAX_RETRIES) {
59
+ const incrementRetry = retryAttempt + 1;
60
+ console.warn('@axe-core/watcher: Retrying...');
61
+ debugLogger('SendResultsToServer: Retrying...', {
62
+ retryAttempt: incrementRetry,
63
+ resStatus: res.status,
64
+ batchResults: bodyResults.length,
65
+ reqSize: Buffer.byteLength(JSON.stringify(body))
66
+ });
67
+ await (0, linearBackoff_1.default)(incrementRetry);
68
+ await putResults(bodyResults, incrementRetry);
69
+ }
70
+ else if (retryAttempt === exports.MAX_RETRIES) {
71
+ debugLogger('SendResultsToServer: Max retries reached', {
72
+ retryAttempt,
73
+ resStatus: res.status
74
+ });
75
+ console.warn('@axe-core/watcher: Unable to send results to server, max retries reached');
76
+ }
53
77
  };
54
78
  results.forEach(result => {
55
79
  if (result.screenshot) {
56
80
  result.screenshot_id = (0, uuid_1.v4)();
57
81
  }
58
82
  });
83
+ const requestErrorHandler = (error) => {
84
+ debugLogger('SendResultsToServer: Fetch error', {
85
+ message: error.message,
86
+ type: error.type || 'NA',
87
+ code: error.code || 'NA',
88
+ stack: error.stack || 'NA',
89
+ errno: error.errno || 'NA'
90
+ });
91
+ };
59
92
  for (let i = 0; i < results.length; i += exports.MAX_PAGE_STATES_PER_REQUEST) {
60
93
  const batch = results
61
94
  .slice(i, i + exports.MAX_PAGE_STATES_PER_REQUEST)
62
95
  .map(r => ({ ...r, screenshot: null }));
63
- await putResults(batch);
96
+ await putResults(batch).catch(requestErrorHandler);
64
97
  }
65
98
  await Promise.all(results.map(async ({ screenshot, screenshot_id }) => {
66
99
  if (!screenshot) {
@@ -80,7 +113,7 @@ const sendResultsToServer = async ({ results, debugLogger }) => {
80
113
  if (!ok) {
81
114
  console.warn('@axe-core/watcher: Unable to send screenshot to server');
82
115
  }
83
- }));
116
+ })).catch(requestErrorHandler);
84
117
  };
85
118
  exports.sendResultsToServer = sendResultsToServer;
86
119
  exports.default = exports.sendResultsToServer;
@@ -1 +1 @@
1
- {"version":3,"file":"sendResultsToServer.js","sourceRoot":"","sources":["../src/sendResultsToServer.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA8B;AAG9B,+BAAiC;AAGjC,0EAAiD;AAIjD,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAA;AASjC,QAAA,2BAA2B,GAAG,CAAC,CAAA;AAwBrC,MAAM,mBAAmB,GAAG,KAAK,EAAE,EACxC,OAAO,EACP,WAAW,EACe,EAAiB,EAAE;IAC7C,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,IAAA,uBAAa,GAAE,CAAA;IA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AAED,kBAAe,2BAAmB,CAAA"}
@@ -2,3 +2,4 @@ export declare const DEFAULT_SERVER_URL = "https://axe.deque.com/";
2
2
  export declare const PATH_TO_EXTENSION: string;
3
3
  export declare const PATH_TO_SESSION_FILE: string;
4
4
  export declare const PATH_TO_EXTENSION_VARIABLES: string;
5
+ export declare const DOCS_LINK = "https://docs.deque.com/developer-hub/2/en/dh-troubleshooting";
@@ -3,10 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PATH_TO_EXTENSION_VARIABLES = exports.PATH_TO_SESSION_FILE = exports.PATH_TO_EXTENSION = exports.DEFAULT_SERVER_URL = void 0;
6
+ exports.DOCS_LINK = exports.PATH_TO_EXTENSION_VARIABLES = exports.PATH_TO_SESSION_FILE = exports.PATH_TO_EXTENSION = exports.DEFAULT_SERVER_URL = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  exports.DEFAULT_SERVER_URL = 'https://axe.deque.com/';
9
9
  exports.PATH_TO_EXTENSION = path_1.default.join(__dirname, '..', '..', 'extension');
10
10
  exports.PATH_TO_SESSION_FILE = path_1.default.join(exports.PATH_TO_EXTENSION, 'axe-watcher-session.json');
11
11
  exports.PATH_TO_EXTENSION_VARIABLES = path_1.default.join(exports.PATH_TO_EXTENSION, 'variables.json');
12
+ exports.DOCS_LINK = 'https://docs.deque.com/developer-hub/2/en/dh-troubleshooting';
12
13
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AAEV,QAAA,kBAAkB,GAAG,wBAAwB,CAAA;AAG7C,QAAA,iBAAiB,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAA;AAGjE,QAAA,oBAAoB,GAAG,cAAI,CAAC,IAAI,CAC3C,yBAAiB,EACjB,0BAA0B,CAC3B,CAAA;AAGY,QAAA,2BAA2B,GAAG,cAAI,CAAC,IAAI,CAClD,yBAAiB,EACjB,gBAAgB,CACjB,CAAA"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AAEV,QAAA,kBAAkB,GAAG,wBAAwB,CAAA;AAG7C,QAAA,iBAAiB,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAA;AAGjE,QAAA,oBAAoB,GAAG,cAAI,CAAC,IAAI,CAC3C,yBAAiB,EACjB,0BAA0B,CAC3B,CAAA;AAGY,QAAA,2BAA2B,GAAG,cAAI,CAAC,IAAI,CAClD,yBAAiB,EACjB,gBAAgB,CACjB,CAAA;AAEY,QAAA,SAAS,GACpB,8DAA8D,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import type { ConfigurationOverrides } from './writeVariables';
2
2
  import type { RunOptions } from './runOptions';
3
3
  export interface AxeCoreSettings {
4
- axeCoreVersion?: string;
4
+ axe_core_version?: string;
5
5
  tags?: string[];
6
6
  }
7
7
  export interface InitializeSessionParams {
@@ -19,12 +19,11 @@ export interface InitializeSessionParams {
19
19
  gitCommitMessage: string | null;
20
20
  gitTag: string | null;
21
21
  gitCommitEmail: string | null;
22
- configurationOverrides?: ConfigurationOverrides;
23
- runOptions?: RunOptions;
22
+ configOverrides: ConfigurationOverrides | null;
23
+ runOptions: RunOptions | null;
24
24
  }
25
- export declare const accessibilityStandardsError: string;
26
25
  /** Initialize a new session. */
27
- declare function initializeSession({ apiKey, serverURL, watcherVersion, sessionID, buildID, gitCommitSha, gitUrl, gitBranch, gitCommitAuthor, gitIsDirty, gitDefaultBranch, gitCommitMessage, gitTag, gitCommitEmail, configurationOverrides, runOptions }: InitializeSessionParams): {
26
+ declare function initializeSession({ apiKey, serverURL, watcherVersion, sessionID, buildID, gitCommitSha, gitUrl, gitBranch, gitCommitAuthor, gitIsDirty, gitDefaultBranch, gitCommitMessage, gitTag, gitCommitEmail, configOverrides, runOptions }: InitializeSessionParams): {
28
27
  axe_core_settings?: AxeCoreSettings;
29
28
  session_id: string;
30
29
  };
@@ -3,51 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.accessibilityStandardsError = void 0;
7
6
  const sync_request_1 = __importDefault(require("sync-request"));
8
7
  const assert_1 = __importDefault(require("assert"));
9
8
  const createDebugger_1 = __importDefault(require("../createDebugger"));
10
9
  const debugLogger = (0, createDebugger_1.default)('config:initializeSession');
11
- const accessibilityStandardMap = {
12
- All: 'all',
13
- 'WCAG 2.2 AAA': 'wcag22aaa',
14
- 'WCAG 2.2 AA': 'wcag22aa',
15
- 'WCAG 2.2 A': 'wcag22a',
16
- 'WCAG 2.1 AAA': 'wcag21aaa',
17
- 'WCAG 2.1 AA': 'wcag21aa',
18
- 'WCAG 2.1 A': 'wcag21a',
19
- 'WCAG 2.0 AAA': 'wcag2aaa',
20
- 'WCAG 2.0 AA': 'wcag2aa',
21
- 'WCAG 2.0 A': 'wcag2a',
22
- 'Trusted Tester v5': 'TTv5',
23
- 'EN 301 549': 'EN-301-549'
24
- };
25
- exports.accessibilityStandardsError = `Invalid accessibility standard provided. Must be one of: ${Object.keys(accessibilityStandardMap).join(', ')}`;
26
- const convertConfigOverridesForRequest = (overrides) => {
27
- if (!overrides)
28
- return {};
29
- const { accessibilityStandard, axeCoreVersion, bestPractices, experimentalRules } = overrides;
30
- const configuration_overrides = {};
31
- if (accessibilityStandard) {
32
- (0, assert_1.default)(Object.keys(accessibilityStandardMap).includes(accessibilityStandard), exports.accessibilityStandardsError);
33
- configuration_overrides.accessibility_standard =
34
- accessibilityStandardMap[accessibilityStandard];
35
- }
36
- if (axeCoreVersion) {
37
- configuration_overrides.axe_core_version = axeCoreVersion;
38
- }
39
- if (bestPractices !== undefined) {
40
- configuration_overrides.best_practices = bestPractices;
41
- }
42
- if (experimentalRules !== undefined) {
43
- configuration_overrides.experimental_rules = experimentalRules;
44
- }
45
- return {
46
- configuration_overrides
47
- };
48
- };
49
- function initializeSession({ apiKey, serverURL, watcherVersion, sessionID, buildID, gitCommitSha, gitUrl, gitBranch, gitCommitAuthor, gitIsDirty, gitDefaultBranch, gitCommitMessage, gitTag, gitCommitEmail, configurationOverrides, runOptions }) {
50
- var _a;
10
+ function initializeSession({ apiKey, serverURL, watcherVersion, sessionID, buildID, gitCommitSha, gitUrl, gitBranch, gitCommitAuthor, gitIsDirty, gitDefaultBranch, gitCommitMessage, gitTag, gitCommitEmail, configOverrides, runOptions }) {
51
11
  (0, assert_1.default)(apiKey, 'API key is required');
52
12
  (0, assert_1.default)(serverURL, 'Server URL is required');
53
13
  (0, assert_1.default)(watcherVersion, 'Watcher version is required');
@@ -63,35 +23,42 @@ function initializeSession({ apiKey, serverURL, watcherVersion, sessionID, build
63
23
  (0, assert_1.default)(gitCommitMessage === null || typeof gitCommitMessage === 'string', 'Git Commit Message must be a string or null');
64
24
  (0, assert_1.default)(gitTag === null || typeof gitTag === 'string', 'Git Tag must be a string or null');
65
25
  (0, assert_1.default)(gitCommitEmail === null || typeof gitCommitEmail === 'string', 'Git Commit Email must be a string or null');
66
- const useGlobalConfigReconciliaton = process.env.GLOBAL_CONFIGS === 'true';
26
+ (0, assert_1.default)(configOverrides === null || typeof configOverrides === 'object', 'Configuration Overrides must be an object or null');
27
+ (0, assert_1.default)(runOptions === null || typeof runOptions === 'object', 'Run Options must be an object or null');
67
28
  const url = new URL(`/api-pub/watcher/sessions`, serverURL);
29
+ const payload = {
30
+ watcher_version: watcherVersion,
31
+ session_id: sessionID,
32
+ build_id: buildID,
33
+ git_commit_sha: gitCommitSha,
34
+ git_url: gitUrl,
35
+ git_branch: gitBranch,
36
+ git_commit_author: gitCommitAuthor,
37
+ git_is_dirty: gitIsDirty,
38
+ git_default_branch: gitDefaultBranch,
39
+ git_commit_message: gitCommitMessage,
40
+ git_tag: gitTag,
41
+ git_commit_email: gitCommitEmail,
42
+ watcher_config: {
43
+ configuration_overrides: configOverrides
44
+ ? {
45
+ accessibility_standard: configOverrides?.accessibilityStandard,
46
+ axe_core_version: configOverrides?.axeCoreVersion,
47
+ best_practices: configOverrides?.bestPractices,
48
+ experimental_rules: configOverrides?.experimentalRules
49
+ }
50
+ : null,
51
+ run_options: runOptions
52
+ }
53
+ };
68
54
  const res = (0, sync_request_1.default)('POST', url.toString(), {
69
55
  headers: {
70
56
  'X-API-Key': apiKey
71
57
  },
72
- json: {
73
- watcher_version: watcherVersion,
74
- session_id: sessionID,
75
- build_id: buildID,
76
- git_commit_sha: gitCommitSha,
77
- git_url: gitUrl,
78
- git_branch: gitBranch,
79
- git_commit_author: gitCommitAuthor,
80
- git_is_dirty: gitIsDirty,
81
- git_default_branch: gitDefaultBranch,
82
- git_commit_message: gitCommitMessage,
83
- git_tag: gitTag,
84
- git_commit_email: gitCommitEmail,
85
- ...(useGlobalConfigReconciliaton && {
86
- watcher_config: {
87
- ...convertConfigOverridesForRequest(configurationOverrides),
88
- runOptions
89
- }
90
- })
91
- }
58
+ json: payload
92
59
  });
93
60
  const body = JSON.parse(res.getBody('utf8'));
94
- const error = body.error || (((_a = body.errors) === null || _a === void 0 ? void 0 : _a.length) && body.errors[0]);
61
+ const error = body.error || (body.errors?.length && body.errors[0]);
95
62
  if (error) {
96
63
  debugLogger('Error initializing session:', error);
97
64
  throw new Error(error);
@@ -106,9 +73,7 @@ function initializeSession({ apiKey, serverURL, watcherVersion, sessionID, build
106
73
  }
107
74
  return {
108
75
  session_id: body.session_id,
109
- ...(useGlobalConfigReconciliaton && {
110
- axe_core_settings: body.axe_core_settings
111
- })
76
+ axe_core_settings: body.axe_core_settings
112
77
  };
113
78
  }
114
79
  exports.default = initializeSession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,iBAAiB,CAAA"}
@@ -0,0 +1,10 @@
1
+ export declare const BACKOFF_FACTOR = 1000;
2
+ /**
3
+ * Linear backoff function that waits for a given amount of time
4
+ * before resolving
5
+ *
6
+ * @param retryAttempts The number of retry attempts (default 1)
7
+ *
8
+ */
9
+ declare function linearBackoff(retryAttempts?: number): Promise<void>;
10
+ export default linearBackoff;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.BACKOFF_FACTOR = void 0;
37
+ const timersPromises = __importStar(require("timers/promises"));
38
+ exports.BACKOFF_FACTOR = 1000;
39
+ async function linearBackoff(retryAttempts = 1) {
40
+ if (retryAttempts <= 0) {
41
+ throw new Error('retryAttempts must be greater than 0');
42
+ }
43
+ const delay = retryAttempts * exports.BACKOFF_FACTOR;
44
+ await timersPromises.setTimeout(delay);
45
+ }
46
+ exports.default = linearBackoff;
47
+ //# sourceMappingURL=linearBackoff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linearBackoff.js","sourceRoot":"","sources":["../../src/utils/linearBackoff.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAAiD;AAGpC,QAAA,cAAc,GAAG,IAAI,CAAA;AAUlC,KAAK,UAAU,aAAa,CAAC,gBAAwB,CAAC;IACpD,IAAI,aAAa,IAAI,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;IACzD,CAAC;IAED,MAAM,KAAK,GAAG,aAAa,GAAG,sBAAc,CAAA;IAC5C,MAAM,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;AACxC,CAAC;AAED,kBAAe,aAAa,CAAA"}
@@ -11,16 +11,16 @@ function validateHeadlessPlaywright({ isPlaywrightTest, playwrightConfig }) {
11
11
  if (playwrightConfig.headless) {
12
12
  throw new headlessNotSupportedError_1.HeadlessNotSupportedError(preHeadlessChangeMessage());
13
13
  }
14
+ validatePlaywrightChannel(playwrightConfig.channel);
14
15
  return;
15
16
  }
16
17
  if (playwrightConfig.headless === undefined) {
17
18
  throw new newHeadlessPlaywrightNotSupportedError_1.HeadlessPlaywrightNotSupportedError('@axe-core/watcher is not supported in chromium-headless-shell mode.');
18
19
  }
19
- const isChromiumChannel = playwrightConfig.channel === 'chromium';
20
- const isChromeChannel = playwrightConfig.channel === 'chrome';
21
- if (playwrightConfig.headless && !(isChromiumChannel || isChromeChannel)) {
20
+ if (playwrightConfig.headless && !playwrightConfig.channel) {
22
21
  throw new newHeadlessPlaywrightNotSupportedError_1.HeadlessPlaywrightNotSupportedError('@axe-core/watcher requires either fully headed mode or new headless mode.');
23
22
  }
23
+ validatePlaywrightChannel(playwrightConfig.channel);
24
24
  }
25
25
  catch (error) {
26
26
  if (error instanceof headlessNotSupportedError_1.HeadlessNotSupportedError ||
@@ -32,5 +32,11 @@ function validateHeadlessPlaywright({ isPlaywrightTest, playwrightConfig }) {
32
32
  }
33
33
  }
34
34
  }
35
+ function validatePlaywrightChannel(channel) {
36
+ const SUPPORTED_CHANNELS = ['chromium', 'chrome'];
37
+ if (channel && !SUPPORTED_CHANNELS.includes(channel)) {
38
+ throw new newHeadlessPlaywrightNotSupportedError_1.HeadlessPlaywrightNotSupportedError('@axe-core/watcher requires either fully headed mode or new headless mode.');
39
+ }
40
+ }
35
41
  exports.default = validateHeadlessPlaywright;
36
42
  //# sourceMappingURL=validateHeadlessPlaywright.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validateHeadlessPlaywright.js","sourceRoot":"","sources":["../../src/utils/validateHeadlessPlaywright.ts"],"names":[],"mappings":";;AACA,2EAAuE;AACvE,qGAA8F;AAO9F,SAAS,0BAA0B,CAAC,EAClC,gBAAgB,EAChB,gBAAgB,EACiB;IACjC,MAAM,wBAAwB,GAAG,GAAW,EAAE,CAC5C,OAAO,gBAAgB,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,YAAY,sGAAsG,CAAA;IAMnK,IAAI,CAAC;QACH,MAAM,qBAAqB,GAEzB,OAAO,CAAC,8BAA8B,CAAC,CAAC,OAAO,CAAA;QACjD,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,qBAAqB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAGjE,CAAA;QAGD,IAAI,KAAK,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE,EAAE,CAAC;YAC/B,IAAI,gBAAgB,CAAC,QAAQ,EAAE,CAAC;gBAC9B,MAAM,IAAI,qDAAyB,CAAC,wBAAwB,EAAE,CAAC,CAAA;YACjE,CAAC;YAED,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boolean;
3
- exclude_globs: string[];
1
+ export interface WriteManifestParams {
2
+ all_frames?: boolean;
3
+ exclude_globs?: string[];
4
+ js?: string[];
5
+ resources?: string[];
4
6
  }
5
7
  /** Update the extension manifest file. */
6
- declare function writeManifest({ all_frames, exclude_globs }: WriteManifestParams): void;
8
+ declare function writeManifest({ all_frames, exclude_globs, resources, js }: WriteManifestParams): void;
7
9
  export default writeManifest;
@@ -6,11 +6,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const path_1 = __importDefault(require("path"));
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const constants_1 = require("./constants");
9
- function writeManifest({ all_frames, exclude_globs }) {
9
+ function writeManifest({ all_frames, exclude_globs, resources, js }) {
10
10
  const manifestPath = path_1.default.join(constants_1.PATH_TO_EXTENSION, 'manifest.json');
11
11
  const manifest = JSON.parse(fs_1.default.readFileSync(manifestPath, 'utf-8'));
12
- manifest.content_scripts[0].all_frames = all_frames;
13
- manifest.content_scripts[0].exclude_globs = exclude_globs;
12
+ if (all_frames) {
13
+ manifest.content_scripts[0].all_frames = all_frames;
14
+ }
15
+ if (exclude_globs) {
16
+ manifest.content_scripts[0].exclude_globs = exclude_globs;
17
+ }
18
+ if (resources && resources.length) {
19
+ manifest.web_accessible_resources[0].resources = resources;
20
+ }
21
+ if (js && js.length) {
22
+ manifest.content_scripts[0].js = js;
23
+ }
14
24
  fs_1.default.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
15
25
  }
16
26
  exports.default = writeManifest;
@@ -1 +1 @@
1
- {"version":3,"file":"writeExtensionManifest.js","sourceRoot":"","sources":["../../src/utils/writeExtensionManifest.ts"],"names":[],"mappings":";;;;;AAAA,gDAAuB;AACvB,4CAAmB;AACnB,2CAA+C;AAQ/C,SAAS,aAAa,CAAC,EACrB,UAAU,EACV,aAAa,EACO;IACpB,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,6BAAiB,EAAE,eAAe,CAAC,CAAA;IAClE,MAAM,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AQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAA;IACrC,CAAC;IAED,YAAE,CAAC,aAAa,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;AACnE,CAAC;AAED,kBAAe,aAAa,CAAA"}
@@ -12,8 +12,9 @@ export interface GitData {
12
12
  git_url?: string | null;
13
13
  git_is_dirty?: boolean;
14
14
  }
15
+ type AccessibilityStandard = 'All' | 'WCAG 2.2 AAA' | 'WCAG 2.2 AA' | 'WCAG 2.2 A' | 'WCAG 2.1 AAA' | 'WCAG 2.1 AA' | 'WCAG 2.1 A' | 'WCAG 2.0 AAA' | 'WCAG 2.0 AA' | 'WCAG 2.0 A' | 'Trusted Tester v5' | 'EN-301-549';
15
16
  export interface ConfigurationOverrides {
16
- accessibilityStandard?: 'All' | 'WCAG 2.2 AAA' | 'WCAG 2.2 AA' | 'WCAG 2.2 A' | 'WCAG 2.1 AAA' | 'WCAG 2.1 AA' | 'WCAG 2.1 A' | 'WCAG 2.0 AAA' | 'WCAG 2.0 AA' | 'WCAG 2.0 A' | 'Trusted Tester v5' | 'EN 301 549';
17
+ accessibilityStandard?: AccessibilityStandard;
17
18
  axeCoreVersion?: string;
18
19
  bestPractices?: boolean;
19
20
  experimentalRules?: boolean;
@@ -49,6 +50,7 @@ interface AxeConfiguration {
49
50
  * - `runOnly`: Limit which rules are executed, based on names or tags
50
51
  * - `ancestry`: Return CSS selector for elements, with all the element's ancestors
51
52
  *
53
+ * @remarks For advanced usage only. Consider using `configurationOverrides` for most cases.
52
54
  * @see https://www.deque.com/axe/core-documentation/api-documentation/#options-parameter
53
55
  */
54
56
  runOptions?: RunOptions;
@@ -78,6 +80,19 @@ interface AxeConfiguration {
78
80
  /** Whether to take and send screenshots to the perf endpoint */
79
81
  /** Run experimental advanced rules */
80
82
  timeout?: Timeouts;
83
+ /**
84
+ * Allows a user to override org-wide settings configured in axe Account
85
+ * @example
86
+ * ```js
87
+ * configurationOverrides: {
88
+ * accessibilityStandard: 'WCAG 2.2 AAA',
89
+ * axeCoreVersion: '4.10.2',
90
+ * bestPractices: true,
91
+ * experimentalRules: false
92
+ * }
93
+ * ```
94
+ */
95
+ configurationOverrides?: ConfigurationOverrides;
81
96
  }
82
97
  export interface Configuration {
83
98
  axe: AxeConfiguration;
@@ -88,12 +103,6 @@ interface WriteVariablesParams extends AxeConfiguration {
88
103
  isWdioTestrunner?: boolean;
89
104
  takeScreenshots?: boolean;
90
105
  experimentalAdvancedRules?: boolean;
91
- /**
92
- * This is not currently part of the public API and will not work in production.
93
- * Until fully released, it is intended for internal use only.
94
- * Configuration overrides for axe-core.
95
- */
96
- configurationOverrides?: ConfigurationOverrides;
97
106
  }
98
107
  /** variables.json shape. */
99
108
  export interface Variables {
@@ -44,8 +44,23 @@ const createDebugger_1 = __importDefault(require("../createDebugger"));
44
44
  const initializeSession_1 = __importDefault(require("./initializeSession"));
45
45
  const validateAxeRunContext_1 = require("./validateAxeRunContext");
46
46
  const isValidExcludePattern_1 = __importDefault(require("./isValidExcludePattern"));
47
+ const writeExtensionManifest_1 = __importDefault(require("./writeExtensionManifest"));
47
48
  const debugLogger = (0, createDebugger_1.default)('config:writeVariables');
48
49
  const { version } = require('../../package.json');
50
+ const allowedAccessibilityStandards = [
51
+ 'All',
52
+ 'WCAG 2.2 AAA',
53
+ 'WCAG 2.2 AA',
54
+ 'WCAG 2.2 A',
55
+ 'WCAG 2.1 AAA',
56
+ 'WCAG 2.1 AA',
57
+ 'WCAG 2.1 A',
58
+ 'WCAG 2.0 AAA',
59
+ 'WCAG 2.0 AA',
60
+ 'WCAG 2.0 A',
61
+ 'Trusted Tester v5',
62
+ 'EN-301-549'
63
+ ];
49
64
  const DEFAULT_TIMEOUT = {
50
65
  start: 2000,
51
66
  stop: 5000,
@@ -60,17 +75,12 @@ function writeVariables({ apiKey, autoAnalyze, configurationOverrides, cypress,
60
75
  ...(sessionId !== undefined && { sessionId }),
61
76
  ...(runContext !== undefined && { runContext }),
62
77
  ...(runOptions !== undefined && { runOptions }),
78
+ ...(configurationOverrides !== undefined && { configurationOverrides }),
63
79
  ...(excludeUrlPatterns !== undefined && { excludeUrlPatterns }),
64
80
  ...(buildID !== undefined && { buildID })
65
81
  });
66
- if (configurationOverrides) {
67
- if (process.env.GLOBAL_CONFIGS !== 'true') {
68
- throw new Error('`configurationOverrides` is not supported in this environment');
69
- }
70
- if (runOptions === null || runOptions === void 0 ? void 0 : runOptions.runOnly) {
71
- throw new Error('Using `configurationOverrides` and `runOptions.runOnly` is not supported. Please use one or the other.');
72
- }
73
- debugLogger('Global Config Reconciliation:', 'Enabled - Note: This is not a public API and will not work in production');
82
+ if (configurationOverrides && runOptions?.runOnly) {
83
+ throw new Error('You cannot use `configurationOverrides` and `runOptions.runOnly` together. These configuration options are mutually exclusive.');
74
84
  }
75
85
  if (!serverURL) {
76
86
  serverURL = constants_1.DEFAULT_SERVER_URL;
@@ -90,6 +100,14 @@ function writeVariables({ apiKey, autoAnalyze, configurationOverrides, cypress,
90
100
  (0, validateAxeRunOptions_1.validateAxeRunOptions)(runOptions);
91
101
  debugLogger('Validated runOptions:', runOptions);
92
102
  }
103
+ if (configurationOverrides) {
104
+ debugLogger('configurationOverrides:', configurationOverrides);
105
+ const hasInvalidAccessibilityStandard = configurationOverrides.accessibilityStandard &&
106
+ !allowedAccessibilityStandards.includes(configurationOverrides.accessibilityStandard);
107
+ if (hasInvalidAccessibilityStandard) {
108
+ throw new Error(`Invalid accessibility standard: ${configurationOverrides.accessibilityStandard}. Allowed options: ${allowedAccessibilityStandards.join(', ')}`);
109
+ }
110
+ }
93
111
  const gitData = {};
94
112
  const isGitRepo = git.isRepository();
95
113
  if (isGitRepo) {
@@ -100,10 +118,10 @@ function writeVariables({ apiKey, autoAnalyze, configurationOverrides, cypress,
100
118
  gitData.git_url = git.getRemoteURL();
101
119
  gitData.git_is_dirty = git.isDirty();
102
120
  const info = git.getCommitInfo();
103
- gitData.git_commit_sha = info === null || info === void 0 ? void 0 : info.hash;
104
- gitData.git_commit_author = info === null || info === void 0 ? void 0 : info.author;
105
- gitData.git_commit_email = info === null || info === void 0 ? void 0 : info.email;
106
- gitData.git_commit_message = info === null || info === void 0 ? void 0 : info.message;
121
+ gitData.git_commit_sha = info?.hash;
122
+ gitData.git_commit_author = info?.author;
123
+ gitData.git_commit_email = info?.email;
124
+ gitData.git_commit_message = info?.message;
107
125
  }
108
126
  if (!buildID && (isPlaywrightTest || isWdioTestrunner)) {
109
127
  if (!sessionId && fs_1.default.existsSync(constants_1.PATH_TO_SESSION_FILE)) {
@@ -133,13 +151,13 @@ function writeVariables({ apiKey, autoAnalyze, configurationOverrides, cypress,
133
151
  gitCommitMessage: gitData.git_commit_message || null,
134
152
  gitTag: gitData.git_tag || null,
135
153
  gitCommitEmail: gitData.git_commit_email || null,
136
- configurationOverrides,
137
- runOptions
154
+ configOverrides: configurationOverrides || null,
155
+ runOptions: runOptions || null
138
156
  });
139
157
  if (typeof autoAnalyze === 'undefined') {
140
158
  autoAnalyze = true;
141
159
  }
142
- if (excludeUrlPatterns === null || excludeUrlPatterns === void 0 ? void 0 : excludeUrlPatterns.length) {
160
+ if (excludeUrlPatterns?.length) {
143
161
  (0, isValidExcludePattern_1.default)(excludeUrlPatterns);
144
162
  }
145
163
  const variables = {
@@ -161,6 +179,14 @@ function writeVariables({ apiKey, autoAnalyze, configurationOverrides, cypress,
161
179
  }
162
180
  };
163
181
  fs_1.default.writeFileSync(constants_1.PATH_TO_EXTENSION_VARIABLES, JSON.stringify(variables));
182
+ if (axe_core_settings?.axe_core_version) {
183
+ (0, writeExtensionManifest_1.default)({
184
+ js: [
185
+ `axe-versions/axe-core@${axe_core_settings?.axe_core_version}/axe.min.js`,
186
+ 'content.js'
187
+ ]
188
+ });
189
+ }
164
190
  }
165
191
  exports.default = writeVariables;
166
192
  //# sourceMappingURL=writeVariables.js.map