Skip to content

Commit

Permalink
Merge pull request #6 from github/enable-auto-publish
Browse files Browse the repository at this point in the history
enable auto publish
  • Loading branch information
keithamus authored Oct 17, 2024
2 parents 32a8e04 + 061cee6 commit e4db31e
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 46 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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}}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
94 changes: 49 additions & 45 deletions tests/index.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {});
}

0 comments on commit e4db31e

Please sign in to comment.