diff --git a/src/data/types.js b/src/data/types.js index f1e996f..fa485b7 100644 --- a/src/data/types.js +++ b/src/data/types.js @@ -41,6 +41,7 @@ * @property {string} commands[].keypresses[].keystroke single human-readable key or key chord press * @property {string} [commands[].extraInstruction] human-readable additional instruction to follow * @property {string} [commands[].settings] this property only exists on v2 tests + * @property {string[]} [commands[].additionalSettings] this property only exists on v2 tests * @property {object[]} assertions[] * @property {1 | 2} assertions[].priority * @property {string} [assertions[].expectation] assertion statement string, this property only exists on v1 tests diff --git a/src/runner/driver-test-runner.js b/src/runner/driver-test-runner.js index e5d1828..86f9f44 100644 --- a/src/runner/driver-test-runner.js +++ b/src/runner/driver-test-runner.js @@ -92,8 +92,9 @@ export class DriverTestRunner { * * @param {string} settings - "browseMode" "focusMode" for NVDA, "pcCursor" "virtualCursor" * for JAWS., "defaultMode" for others. + * @param {string[]} additionalSettings - e.g. "speechRateIncrease" and "commentAnnouncementOn" for JAWS */ - async ensureSettings(settings) { + async ensureSettings(settings, additionalSettings) { const { atName } = await this.collectedCapabilities; if (atName == 'NVDA') { const desiredResponse = { browsemode: 'Browse mode', focusmode: 'Focus mode' }[ @@ -123,6 +124,12 @@ export class DriverTestRunner { }, }); } + for (const additionalSetting of additionalSettings) { + switch (additionalSetting) { + default: + throw new Error(`Unrecognized addditional setting for NVDA: ${additionalSetting}`); + } + } } else if (atName == 'VoiceOver') { if (settings === 'quickNavOn' || settings === 'arrowQuickKeyNavOn') { await this.pressKeysToToggleSetting( @@ -147,6 +154,12 @@ export class DriverTestRunner { } else if (settings !== 'defaultMode') { throw new Error(`Unrecognized setting for VoiceOver: ${settings}`); } + for (const additionalSetting of additionalSettings) { + switch (additionalSetting) { + default: + throw new Error(`Unrecognized addditional setting for VoiceOver: ${additionalSetting}`); + } + } return; } else if (!atName) { return; @@ -162,7 +175,7 @@ export class DriverTestRunner { async ensureMode(mode) { const { atName } = await this.collectedCapabilities; if (atName === 'NVDA') { - await this.ensureSettings(mode.toLowerCase() === 'reading' ? 'browseMode' : 'focusMode'); + await this.ensureSettings(mode.toLowerCase() === 'reading' ? 'browseMode' : 'focusMode', []); return; } else if (atName === 'VoiceOver') { return; @@ -204,7 +217,7 @@ export class DriverTestRunner { if (command.settings) { // Ensure AT is in proper mode for tests. V2 tests define "settings" per command. - await this.ensureSettings(command.settings); + await this.ensureSettings(command.settings, command.additionalSettings); } else if (test.target?.mode) { // V1 tests define a "mode" of "reading" or "interaction" on the test.target await this.ensureMode(test.target.mode);