d3ro-voice/apps/desktop/tests/e2e/settings.spec.ts
Yun Chan 7fe49c437e chore: land in-progress workspace changes before 1.16.2
The tree carried uncommitted work from several areas (web push, mobile
screens, admin charts, test-hygiene cleanup, CI and map docs). It is landed
as one commit so the release pipeline can start from a clean tree; the
desktop transcript-correction behaviour shipped in the previous commit and
is unchanged here.
2026-11-05 21:58:44 +09:00

43 lines
2 KiB
TypeScript

// apps/desktop/tests/e2e/settings.spec.ts
// 설정 화면 계약: 탭 목록은 `SETTINGS_TAB_ORDER` 가 정본이므로 테스트도 그 상수를 읽는다.
// 탭 순서·개수를 테스트에 복사하면 탭을 옮길 때마다 두 곳을 고쳐야 한다 (SSOT 위반).
import { SETTINGS_TAB_ORDER, OPEN_SETTINGS_EVENT } from '../../src/renderer/navigation/settingsTabs'
import { expect, expectNoRuntimeErrors, goToRoute, test } from './support/electron-app'
test.describe('설정', () => {
test('사이드바 설정은 정본 탭 개수만큼 탭을 렌더하고 첫 탭을 선택한다', async ({ mainWindow }) => {
await goToRoute(mainWindow, 'settings')
const tabs = mainWindow.window.getByRole('tab')
await expect(tabs).toHaveCount(SETTINGS_TAB_ORDER.length)
await expect(mainWindow.window.getByTestId('settings-tab-general')).toHaveAttribute('aria-selected', 'true')
expectNoRuntimeErrors(mainWindow)
})
test('딥링크로 특정 탭을 열면 그 탭이 선택된다', async ({ mainWindow }) => {
await mainWindow.window.evaluate((eventName) => {
window.dispatchEvent(new CustomEvent(eventName, { detail: { tab: 'stt' } }))
}, OPEN_SETTINGS_EVENT)
await expect(mainWindow.window.getByTestId('settings-tab-stt')).toHaveAttribute('aria-selected', 'true')
await expect(mainWindow.window.getByRole('tab', { selected: true })).toHaveCount(1)
expectNoRuntimeErrors(mainWindow)
})
test('탭을 누르면 선택이 그 탭 하나로 바뀐다', async ({ mainWindow }) => {
await goToRoute(mainWindow, 'settings')
for (const tab of SETTINGS_TAB_ORDER) {
await test.step(tab, async () => {
await mainWindow.window.getByTestId(`settings-tab-${tab}`).click()
await expect(mainWindow.window.getByTestId(`settings-tab-${tab}`)).toHaveAttribute('aria-selected', 'true')
await expect(mainWindow.window.getByRole('tab', { selected: true })).toHaveCount(1)
})
}
expectNoRuntimeErrors(mainWindow)
})
})