From 29a82813dc3e758ab05b7aa554e19cfe48d28540 Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Thu, 17 Oct 2024 09:42:28 +0100 Subject: [PATCH 1/2] enable auto publish --- .github/workflows/publish.yml | 29 +++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..a2e4fd5 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,29 @@ +name: Publish + +on: + release: + types: [created] + +permissions: + contents: read + id-token: write + +jobs: + publish-npm: + name: Publish to npm + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + registry-url: https://registry.npmjs.org/ + cache: npm + - run: npm ci + - run: npm test + - run: npm version ${TAG_NAME} --git-tag-version=false + env: + TAG_NAME: ${{ github.event.release.tag_name }} + - run: npm whoami; npm --ignore-scripts publish --provenance --access public + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/package.json b/package.json index 8205504..1d55151 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@github/arianotify-polyfill", - "version": "1.0.1", + "version": "0.0.0-development", "description": "Polyfill for the ARIA Notification API", "keywords": [], "license": "MIT", From 061cee6e4a4e833eba0baf5122009dfafdaf127b Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Thu, 17 Oct 2024 09:52:56 +0100 Subject: [PATCH 2/2] skip macos tests on non-macos --- tests/index.spec.mjs | 94 +++++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 45 deletions(-) diff --git a/tests/index.spec.mjs b/tests/index.spec.mjs index 32845ed..7a6551f 100644 --- a/tests/index.spec.mjs +++ b/tests/index.spec.mjs @@ -6,50 +6,54 @@ import { voiceOver } from "@guidepup/guidepup"; // Pre-requisites: // - Run `defaults write com.apple.VoiceOver4/default SCREnableAppleScript 1` -test.beforeAll(async () => { - // Start VoiceOver; ignore hints/descriptions - await voiceOver.start(); -}); - -test.beforeEach(async ({ page }) => { - // Navigate to Guidepup GitHub page - await page.goto("suggested-text/index.html", { - waitUntil: "load", +if (process.platform === 'darwin') { + test.beforeAll(async () => { + // Start VoiceOver; ignore hints/descriptions + await voiceOver.start(); }); - // From https://github.com/guidepup/guidepup-playwright/blob/34c3973dd98e19c81f468352e13bac5b8434b28f/src/voiceOverTest.ts#L97-L110: - - // Ensure the document is ready and focused. - await page.bringToFront(); - await page.locator("body").waitFor(); - await page.locator("body").focus(); - - // Navigate to the beginning of the web content. - await voiceOver.interact(); - await voiceOver.perform(voiceOver.keyboardCommands.jumpToLeftEdge); - - // Clear out logs. - await voiceOver.clearItemTextLog(); - await voiceOver.clearSpokenPhraseLog(); -}); - -test.afterAll(async () => { - // Stop VoiceOver - await voiceOver.stop(); -}); - -test("SuggestedText", async ({ page }) => { - // Type a completable string in the textarea - voiceOver.type("a"); - - // Wait for the suggestion to appear - await page.waitForTimeout(4000); - - // Assert that the spoken phrases are as expected - const lastSpokenPhrase = await voiceOver.lastSpokenPhrase(); - expect(lastSpokenPhrase.startsWith("a")).toBe(true); - expect(lastSpokenPhrase.includes("Suggestion: acceptable")).toBe(true); - expect( - lastSpokenPhrase.includes("Press right arrow to commit suggestion") - ).toBe(true); -}); + test.beforeEach(async ({ page }) => { + // Navigate to Guidepup GitHub page + await page.goto("suggested-text/index.html", { + waitUntil: "load", + }); + + // From https://github.com/guidepup/guidepup-playwright/blob/34c3973dd98e19c81f468352e13bac5b8434b28f/src/voiceOverTest.ts#L97-L110: + + // Ensure the document is ready and focused. + await page.bringToFront(); + await page.locator("body").waitFor(); + await page.locator("body").focus(); + + // Navigate to the beginning of the web content. + await voiceOver.interact(); + await voiceOver.perform(voiceOver.keyboardCommands.jumpToLeftEdge); + + // Clear out logs. + await voiceOver.clearItemTextLog(); + await voiceOver.clearSpokenPhraseLog(); + }); + + test.afterAll(async () => { + // Stop VoiceOver + await voiceOver.stop(); + }); + + test("SuggestedText", async ({ page }) => { + // Type a completable string in the textarea + voiceOver.type("a"); + + // Wait for the suggestion to appear + await page.waitForTimeout(4000); + + // Assert that the spoken phrases are as expected + const lastSpokenPhrase = await voiceOver.lastSpokenPhrase(); + expect(lastSpokenPhrase.startsWith("a")).toBe(true); + expect(lastSpokenPhrase.includes("Suggestion: acceptable")).toBe(true); + expect( + lastSpokenPhrase.includes("Press right arrow to commit suggestion") + ).toBe(true); + }); +} else { + test("Skipping macos tests", () => {}); +}