Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
23 changes: 23 additions & 0 deletions src/runner/at-driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import ws from 'ws';
import { iterateEmitter } from '../shared/iterate-emitter.js';
import { RunnerMessage } from './messages.js';

const globalSettings = {
JAWS: [
{ name: 'jcf:default:HTML:SayAllOnDocumentLoad', value: '0' },
{ name: 'jcf:default:options:TypingEcho', value: '0' },
{ name: 'jcf:default:options:DisplayStartupWizard', value: '0' },
],
};

/**
* @param {object} options
* @param {object} [options.url]
Expand All @@ -24,6 +32,8 @@ export async function createATDriver({
const socket = new ws(url);
const driver = new ATDriver({ socket, log });
await driver.ready;
const settings = globalSettings[(await driver.getCapabilities()).atName];
if (settings) await driver.setSettings(settings);
abortSignal.then(() => driver.quit());
return driver;
}
Expand Down Expand Up @@ -64,6 +74,9 @@ export class ATDriver {
this._nextId = 0;
}

/**
* @returns {Promise<{atName: string, atVersion:string, platformName: string}>}
*/
async getCapabilities() {
await this.ready;
return this._capabilities;
Expand Down Expand Up @@ -128,6 +141,16 @@ export class ATDriver {
}
}
}

/**
*
* @param {[{name: string, value: string | boolean}]} settings
*/
async setSettings(settings) {
const { atName } = await this.getCapabilities();
const method = atName == 'nvda' ? 'nvda:settings.setSettings' : 'settings.setSettings';
return this._send({ method, params: { settings } });
}
}

// https://w3c.github.io/webdriver/#keyboard-actions
Expand Down
23 changes: 7 additions & 16 deletions src/runner/driver-test-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,9 @@ export class DriverTestRunner {

if (atName == 'NVDA') {
// disable the "beeps" when switching focus/browse mode, forces it to speak the mode after switching
await this.atDriver._send({
method: 'nvda:settings.setSettings',
params: { settings: [{ name: 'virtualBuffers.passThroughAudioIndication', value: false }] },
});
await this.atDriver.setSettings([
{ name: 'virtualBuffers.passThroughAudioIndication', value: false },
]);

try {
for (const setting of settingsArray) {
Expand All @@ -182,12 +181,9 @@ export class DriverTestRunner {
}
} finally {
// turn the "beeps" back on so mode switches won't be spoken (default setting)
await this.atDriver._send({
method: 'nvda:settings.setSettings',
params: {
settings: [{ name: 'virtualBuffers.passThroughAudioIndication', value: true }],
},
});
await this.atDriver.setSettings([
{ name: 'virtualBuffers.passThroughAudioIndication', value: true },
]);
}
} else if (atName == 'JAWS') {
for (const setting of settingsArray) {
Expand All @@ -211,12 +207,7 @@ export class DriverTestRunner {
// set the setting and collect the mode switch utterance if we are in the incorrect mode.
let unknownCollected = '';
const speechResponse = await this._collectSpeech(this.timesOption.modeSwitch, () =>
this.atDriver._send({
method: 'settings.setSettings',
params: {
settings: [{ name: 'cursor', value }],
},
})
this.atDriver.setSettings([{ name: 'cursor', value }])
);
while (speechResponse.length) {
const lastMessage = speechResponse.shift().trim();
Expand Down
Loading