@guidepup/playwright 0.7.5 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +16 -16
- package/lib/voTest.d.ts +1 -1
- package/lib/voTest.js +13 -5
- package/package.json +5 -5
- package/yarn.lock +4 -4
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<h1 align="center">Guidepup Playwright</h1>
|
|
2
2
|
<p align="center">
|
|
3
|
-
<i>Screen
|
|
3
|
+
<i>Screen reader driver for Playwright tests.</i>
|
|
4
4
|
</p>
|
|
5
5
|
<p align="center">
|
|
6
6
|
<a href="https://www.npmjs.com/package/@guidepup/playwright"><img alt="@guidepup/playwright available on NPM" src="https://img.shields.io/npm/v/@guidepup/playwright" /></a>
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
<a href="https://github.com/guidepup/guidepup-playwright/blob/main/LICENSE"><img alt="@guidepup/playwright uses the MIT license" src="https://img.shields.io/github/license/guidepup/guidepup-playwright" /></a>
|
|
9
9
|
</p>
|
|
10
10
|
<p align="center">
|
|
11
|
-
Providing a reliable set of APIs to automate your screen
|
|
11
|
+
Providing a reliable set of APIs to automate your screen reader a11y workflows in Playwright.
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
|
-
## Getting Started
|
|
14
|
+
## Getting Started
|
|
15
15
|
|
|
16
16
|
Install `@guidepup/playwright` to your project:
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ Install `@guidepup/playwright` to your project:
|
|
|
19
19
|
npm install --save-dev @guidepup/playwright
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
And get cracking with your first screen
|
|
22
|
+
And get cracking with your first screen reader tests in Playwright!
|
|
23
23
|
|
|
24
24
|
```ts
|
|
25
25
|
import { voTest as test } from "@guidepup/playwright";
|
|
@@ -30,26 +30,26 @@ test.describe("Playwright VoiceOver", () => {
|
|
|
30
30
|
page,
|
|
31
31
|
voiceOver,
|
|
32
32
|
}) => {
|
|
33
|
-
// Navigate to Guidepup GitHub page
|
|
33
|
+
// Navigate to Guidepup GitHub page
|
|
34
34
|
await page.goto("https://github.com/guidepup/guidepup", {
|
|
35
35
|
waitUntil: "domcontentloaded",
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
// Wait for page to be ready and interact
|
|
38
|
+
// Wait for page to be ready and interact
|
|
39
39
|
await expect(page.locator('header[role="banner"]')).toBeVisible();
|
|
40
40
|
await voiceOver.interact();
|
|
41
41
|
|
|
42
|
-
// Move across the page menu to the Guidepup heading using VoiceOver
|
|
42
|
+
// Move across the page menu to the Guidepup heading using VoiceOver
|
|
43
43
|
while ((await voiceOver.itemText()) !== "Guidepup heading level 1") {
|
|
44
44
|
await voiceOver.perform(voiceOver.keyboard.commands.findNextHeading);
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
## Playwright Config
|
|
49
|
+
## Playwright Config
|
|
50
50
|
|
|
51
51
|
In your `playwright.config.ts` add the following for the best results with
|
|
52
|
-
Guidepup for VoiceOver automation.
|
|
52
|
+
Guidepup for VoiceOver automation.
|
|
53
53
|
|
|
54
54
|
```ts
|
|
55
55
|
import { devices, PlaywrightTestConfig } from "@playwright/test";
|
|
@@ -64,9 +64,9 @@ const config: PlaywrightTestConfig = {
|
|
|
64
64
|
export default config;
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
Check out the configuration this adds [in the voConfig.ts file](./src/voConfig.ts).
|
|
67
|
+
Check out the configuration this adds [in the voConfig.ts file](./src/voConfig.ts).
|
|
68
68
|
|
|
69
|
-
## Environment Setup
|
|
69
|
+
## Environment Setup
|
|
70
70
|
|
|
71
71
|
Setup your environment for screen-read automation with [`@guidepup/setup`](https://github.com/guidepup/setup):
|
|
72
72
|
|
|
@@ -78,19 +78,19 @@ If you are using GitHub Actions, check out the dedicated [`guidepup/setup-action
|
|
|
78
78
|
|
|
79
79
|
```yaml
|
|
80
80
|
- name: Setup Environment
|
|
81
|
-
uses: guidepup/setup-action@0.
|
|
81
|
+
uses: guidepup/setup-action@0.7.0
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
## Example
|
|
84
|
+
## Example
|
|
85
85
|
|
|
86
86
|
Check out [this VoiceOver example](./example/).
|
|
87
87
|
|
|
88
|
-
## See Also
|
|
88
|
+
## See Also
|
|
89
89
|
|
|
90
90
|
Checkout the core [`@guidepup/guidepup`](https://github.com/guidepup/guidepup)
|
|
91
|
-
project to learn more about how you can automate your screen
|
|
91
|
+
project to learn more about how you can automate your screen reader workflows
|
|
92
92
|
using Guidepup.
|
|
93
93
|
|
|
94
|
-
## License
|
|
94
|
+
## License
|
|
95
95
|
|
|
96
96
|
[MIT](https://github.com/guidepup/guidepup/blob/main/LICENSE)
|
package/lib/voTest.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { voiceOver } from "@guidepup/guidepup";
|
|
2
2
|
/**
|
|
3
3
|
* These tests extend the default Playwright environment that launches the
|
|
4
|
-
* browser with a running instance of the VoiceOver screen
|
|
4
|
+
* browser with a running instance of the VoiceOver screen reader for MacOS.
|
|
5
5
|
*
|
|
6
6
|
* A fresh started VoiceOver instance `vo` is provided to each test.
|
|
7
7
|
*/
|
package/lib/voTest.js
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.voTest = void 0;
|
|
4
|
-
/* eslint-disable no-empty-pattern */
|
|
5
4
|
const test_1 = require("@playwright/test");
|
|
6
5
|
const guidepup_1 = require("@guidepup/guidepup");
|
|
7
|
-
const
|
|
6
|
+
const applicationNameMap = {
|
|
7
|
+
chromium: "Chromium",
|
|
8
|
+
chrome: "Google Chrome",
|
|
9
|
+
"chrome-beta": "Google Chrome Beta",
|
|
10
|
+
msedge: "Microsoft Edge",
|
|
11
|
+
"msedge-beta": "Microsoft Edge Beta",
|
|
12
|
+
"msedge-dev": "Microsoft Edge Dev",
|
|
13
|
+
firefox: "Nightly",
|
|
14
|
+
webkit: "Playwright",
|
|
15
|
+
};
|
|
8
16
|
/**
|
|
9
17
|
* These tests extend the default Playwright environment that launches the
|
|
10
|
-
* browser with a running instance of the VoiceOver screen
|
|
18
|
+
* browser with a running instance of the VoiceOver screen reader for MacOS.
|
|
11
19
|
*
|
|
12
20
|
* A fresh started VoiceOver instance `vo` is provided to each test.
|
|
13
21
|
*/
|
|
14
22
|
const voTest = test_1.test.extend({
|
|
15
|
-
voiceOver: async ({}, use) => {
|
|
23
|
+
voiceOver: async ({ browserName }, use) => {
|
|
16
24
|
try {
|
|
17
25
|
await guidepup_1.voiceOver.start();
|
|
18
|
-
await (0, guidepup_1.macOSActivate)(
|
|
26
|
+
await (0, guidepup_1.macOSActivate)(applicationNameMap[browserName]);
|
|
19
27
|
await use(guidepup_1.voiceOver);
|
|
20
28
|
}
|
|
21
29
|
finally {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guidepup/playwright",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Screen
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "Screen reader driver for Playwright tests.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"author": "Craig Morten <craig.morten@hotmail.co.uk>",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"lint": "eslint . --ext .ts",
|
|
30
30
|
"lint:fix": "yarn lint --fix",
|
|
31
31
|
"prepublish": "yarn build",
|
|
32
|
-
"pretest": "npx playwright install webkit",
|
|
33
|
-
"test": "playwright test -c ./example/playwright.config.ts ./example/tests/
|
|
32
|
+
"pretest": "npx playwright install webkit chromium",
|
|
33
|
+
"test": "playwright test -c ./example/playwright.config.ts ./example/tests/"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@guidepup/guidepup": "^0.
|
|
36
|
+
"@guidepup/guidepup": "^0.15.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@playwright/test": "^1.28.1",
|
package/yarn.lock
CHANGED
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
minimatch "^3.0.4"
|
|
30
30
|
strip-json-comments "^3.1.1"
|
|
31
31
|
|
|
32
|
-
"@guidepup/guidepup@^0.
|
|
33
|
-
version "0.
|
|
34
|
-
resolved "https://registry.yarnpkg.com/@guidepup/guidepup/-/guidepup-0.
|
|
35
|
-
integrity sha512-
|
|
32
|
+
"@guidepup/guidepup@^0.15.0":
|
|
33
|
+
version "0.15.0"
|
|
34
|
+
resolved "https://registry.yarnpkg.com/@guidepup/guidepup/-/guidepup-0.15.0.tgz#d9cd40f933f31c03d65f6bef9a31fee953654cc0"
|
|
35
|
+
integrity sha512-MUPtcp57e6Ehtgtn29nb1spObIz4dUA3aTj+FL4RGBGmv2q+YPXJ0zEKP2MP04QsTAJ5fL8vN2nddmnGGxSS+w==
|
|
36
36
|
|
|
37
37
|
"@humanwhocodes/config-array@^0.9.2":
|
|
38
38
|
version "0.9.2"
|