Files
orca/tests/e2e/status-bar-caffeinate.spec.ts
T
Wooseong Kimandm4air 60a3fd8873 fix(i18n): localize the keep-awake corner chip (#14775)
* fix(i18n): localize the keep-awake corner chip

Route the status-bar keep-awake chip through the shared Agents copy
helpers and add missing locale entries for chip-only words.

Fixes #14490

* test(i18n): restore previous language after keep-awake locale suite

* test(i18n): render component in localization tests instead of static che

Converts the keep-awake localization test from static source-code validation to actual component rendering with React Testing Library, providing more reliable verification that the UI displays correctly across all supported languages. Improves translated descriptions for consistency and accuracy.

* test(i18n): add aria labels and descriptions to localization test

- Adds missing localization keys to test data for Spanish, Japanese, Korean, and Simplified Chinese
- Updates test assertions to verify `ariaLabel`, `onDescription`, `autoDescription`, and `offDescription` are properly translated
- Completes localization coverage for the keep-awake corner chip component

---------

Co-authored-by: m4air <m4air@m4airs-Air.localdomain>
2026-08-24 22:46:29 -07:00

73 lines
2.5 KiB
TypeScript

import { randomUUID } from 'node:crypto'
import type { ElectronApplication } from '@stablyai/playwright-test'
import { test, expect } from './helpers/orca-app'
import { waitForSessionReady } from './helpers/store'
import { readHookEndpoint } from './helpers/agent-hook-endpoint'
async function postCodexHookEvent(
electronApp: ElectronApplication,
paneKey: string,
eventName: 'UserPromptSubmit' | 'Stop'
): Promise<void> {
const endpoint = await readHookEndpoint(electronApp)
const response = await fetch(`http://127.0.0.1:${endpoint.port}/hook/codex`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Orca-Agent-Hook-Token': endpoint.token
},
body: JSON.stringify({
paneKey,
tabId: 'e2e-caffeinate-tab',
worktreeId: 'e2e-caffeinate-worktree',
env: endpoint.env,
version: endpoint.version,
payload: { hook_event_name: eventName, prompt: 'e2e caffeinate prompt' }
})
})
expect(response.status).toBe(204)
}
test('shows keep-awake mode and Agent activity in the status bar', async ({
electronApp,
orcaPage
}) => {
await waitForSessionReady(orcaPage)
const offStatus = orcaPage.getByRole('button', {
name: 'Keep computer awake, Off · Inactive'
})
await expect(offStatus).toBeVisible()
await expect(offStatus).toHaveText('Off')
await offStatus.click()
await expect(orcaPage.getByRole('menuitemradio', { name: /^On/ })).toBeVisible()
await expect(orcaPage.getByRole('menuitemradio', { name: /^Agent/ })).toBeVisible()
await expect(orcaPage.getByRole('menuitemradio', { name: /^Off/ })).toBeVisible()
const menuProofPath = process.env.ORCA_CAFFEINATE_MENU_PROOF_PATH
if (menuProofPath) {
await orcaPage.screenshot({ path: menuProofPath })
}
await orcaPage.getByRole('menuitemradio', { name: /^Agent/ }).click()
const agentInactiveStatus = orcaPage.getByRole('button', {
name: 'Keep computer awake, Agent · Inactive'
})
await expect(agentInactiveStatus).toBeVisible()
const paneKey = `e2e-caffeinate-tab:${randomUUID()}`
await postCodexHookEvent(electronApp, paneKey, 'UserPromptSubmit')
const agentActiveStatus = orcaPage.getByRole('button', {
name: 'Keep computer awake, Agent · Active'
})
await expect(agentActiveStatus).toBeVisible()
await expect(agentActiveStatus).toHaveText('Agent')
const proofPath = process.env.ORCA_CAFFEINATE_PROOF_PATH
if (proofPath) {
await orcaPage.screenshot({ path: proofPath })
}
await postCodexHookEvent(electronApp, paneKey, 'Stop')
await expect(agentInactiveStatus).toBeVisible()
})