0.1.2 • Published 5 years ago

screen-reader-reader v0.1.2

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

screen-reader-reader

npm version

This is a very experimental attempt at creating a general purpose screen reader reader, with the aim of enabling more realistic end-to-end accessibility tests!

The goal would be to have something like this:

describe('my website', () => {
  it(`should have correct screen reader output`, async () => {
    await page.goto('https://www.my-website.com');

    const result = await startScreenReader({
      waitForStable: true
    });

    expect(result).toMatchSnapshot();
  });
});

This is very much a work in progress! I would love your help to make this more stable!

Currently working

  • Turning on VoiceOver (Mac OS), reading VoiceOver output as text, turning off VoiceOver.
  • Turning on NVDA (Windows), reading NVDA output as text, turning off NVDA.

Goals

  • More stability. There is some unexpected behaviour when running the tests with Puppeteer that I'm sure people with more screen reader experience will be able to explain.
  • More screen readers. It would be good to get this working with JAWS and other commonly used screen readers.
  • Other things?

Installation

npm install screen-reader-reader --save-dev

Usage

CLI

There is a very basic CLI. It will enable the given screen reader (or automatically detect one), and read the screen reader output until it is stable.

npx screen-reader-reader

JavaScript

Import

import { startScreenReader } from 'screen-reader-reader';

When using the API from JavaScript, there are two distinct modes:

Stable mode

const result = await startScreenReader({
  waitForStable: true
});

console.log(result);

Manual mode

const stop = await startScreenReader();

// Do whatever you want to do...

const result = await stop();

Options

The startScreenReader function takes a number of options:

type Options = {
  screenreader: ScreenReaderName; // Default = from local environment
  pollTimeout: number; // Default = 100ms
  stableTimeout: number; // Default = 10000ms
  waitForStable: boolean; // Default = false
  filters: Array<RegExp>; // Default = []
  mappers: Array<(t: string) => string>; // Default = []
};

const enum ScreenReaderName {
  voiceover,
  nvda
}
0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago