Skip to content

Commit 32ac916

Browse files
authored
feat: default capture to "initial", allow logs to be preserved in navigateToWebContent, improve navigateToWebContent command (#34)
1 parent 0f01940 commit 32ac916

12 files changed

Lines changed: 147 additions & 151 deletions

File tree

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ on:
1717
pull_request:
1818
# The branches below must be a subset of the branches above
1919
branches: [main]
20-
schedule:
21-
- cron: "34 4 * * 6"
2220

2321
jobs:
2422
analyze:
@@ -38,7 +36,7 @@ jobs:
3836

3937
steps:
4038
- name: Checkout repository
41-
uses: actions/checkout@v5
39+
uses: actions/checkout@v6
4240

4341
# Initializes the CodeQL tools for scanning.
4442
- name: Initialize CodeQL

.github/workflows/publish.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
name: Publish
22

3-
permissions:
4-
contents: read
5-
63
on:
74
release:
85
types: [created]
96

7+
permissions:
8+
id-token: write
9+
contents: read
10+
1011
jobs:
1112
publish:
1213
runs-on: ubuntu-latest
1314
steps:
14-
- uses: actions/checkout@v5
15+
- uses: actions/checkout@v6
1516
- uses: actions/setup-node@v6
1617
with:
1718
node-version-file: .nvmrc
18-
registry-url: https://registry.npmjs.org/
19-
always-auth: true
19+
registry-url: https://registry.npmjs.org
20+
package-manager-cache: false
2021
- run: yarn install --frozen-lockfile
21-
- run: npm publish --access public
22-
env:
23-
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
24-
CI: true
22+
- run: npm publish

.github/workflows/test-nvda.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
name: Test NVDA
22

3-
permissions:
4-
contents: read
5-
63
on:
74
push:
85
branches: [main]
96
pull_request:
107
branches: [main]
118

9+
permissions:
10+
contents: read
11+
1212
jobs:
1313
test-nvda:
1414
runs-on: ${{ matrix.os }}
1515
strategy:
16+
fail-fast: false
1617
matrix:
1718
os: [windows-2022, windows-2025]
1819
browser: [chromium, firefox]
1920
steps:
20-
- uses: actions/checkout@v5
21+
- uses: actions/checkout@v6
2122
- uses: actions/setup-node@v6
2223
with:
2324
node-version-file: .nvmrc
2425
- name: Guidepup Setup
25-
uses: guidepup/setup-action@0.19.0
26+
uses: guidepup/setup-action@0.20.0
2627
with:
2728
record: true
2829
- run: yarn install --frozen-lockfile

.github/workflows/test-voiceover.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
name: Test VoiceOver
22

3-
permissions:
4-
contents: read
5-
63
on:
74
push:
85
branches: [main]
96
pull_request:
107
branches: [main]
118

9+
permissions:
10+
contents: read
11+
1212
jobs:
1313
test-voiceover:
1414
runs-on: ${{ matrix.os }}
1515
strategy:
16+
fail-fast: false
1617
matrix:
17-
os: [macos-14]
18+
os: [macos-14, macos-15, macos-15-intel, macos-26, macos-26-intel]
1819
browser: [chromium, firefox, webkit]
1920
steps:
20-
- uses: actions/checkout@v5
21+
- uses: actions/checkout@v6
2122
- uses: actions/setup-node@v6
2223
with:
2324
node-version-file: .nvmrc
2425
- name: Guidepup Setup
25-
uses: guidepup/setup-action@0.19.0
26+
uses: guidepup/setup-action@0.20.0
2627
with:
2728
record: true
2829
- run: yarn install --frozen-lockfile

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
name: Test
22

3-
permissions:
4-
contents: read
5-
63
on:
74
push:
85
branches: [main]
96
pull_request:
107
branches: [main]
118

9+
permissions:
10+
contents: read
11+
1212
jobs:
1313
test:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v5
16+
- uses: actions/checkout@v6
1717
- uses: actions/setup-node@v6
1818
with:
1919
node-version-file: .nvmrc

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
},
99
"[typescript]": {
1010
"editor.defaultFormatter": "esbenp.prettier-vscode"
11-
}
11+
},
12+
"js/ts.tsdk.path": "node_modules/typescript/lib"
1213
}

README.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66

77
## [Documentation](https://guidepup.dev) | [API Reference](https://www.guidepup.dev/docs/api/class-guidepup)
88

