forked from forthfate/openorbit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorbit-ui.spec.ts
More file actions
135 lines (123 loc) · 8.31 KB
/
Copy pathorbit-ui.spec.ts
File metadata and controls
135 lines (123 loc) · 8.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import { expect, test } from '@playwright/test'
test.use({ baseURL: process.env.PLAYWRIGHT_BASE_URL || 'http://127.0.0.1:3001' })
test('shows the configured repositories and safely runs the approval-gated evaluation', async ({ page }) => {
await page.goto('/')
await page.getByRole('button', { name: 'Builds' }).click()
await expect(page).toHaveURL(/#builds/)
const insighta = page.locator('.tr').filter({ hasText: 'Insighta Daily Quality' })
await expect(insighta).toContainText('/home/forth/projects/insighta-user-simulator')
await expect(insighta.getByRole('button', { name: 'Run' })).toBeVisible()
const hosted = page.locator('.tr').filter({ hasText: 'Hosted Agent HTTP Smoke' })
await expect(hosted.getByRole('button', { name: 'Test' })).toBeVisible()
await expect(hosted.getByRole('button', { name: 'Run' })).toBeVisible()
const jgent = page.locator('.tr').filter({ hasText: 'Jgent Paired Improvement Gate' })
await expect(jgent).toContainText('/mnt/c/users/forth/projects/jass-coding-agent')
await jgent.getByRole('button', { name: 'Run' }).click()
await expect(page.getByRole('alert')).toContainText('Evaluation started')
await page.getByRole('button', { name: 'Active evaluations' }).click()
await expect(page).toHaveURL(/#runs/)
const jgentRun = page.locator('.tr:not(.th)').filter({ hasText: 'Jgent' }).first()
await expect(jgentRun).toContainText('awaiting_approval', { timeout: 10_000 })
await page.getByRole('button', { name: 'Emergency stop' }).click()
await expect(jgentRun).toContainText('cancelled', { timeout: 10_000 })
})
test('collapses the sidebar and preserves the preference after reload', async ({ page }) => {
await page.goto('/#dashboard')
const toggle = page.getByRole('button', { name: 'Collapse navigation' })
await toggle.click()
await expect(page.locator('main')).toHaveClass(/sidebar-collapsed/)
await expect(page.getByRole('button', { name: 'Builds' })).toBeVisible()
await page.reload()
await expect(page.locator('main')).toHaveClass(/sidebar-collapsed/)
await page.getByRole('button', { name: 'Expand navigation' }).click()
})
test('opens the build and profile editors with editable lifecycle fields', async ({ page }) => {
await page.goto('/#builds')
await expect(page.getByRole('heading', { name: 'Builds' })).toBeVisible()
await page.getByRole('button', { name: 'Create', exact: true }).click()
const buildDialog = page.getByRole('dialog', { name: 'Create build' })
await expect(buildDialog).toBeVisible()
await expect(buildDialog.getByText('Build ID (e.g. local-smoke)')).toBeVisible()
await buildDialog.getByRole('button', { name: 'Next' }).click()
await buildDialog.getByLabel('Create a new workflow', { exact: true }).check()
await buildDialog.getByText('Template workflow').locator('..').getByRole('combobox').selectOption('insighta-user-simulation')
await expect(buildDialog.getByText('Pipeline lifecycle')).toBeVisible()
await expect(buildDialog.locator('.lifecycle-editor fieldset')).toHaveCount(5)
await expect(buildDialog.getByLabel('Command JSON array').first()).toHaveValue(/\[/)
await buildDialog.getByRole('button', { name: 'Close dialog' }).click()
await page.getByRole('button', { name: 'Create AI model profile' }).click()
const profileDialog = page.getByRole('dialog', { name: 'Create AI model profile' })
await expect(profileDialog).toBeVisible()
await expect(profileDialog.locator('.modal-setting-row')).toHaveCount(6)
await expect(profileDialog.getByText('Provider')).toBeVisible()
await profileDialog.getByRole('button', { name: 'Close dialog' }).click()
})
test('shows the score-based iteration strategy in the Jgent build editor', async ({ page }) => {
await page.goto('/#builds')
const jgent = page.locator('.tr:not(.th)').filter({ hasText: 'Jgent paired evaluation quality' })
await jgent.click()
const dialog = page.getByRole('dialog')
await dialog.getByRole('button', { name: 'Next' }).click()
const strategy = dialog.getByRole('combobox', { name: /Iteration strategy/ })
await expect(strategy).toHaveValue('score_select')
await expect(strategy).toContainText('Linear')
await expect(strategy).toContainText('Score-based selection')
await expect(dialog.getByRole('spinbutton', { name: /Candidates per iteration/ })).toBeVisible()
})
test('creates a safe task in the UI, then completes Test and Run', async ({ page }) => {
const suffix = Date.now().toString().slice(-8)
const buildId = `ui-smoke-${suffix}`
const workflowId = `ui-workflow-${suffix}`
await page.goto('/#builds')
await page.getByRole('button', { name: 'Create', exact: true }).click()
const dialog = page.getByRole('dialog', { name: 'Create build' })
const rowInput = (label: string) => dialog.getByText(label, { exact: true }).locator('..').getByRole('textbox')
await rowInput('Build ID (e.g. local-smoke)').fill(buildId)
await rowInput('Build name').fill(`UI smoke ${suffix}`)
await rowInput('Repository').fill('/home/forth/projects/orbit')
await rowInput('Purpose').fill('Verify UI task lifecycle execution')
await dialog.getByRole('button', { name: 'Next' }).click()
await dialog.getByLabel('Create a new workflow', { exact: true }).check()
await dialog.getByText('Template workflow', { exact: true }).locator('..').getByRole('combobox').selectOption('insighta-user-simulation')
await rowInput('New workflow ID').fill(workflowId)
await rowInput('New workflow name').fill(`UI workflow ${suffix}`)
await rowInput('Description').fill('Safe browser-created lifecycle smoke test')
const steps = dialog.locator('.lifecycle-editor fieldset')
for (let index = 0; index < 5; index += 1) {
await steps.nth(index).getByLabel('Command JSON array').fill(`["python","-c","print('orbit ${index}')"]`)
await steps.nth(index).getByLabel('Working directory').fill('/home/forth/projects/orbit')
await steps.nth(index).getByLabel('Minimum interval (seconds)').fill('0')
}
await dialog.getByRole('button', { name: 'Next' }).click()
await rowInput('Evaluation criteria').fill('Each lifecycle step exits successfully.')
await rowInput('Prompt source').fill('README.md')
await dialog.getByRole('button', { name: 'Next' }).click()
await dialog.getByRole('button', { name: 'Create' }).click()
await expect(dialog).toHaveCount(0)
const buildRow = page.locator('.tr').filter({ hasText: `UI smoke ${suffix}` })
await expect(buildRow).toBeVisible()
await buildRow.getByRole('button', { name: 'Test' }).click()
await expect.poll(async () => (await page.request.get('/api/runs')).json().then((runs: { build_id?: string; status: string }[]) => runs.find(run => run.build_id === buildId && run.status === 'succeeded')?.status)).toBe('succeeded')
await buildRow.getByRole('button', { name: 'Run' }).click()
await expect.poll(async () => (await page.request.get('/api/runs')).json().then((runs: { build_id?: string; execution_mode?: string; status: string }[]) => runs.find(run => run.build_id === buildId && run.execution_mode === 'run' && run.status === 'succeeded')?.status)).toBe('succeeded')
})
test('persists the selected interface language across pages and reloads', async ({ page }) => {
await page.goto('/#settings')
const languageSelect = page.locator('select').first()
await languageSelect.selectOption('ja')
await expect(page.getByRole('button', { name: 'ナビゲーションを折りたたむ', exact: true })).toHaveAttribute('title', 'ナビゲーションを折りたたむ')
await page.getByRole('button', { name: 'ビルド' }).click()
await expect(page.getByRole('heading', { name: 'ビルド', exact: true })).toBeVisible()
await expect(page.getByText('ビルド一覧')).toBeVisible()
await page.reload()
await expect(page.getByRole('button', { name: 'ビルド' })).toBeVisible()
await page.goto('/#settings')
await languageSelect.selectOption('ko')
const collapse = page.getByRole('button', { name: '탐색 메뉴 접기', exact: true })
await expect(collapse).toHaveAttribute('title', '탐색 메뉴 접기')
await collapse.click()
await expect(page.getByRole('button', { name: '탐색 메뉴 펼치기', exact: true }).first()).toHaveAttribute('title', '탐색 메뉴 펼치기')
await page.getByRole('button', { name: '탐색 메뉴 펼치기', exact: true }).first().click()
await languageSelect.selectOption('en')
await expect(page.getByRole('button', { name: 'Collapse navigation', exact: true })).toHaveAttribute('title', 'Collapse navigation')
})