Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add placeholder support for new at additionalSettings #73

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/data/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
outofambit marked this conversation as resolved.
Show resolved Hide resolved
* @property {object[]} assertions[]
* @property {1 | 2} assertions[].priority
* @property {string} [assertions[].expectation] assertion statement string, this property only exists on v1 tests
Expand Down
19 changes: 16 additions & 3 deletions src/runner/driver-test-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
outofambit marked this conversation as resolved.
Show resolved Hide resolved
*/
async ensureSettings(settings) {
async ensureSettings(settings, additionalSettings) {
const { atName } = await this.collectedCapabilities;
if (atName == 'NVDA') {
const desiredResponse = { browsemode: 'Browse mode', focusmode: 'Focus mode' }[
Expand Down Expand Up @@ -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(
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down