From 9399857be69e41c7e95454de0200b648c086dac0 Mon Sep 17 00:00:00 2001 From: Corey Frang Date: Thu, 7 Aug 2025 14:10:12 -0400 Subject: [PATCH 1/4] set settings on startup for jaws --- src/runner/at-driver.js | 25 +++++++++++++++++++++++++ src/runner/driver-test-runner.js | 23 +++++++---------------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/runner/at-driver.js b/src/runner/at-driver.js index e55cd3f..98d0b85 100644 --- a/src/runner/at-driver.js +++ b/src/runner/at-driver.js @@ -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] @@ -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[this._capabilities.atName]; + if (settings) await this.setSettings(settings); abortSignal.then(() => driver.quit()); return driver; } @@ -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; @@ -128,6 +141,18 @@ export class ATDriver { } } } + + /** + * + * @param {[{name: string, value: string | boolean}]} settings + */ + async setSettings(settings) { + if (settings?.length) { + 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 diff --git a/src/runner/driver-test-runner.js b/src/runner/driver-test-runner.js index 52cfe26..69b79f6 100644 --- a/src/runner/driver-test-runner.js +++ b/src/runner/driver-test-runner.js @@ -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) { @@ -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) { @@ -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(); From c0893a93dafa66b4cc2d2d07ff8049dfd09ec30a Mon Sep 17 00:00:00 2001 From: Corey Frang Date: Thu, 7 Aug 2025 14:24:19 -0400 Subject: [PATCH 2/4] fix create method --- src/runner/at-driver.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runner/at-driver.js b/src/runner/at-driver.js index 98d0b85..203d117 100644 --- a/src/runner/at-driver.js +++ b/src/runner/at-driver.js @@ -32,8 +32,8 @@ export async function createATDriver({ const socket = new ws(url); const driver = new ATDriver({ socket, log }); await driver.ready; - const settings = globalSettings[this._capabilities.atName]; - if (settings) await this.setSettings(settings); + const settings = globalSettings[(await driver.getCapabilities()).atName]; + if (settings) await driver.setSettings(settings); abortSignal.then(() => driver.quit()); return driver; } From 46b49b569e8e15cf461a5b8e27951ab529d24a38 Mon Sep 17 00:00:00 2001 From: Corey Frang Date: Thu, 7 Aug 2025 14:32:41 -0400 Subject: [PATCH 3/4] jaws reports JAWS for atname --- src/runner/at-driver.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runner/at-driver.js b/src/runner/at-driver.js index 203d117..15fb930 100644 --- a/src/runner/at-driver.js +++ b/src/runner/at-driver.js @@ -4,7 +4,7 @@ import { iterateEmitter } from '../shared/iterate-emitter.js'; import { RunnerMessage } from './messages.js'; const globalSettings = { - jaws: [ + JAWS: [ { name: 'jcf:default:HTML:SayAllOnDocumentLoad', value: '0' }, { name: 'jcf:default:options:TypingEcho', value: '0' }, { name: 'jcf:default:options:DisplayStartupWizard', value: '0' }, From 34054d761e772cf06e9ac23369573198142cf913 Mon Sep 17 00:00:00 2001 From: Corey Frang Date: Wed, 13 Aug 2025 12:42:11 -0400 Subject: [PATCH 4/4] remove settings length check from setSettings method --- src/runner/at-driver.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/runner/at-driver.js b/src/runner/at-driver.js index 15fb930..60973d2 100644 --- a/src/runner/at-driver.js +++ b/src/runner/at-driver.js @@ -147,11 +147,9 @@ export class ATDriver { * @param {[{name: string, value: string | boolean}]} settings */ async setSettings(settings) { - if (settings?.length) { - const { atName } = await this.getCapabilities(); - const method = atName == 'nvda' ? 'nvda:settings.setSettings' : 'settings.setSettings'; - return this._send({ method, params: { settings } }); - } + const { atName } = await this.getCapabilities(); + const method = atName == 'nvda' ? 'nvda:settings.setSettings' : 'settings.setSettings'; + return this._send({ method, params: { settings } }); } }