9-
[![MacOS Monetary Support](https://img.shields.io/badge/macos-Monetary-blue.svg?logo=apple)](https://apps.apple.com/us/app/macos-monterey/id1576738294)
10-
[![MacOS Ventura Support](https://img.shields.io/badge/macos-Ventura-blue.svg?logo=apple)](https://apps.apple.com/us/app/macos-ventura/id1638787999)
119
[![MacOS Sonoma Support](https://img.shields.io/badge/macos-Somona-blue.svg?logo=apple)](https://apps.apple.com/us/app/macos-sonoma/id6450717509)
12-
[![Windows 10 Support](https://img.shields.io/badge/windows-10-blue.svg?logo=windows10)](https://www.microsoft.com/en-gb/software-download/windows10ISO)
13-
[![Windows Server 2019 Support](https://img.shields.io/badge/windows_server-2019-blue.svg?logo=windows)](https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2019)
10+
[![MacOS Sequoia Support](https://img.shields.io/badge/macos-Somona-blue.svg?logo=apple)](https://apps.apple.com/us/app/macos-sequoia/id6596773750)
11+
[![MacOS Tahoe Support](https://img.shields.io/badge/macos-Tahoe-blue.svg?logo=apple)](https://www.apple.com/uk/os/macos/)
1412
[![Windows Server 2022 Support](https://img.shields.io/badge/windows_server-2022-blue.svg?logo=windows)](https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2022)
13+
[![Windows Server 2025 Support](https://img.shields.io/badge/windows_server-2025-blue.svg?logo=windows)](https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2025)
1514

1615
This package provides [Guidepup](https://github.com/guidepup/guidepup) integration with [Playwright](https://playwright.dev/) for writing screen reader tests that automate <a href="https://www.guidepup.dev/docs/api/class-voiceover"><b>VoiceOver on MacOS</b></a> and <a href="https://www.guidepup.dev/docs/api/class-nvda"><b>NVDA on Windows</b></a>.
1716

@@ -95,7 +94,7 @@ await nvda.navigateToWebContent();
9594
// ... some commands
9695
```
9796

98-
**Note:** This command clears all logs meaning `.spokenPhraseLog()` and `.itemTextLog()` are emptied. If logs from prior to the command are required, first store the logs in a variable for later use:
97+
**Note:** This command clears all logs by default meaning `.spokenPhraseLog()` and `.itemTextLog()` are emptied. If logs from prior to the command are required, either store the logs in a variable for later use:
9998

10099
```ts
101100
// ... some commands
@@ -114,6 +113,17 @@ const allSpokenPhrases = [...spokenPhrases, ...(await nvda.spokenPhraseLog())];
114113
// ... do something with spoken phrases
115114
```
116115

116+
or pass a flag to prevent log clearing:
117+
118+
```ts
119+
// ... some commands
120+
121+
// Navigate to the web content
122+
await nvda.navigateToWebContent(false);
123+
124+
// ... some commands
125+
```
126+
117127
### Providing Screen Reader Start Options
118128

119129
The options provided to `nvda.start([options])` or `voiceOver.start([options])` can be configured using `test.use(config)` as follows:
@@ -122,16 +132,20 @@ The options provided to `nvda.start([options])` or `voiceOver.start([options])`
122132
// VoiceOver Example
123133
import { voiceOverTest as test } from "@guidepup/playwright";
124134
125-
test.use({ voiceOverStartOptions: { capture: "initial" } });
135+
// Capture all spoken phrases, including usage hints
136+
test.use({ voiceOverStartOptions: { capture: true } });
126137
```
127138

128139
```ts
129140
// NVDA Example
130141
import { nvdaTest as test } from "@guidepup/playwright";
131142
132-
test.use({ nvdaStartOptions: { capture: "initial" } });
143+
// Capture all spoken phrases, including usage hints
144+
test.use({ nvdaStartOptions: { capture: true } });
133145
```
134146

147+
The default for VoiceOver and NVDA is set to `"initial"`. `true` captures all spoken phrases, including usage hints. `false` disables spoken phrase capture.
148+
135149
### VoiceOver Example
136150

137151
`playwright.config.ts`:
@@ -148,6 +162,8 @@ const config: PlaywrightTestConfig = {
148162
projects: [
149163
{
150164
name: "webkit",
165+
// Take care to ensure all usage is headed - screen readers cannot
166+
// operate against headless browsers.
151167
use: { ...devices["Desktop Safari"], headless: false },
152168
},
153169
],
@@ -206,6 +222,8 @@ const config: PlaywrightTestConfig = {
206222
projects: [
207223
{
208224
name: "firefox",
225+
// Take care to ensure all usage is headed - screen readers cannot
226+
// operate against headless browsers.
209227
use: { ...devices["Desktop Firefox"], headless: false },
210228
},
211229
],

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"name": "@guidepup/playwright",
3-
"version": "0.15.0",
3+
"version": "0.16.0",
44
"description": "Screen reader driver for Playwright tests.",
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",
77
"author": "Craig Morten <craig.morten@hotmail.co.uk>",
88
"license": "MIT",
99
"repository": {
1010
"type": "git",
11-
"url": "https://github.com/guidepup/guidepup-playwright"
11+
"url": "git+https://github.com/guidepup/guidepup-playwright.git"
1212
},
1313
"bugs": {
1414
"url": "https://github.com/guidepup/guidepup-playwright/issues"
@@ -42,9 +42,9 @@
4242
"test:voiceover:webkit": "playwright test --config ./examples/playwright-voiceover/webkit.config.ts ./examples/playwright-voiceover/tests/webkit/"
4343
},
4444
"devDependencies": {
45-
"@guidepup/guidepup": "^0.24.1",
45+
"@guidepup/guidepup": "^0.25.0",
4646
"@guidepup/record": "^0.1.0",
47-
"@playwright/test": "^1.58.0",
47+
"@playwright/test": "^1.60.0",
4848
"@types/node": "^24.10.1",
4949
"@typescript-eslint/eslint-plugin": "^8.48.1",
5050
"@typescript-eslint/parser": "^8.48.1",
@@ -56,7 +56,7 @@
5656
"typescript": "^5.9.3"
5757
},
5858
"peerDependencies": {
59-
"@guidepup/guidepup": ">=0.22.1",
59+
"@guidepup/guidepup": ">=0.25.0",
6060
"@playwright/test": "^1.57.0"
6161
},
6262
"resolutions": {

0 commit comments

Comments
 (0)