mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 08:02:28 +00:00
test(e2e): track the input-source selector the macOS specs shell out to
Five tracked macOS IME specs ran `swift .tmp/select-input-source.swift`, a file that is gitignored and existed only on one machine. Anyone else checking out the repo — or the same machine after .tmp is cleaned — could not run them, and they are the capture drivers for the macOS rows that are blocked waiting for exactly those runs. Moves it to tests/e2e/ beside its callers. The chord spec now resolves it from __dirname rather than reaching two levels up into .tmp.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import Carbon
|
||||
|
||||
guard CommandLine.arguments.count == 2 else {
|
||||
exit(2)
|
||||
}
|
||||
|
||||
let properties = [kTISPropertyInputSourceID: CommandLine.arguments[1] as CFString] as CFDictionary
|
||||
let sources = TISCreateInputSourceList(properties, true).takeRetainedValue() as! [TISInputSource]
|
||||
guard let source = sources.first else {
|
||||
exit(3)
|
||||
}
|
||||
|
||||
TISEnableInputSource(source)
|
||||
exit(TISSelectInputSource(source) == noErr ? 0 : 4)
|
||||
@@ -71,7 +71,7 @@ test.describe('Native macOS automatic period substitution @headful', () => {
|
||||
await startTerminalImeByteReader(orcaPage, ptyId, hangulReader)
|
||||
await focusActiveTerminalInput(orcaPage)
|
||||
await installTerminalImeBoundaryProbe(orcaPage)
|
||||
execFileSync('swift', ['.tmp/select-input-source.swift', KOREAN_ID])
|
||||
execFileSync('swift', ['tests/e2e/select-input-source.swift', KOREAN_ID])
|
||||
await waitForInputSource(orcaPage, KOREAN_ID)
|
||||
|
||||
typePhysicalKeys(electronApp.process().pid!, [2, 40, 49])
|
||||
@@ -84,7 +84,7 @@ test.describe('Native macOS automatic period substitution @headful', () => {
|
||||
await startTerminalImeByteReader(orcaPage, ptyId, abcReader)
|
||||
await focusActiveTerminalInput(orcaPage)
|
||||
|
||||
execFileSync('swift', ['.tmp/select-input-source.swift', ABC_ID])
|
||||
execFileSync('swift', ['tests/e2e/select-input-source.swift', ABC_ID])
|
||||
await waitForInputSource(orcaPage, ABC_ID)
|
||||
typePhysicalKeys(electronApp.process().pid!, [47, 49, 36])
|
||||
|
||||
@@ -102,7 +102,7 @@ test.describe('Native macOS automatic period substitution @headful', () => {
|
||||
{ abcPty, automaticPeriodPreference: true, hangulBeforeEnter, hangulPty }
|
||||
)
|
||||
} finally {
|
||||
execFileSync('swift', ['.tmp/select-input-source.swift', ABC_ID])
|
||||
execFileSync('swift', ['tests/e2e/select-input-source.swift', ABC_ID])
|
||||
await disposeTerminalImeBoundaryProbe(orcaPage).catch(() => undefined)
|
||||
removeTerminalImeByteReader(hangulReader)
|
||||
removeTerminalImeByteReader(abcReader)
|
||||
|
||||
@@ -69,7 +69,7 @@ function typeKeyCodes(processId: number, keyCodes: readonly number[]): void {
|
||||
}
|
||||
|
||||
function selectInputSource(inputSourceId: string): void {
|
||||
execFileSync('swift', ['.tmp/select-input-source.swift', inputSourceId])
|
||||
execFileSync('swift', ['tests/e2e/select-input-source.swift', inputSourceId])
|
||||
}
|
||||
|
||||
async function readActiveComposition(page: Page): Promise<string | null> {
|
||||
|
||||
@@ -33,7 +33,7 @@ import {
|
||||
*/
|
||||
|
||||
const TWO_SET_KOREAN_ID = 'com.apple.inputmethod.Korean.2SetKorean'
|
||||
const SELECT_INPUT_SOURCE = path.resolve(__dirname, '../../.tmp/select-input-source.swift')
|
||||
const SELECT_INPUT_SOURCE = path.resolve(__dirname, 'select-input-source.swift')
|
||||
|
||||
// 2-Set Korean: ㅎ = key code 5, ㅏ = key code 40, Space = 49. Three `하` separated by spaces,
|
||||
// matching the byte expectations preserved below.
|
||||
|
||||
@@ -59,7 +59,7 @@ function typeKeyCodes(processId: number, keyCodes: readonly number[]): void {
|
||||
}
|
||||
|
||||
function selectInputSource(inputSourceId: string): void {
|
||||
execFileSync('swift', ['.tmp/select-input-source.swift', inputSourceId])
|
||||
execFileSync('swift', ['tests/e2e/select-input-source.swift', inputSourceId])
|
||||
}
|
||||
|
||||
async function readActiveComposition(page: Page): Promise<string | null> {
|
||||
|
||||
@@ -57,7 +57,7 @@ function typeKeyCodes(processId: number, keyCodes: readonly number[]): void {
|
||||
}
|
||||
|
||||
function selectInputSource(inputSourceId: string): void {
|
||||
execFileSync('swift', ['.tmp/select-input-source.swift', inputSourceId])
|
||||
execFileSync('swift', ['tests/e2e/select-input-source.swift', inputSourceId])
|
||||
}
|
||||
|
||||
test.describe('Native macOS Vietnamese terminal input @headful', () => {
|
||||
|
||||
Reference in New Issue
Block a user