@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 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
- return ((pageTitle.length && windowTitle.startsWith(pageTitle)) ||
19
- windowTitle.includes(applicationName));
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({ applicationName, pageTitle });
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();
@@ -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 rotor defaulting to window spots.
31
- await voiceOverPlaywright.perform(voiceOverPlaywright.keyboardCommands.openWebItemRotor);
32
- // Filter by "content" - currently web content spots for all browsers
33
- // are prefixed by "Content -".
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.1",
4
- "description": "Screen reader driver for Playwright tests.",
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>",