Expand AITURK Turkish settings and desktop surfaces for beta 5

This commit is contained in:
2026-09-06 05:03:32 +03:00
parent 237d1e2060
commit 5e76f58637
108 changed files with 6675 additions and 1034 deletions
+5 -5
View File
@@ -27,7 +27,7 @@ import * as path from 'node:path'
import { _electron, type ElectronApplication, type Page } from '@playwright/test'
import { resolveElectronBinary } from './electron-binary'
import { startMockServer, type MockServerOptions } from './mock-server'
import { type MockServerOptions, startMockServer } from './mock-server'
import { installErrorBannerGuard } from './test'
const DESKTOP_ROOT = path.resolve(import.meta.dirname, '..')
@@ -259,6 +259,8 @@ export function buildAppEnv(sandbox: Sandbox, extra: Record<string, string> = {}
return {
...clean,
// AITURK ignores inherited Hermes state; use the same explicit sandbox.
AITURK_IDE_HOME: sandbox.hermesHome,
HERMES_HOME: sandbox.hermesHome,
HERMES_DESKTOP_USER_DATA_DIR: sandbox.userDataDir,
HERMES_DESKTOP_IGNORE_EXISTING: '1',
@@ -366,6 +368,7 @@ export interface MockBackendFixture {
}
export interface MockBackendOptions {
mockServer?: MockServerOptions
/**
* Optional YAML lines to inject under the `display:` section of the
* generated config.yaml. Used by the interim-message e2e test to toggle
@@ -385,10 +388,6 @@ export interface MockBackendOptions {
* 3. Launch the desktop app
* 4. Return handles for test interaction
*/
export interface MockBackendOptions {
mockServer?: MockServerOptions
}
export async function setupMockBackend(options: MockBackendOptions = {}): Promise<MockBackendFixture> {
// 1. Start mock server
const mock = await startMockServer(options.mockServer)
@@ -643,6 +642,7 @@ export async function waitForAppReady(fixture: MockBackendFixture | NoProviderFi
// `position: fixed; inset: 0`. If the hit element or an ancestor
// is a full-viewport fixed overlay, we're still covered.
let node: Element | null = el
while (node) {
const cs = window.getComputedStyle(node)
+77
View File
@@ -0,0 +1,77 @@
import { execFileSync } from 'node:child_process'
import * as path from 'node:path'
import { type MockBackendFixture, setupMockBackend, waitForAppReady } from './fixtures'
import { expect, test } from './test'
let fixture: MockBackendFixture | null = null
type DesktopTestWindow = Window & {
hermesDesktop: { api<T = unknown>(request: { path: string }): Promise<T> }
}
test.beforeAll(async () => {
test.setTimeout(150_000)
fixture = await setupMockBackend({ extraDisplayConfig: ' language: tr' })
await waitForAppReady(fixture, 120_000)
await expect
.poll(
async () => {
const status = await fixture!.page.evaluate(() =>
(window as unknown as DesktopTestWindow).hermesDesktop.api({ path: '/api/status' })
)
return Boolean(status)
},
{ timeout: 30_000 }
)
.toBe(true)
})
test.afterAll(async () => {
await fixture?.cleanup()
fixture = null
})
test('Turkish safety settings persist the backend enum through the real desktop bridge', async () => {
const { page, sandbox } = fixture!
await page.evaluate(() => {
window.location.hash = '/settings?tab=config%3Asafety'
})
await expect(page.getByText('Gizli bilgileri maskele', { exact: true })).toBeVisible()
await expect(
page.getByText('Algılanan gizli bilgileri mümkün olduğunda modelin görebildiği içerikten gizler.', { exact: true })
).toBeVisible()
const approvals = page.locator('[data-tour="field-approvals.mode"]')
await approvals.getByRole('combobox').click()
await page.getByRole('option', { name: 'Elle onayla', exact: true }).click()
await expect
.poll(
async () => {
const config = await page.evaluate(() =>
(window as unknown as DesktopTestWindow).hermesDesktop.api<Record<string, unknown>>({ path: '/api/config' })
)
return (config.approvals as { mode?: string } | undefined)?.mode
},
{ timeout: 30_000 }
)
.toBe('manual')
await expect
.poll(
() => {
return execFileSync(
process.env.HERMES_DESKTOP_PYTHON || 'python',
[
'-c',
'import pathlib, sys, yaml; print(yaml.safe_load(pathlib.Path(sys.argv[1]).read_text(encoding="utf-8")).get("approvals", {}).get("mode", ""))',
path.join(sandbox.hermesHome, 'config.yaml')
],
{ encoding: 'utf8' }
).trim()
},
{ timeout: 15_000 }
)
.toBe('manual')
await expect(approvals.getByRole('combobox')).toContainText('Elle onayla')
await page.screenshot({ path: test.info().outputPath('turkish-safety-settings.png'), fullPage: true })
})