Skip to content

Commit 061cee6

Browse files
committed
skip macos tests on non-macos
1 parent 29a8281 commit 061cee6

File tree

1 file changed

+49
-45
lines changed

1 file changed

+49
-45
lines changed

tests/index.spec.mjs

Lines changed: 49 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,50 +6,54 @@ import { voiceOver } from "@guidepup/guidepup";
66
// Pre-requisites:
77
// - Run `defaults write com.apple.VoiceOver4/default SCREnableAppleScript 1`
88

9-
test.beforeAll(async () => {
10-
// Start VoiceOver; ignore hints/descriptions
11-
await voiceOver.start();
12-
});
13-
14-
test.beforeEach(async ({ page }) => {
15-
// Navigate to Guidepup GitHub page
16-
await page.goto("suggested-text/index.html", {
17-
waitUntil: "load",
9+
if (process.platform === 'darwin') {
10+
test.beforeAll(async () => {
11+
// Start VoiceOver; ignore hints/descriptions
12+
await voiceOver.start();
1813
});
1914

20-
// From https://github.com/guidepup/guidepup-playwright/blob/34c3973dd98e19c81f468352e13bac5b8434b28f/src/voiceOverTest.ts#L97-L110:
21-
22-
// Ensure the document is ready and focused.
23-
await page.bringToFront();
24-
await page.locator("body").waitFor();
25-
await page.locator("body").focus();
26-
27-
// Navigate to the beginning of the web content.
28-
await voiceOver.interact();
29-
await voiceOver.perform(voiceOver.keyboardCommands.jumpToLeftEdge);
30-
31-
// Clear out logs.
32-
await voiceOver.clearItemTextLog();
33-
await voiceOver.clearSpokenPhraseLog();
34-
});
35-
36-
test.afterAll(async () => {
37-
// Stop VoiceOver
38-
await voiceOver.stop();
39-
});
40-
41-
test("SuggestedText", async ({ page }) => {
42-
// Type a completable string in the textarea
43-
voiceOver.type("a");
44-
45-
// Wait for the suggestion to appear
46-
await page.waitForTimeout(4000);
47-
48-
// Assert that the spoken phrases are as expected
49-
const lastSpokenPhrase = await voiceOver.lastSpokenPhrase();
50-
expect(lastSpokenPhrase.startsWith("a")).toBe(true);
51-
expect(lastSpokenPhrase.includes("Suggestion: acceptable")).toBe(true);
52-
expect(
53-
lastSpokenPhrase.includes("Press right arrow to commit suggestion")
54-
).toBe(true);
55-
});
15+
test.beforeEach(async ({ page }) => {
16+
// Navigate to Guidepup GitHub page
17+
await page.goto("suggested-text/index.html", {
18+
waitUntil: "load",
19+
});
20+
21+
// From https://github.com/guidepup/guidepup-playwright/blob/34c3973dd98e19c81f468352e13bac5b8434b28f/src/voiceOverTest.ts#L97-L110:
22+
23+
// Ensure the document is ready and focused.
24+
await page.bringToFront();
25+
await page.locator("body").waitFor();
26+
await page.locator("body").focus();
27+
28+
// Navigate to the beginning of the web content.
29+
await voiceOver.interact();
30+
await voiceOver.perform(voiceOver.keyboardCommands.jumpToLeftEdge);
31+
32+
// Clear out logs.
33+
await voiceOver.clearItemTextLog();
34+
await voiceOver.clearSpokenPhraseLog();
35+
});
36+
37+
test.afterAll(async () => {
38+
// Stop VoiceOver
39+
await voiceOver.stop();
40+
});
41+
42+
test("SuggestedText", async ({ page }) => {
43+
// Type a completable string in the textarea
44+
voiceOver.type("a");
45+
46+
// Wait for the suggestion to appear
47+
await page.waitForTimeout(4000);
48+
49+
// Assert that the spoken phrases are as expected
50+
const lastSpokenPhrase = await voiceOver.lastSpokenPhrase();
51+
expect(lastSpokenPhrase.startsWith("a")).toBe(true);
52+
expect(lastSpokenPhrase.includes("Suggestion: acceptable")).toBe(true);
53+
expect(
54+
lastSpokenPhrase.includes("Press right arrow to commit suggestion")
55+
).toBe(true);
56+
});
57+
} else {
58+
test("Skipping macos tests", () => {});
59+
}

0 commit comments

Comments
 (0)