@guidepup/playwright 0.16.1 → 0.16.3
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/lib/nvdaTest.js +16 -3
- package/lib/voiceOverTest.js +5 -5
- package/package.json +2 -2
package/lib/nvdaTest.js
CHANGED
|
@@ -14,9 +14,19 @@ const MOVE_TO_TOP = {
|
|
|
14
14
|
keyCode: [guidepup_1.WindowsKeyCodes.Home],
|
|
15
15
|
modifiers: [guidepup_1.WindowsModifiers.Control],
|
|
16
16
|
};
|
|
17
|
+
const cleanString = (str) => str
|
|
18
|
+
.toLowerCase()
|
|
19
|
+
// REF: https://github.com/nvaccess/nvda/blob/master/source/locale/en/symbols.dic
|
|
20
|
+
.replace(/[|¦:;'"`\-‐–—·_()[\]{}\\^~]/g, " ")
|
|
21
|
+
.replace(/\s+/g, " ")
|
|
22
|
+
.trim();
|
|
17
23
|
const hasFocus = ({ applicationName, pageTitle, windowTitle, }) => {
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
const cleanedApplicationName = cleanString(applicationName);
|
|
25
|
+
const cleanedPageTitle = cleanString(pageTitle);
|
|
26
|
+
const cleanedWindowTitle = cleanString(windowTitle);
|
|
27
|
+
return ((cleanedPageTitle.length &&
|
|
28
|
+
cleanedWindowTitle.startsWith(cleanedPageTitle)) ||
|
|
29
|
+
cleanedWindowTitle.includes(cleanedApplicationName));
|
|
20
30
|
};
|
|
21
31
|
const focusBrowser = async ({ applicationName, pageTitle, }) => {
|
|
22
32
|
await nvdaPlaywright.perform(nvdaPlaywright.keyboardCommands.reportTitle);
|
|
@@ -56,7 +66,10 @@ exports.nvdaTest = test_1.test.extend({
|
|
|
56
66
|
await nvdaPlaywright.perform(nvdaPlaywright.keyboardCommands.exitFocusMode);
|
|
57
67
|
const pageTitle = await page.title();
|
|
58
68
|
// Ensure application is brought to front and focused.
|
|
59
|
-
await focusBrowser({
|
|
69
|
+
await focusBrowser({
|
|
70
|
+
applicationName,
|
|
71
|
+
pageTitle,
|
|
72
|
+
});
|
|
60
73
|
// Ensure the document is ready and focused.
|
|
61
74
|
await page.bringToFront();
|
|
62
75
|
await page.locator("body").waitFor();
|
package/lib/voiceOverTest.js
CHANGED
|
@@ -27,11 +27,11 @@ exports.voiceOverTest = test_1.test.extend({
|
|
|
27
27
|
// Ensure the document is ready and focused.
|
|
28
28
|
await page.bringToFront();
|
|
29
29
|
await page.locator("body").waitFor();
|
|
30
|
-
// Open the web item
|
|
31
|
-
await voiceOverPlaywright.perform(voiceOverPlaywright.keyboardCommands.
|
|
32
|
-
// Filter by "content" - currently web content
|
|
33
|
-
// are
|
|
34
|
-
await voiceOverPlaywright.type("content");
|
|
30
|
+
// Open the web item chooser.
|
|
31
|
+
await voiceOverPlaywright.perform(voiceOverPlaywright.keyboardCommands.openItemChooser);
|
|
32
|
+
// Filter by "web content" - currently web content items for all browsers
|
|
33
|
+
// are suffixed by "web content".
|
|
34
|
+
await voiceOverPlaywright.type("web content");
|
|
35
35
|
// Select the web content window spot.
|
|
36
36
|
await voiceOverPlaywright.perform({ keyCode: guidepup_1.MacOSKeyCodes.Enter });
|
|
37
37
|
// Navigate into web content.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guidepup/playwright",
|
|
3
|
-
"version": "0.16.
|
|
4
|
-
"description": "Screen reader
|
|
3
|
+
"version": "0.16.3",
|
|
4
|
+
"description": "Screen reader automation library for Playwright testing. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"author": "Craig Morten <craig.morten@hotmail.co.uk>",
|