Move work preview navigation beside workspace tabs
This commit is contained in:
1 parent
c55e9c7182
commit
d787267055
9 files changed
+272
-33
No files matched your search
@@ -2566,6 +2566,29 @@ test('work tab prepares the page automatically and keeps the student draft throu
|
||||
await expect(page.getByRole('button', { name: '收起作品', exact: true })).toHaveCount(0);
|
||||
await expect(page.getByTestId('agent-browser-viewport')).toBeVisible();
|
||||
await expect(page.getByText('正在打开你的作品…', { exact: true })).toHaveCount(0);
|
||||
const workspaceToolbar = page.getByTestId('classroom-workspace-toolbar');
|
||||
const tabs = workspaceToolbar.getByRole('tablist', { name: '当前工作' });
|
||||
const browserToolbar = page.getByTestId('agent-browser-toolbar');
|
||||
const address = browserToolbar.getByRole('textbox', { name: '网页地址' });
|
||||
const workTab = tabs.getByRole('tab', { name: '作品', exact: true });
|
||||
const chatTab = tabs.getByRole('tab', { name: '操作对话', exact: true });
|
||||
await expect(workspaceToolbar.getByTestId('agent-browser-toolbar')).toHaveCount(1);
|
||||
await expect(browserToolbar).toHaveAccessibleName('网页导航');
|
||||
await expect(tabs.getByTestId('agent-browser-toolbar')).toHaveCount(0);
|
||||
await expect(page.getByTestId('agent-browser-panel').getByTestId('agent-browser-toolbar')).toHaveCount(0);
|
||||
const [tabsBounds, toolbarBounds] = await Promise.all([tabs.boundingBox(), browserToolbar.boundingBox()]);
|
||||
expect(tabsBounds).not.toBeNull();
|
||||
expect(toolbarBounds).not.toBeNull();
|
||||
expect(toolbarBounds!.x).toBeGreaterThanOrEqual(tabsBounds!.x + tabsBounds!.width);
|
||||
expect(Math.abs(toolbarBounds!.y + toolbarBounds!.height / 2 - tabsBounds!.y - tabsBounds!.height / 2)).toBeLessThanOrEqual(1);
|
||||
await address.press('ArrowLeft');
|
||||
await expect(address).toBeFocused();
|
||||
await expect(workTab).toHaveAttribute('aria-selected', 'true');
|
||||
await browserToolbar.getByRole('button', { name: '刷新网页', exact: true }).click();
|
||||
await expect.poll(async () => (await readState(electronApp)).captured.filter((item) => item.path === '/api/agent-browser/navigate' && item.body?.action === 'reload').length).toBe(1);
|
||||
await expect(browserToolbar.getByRole('button', { name: '刷新网页', exact: true })).toBeEnabled();
|
||||
await expect(address).toHaveValue('http://127.0.0.1:4173/');
|
||||
await page.screenshot({ path: test.info().outputPath('work-toolbar-with-tabs.png') });
|
||||
// A manual address open must not permanently disable recovery checks.
|
||||
await page.getByRole('textbox', { name: '网页地址' }).fill('http://127.0.0.1:4173/');
|
||||
await page.getByRole('textbox', { name: '网页地址' }).press('Enter');
|
||||
@@ -2586,8 +2609,17 @@ test('work tab prepares the page automatically and keeps the student draft throu
|
||||
await expect(page.getByRole('button', { name: '刷新网页', exact: true })).toBeEnabled();
|
||||
await expect(page.getByText('正在打开你的作品…', { exact: true })).toHaveCount(0);
|
||||
await expect(page.getByText('开发浏览器已关闭。', { exact: true })).toHaveCount(0);
|
||||
await page.getByRole('tab', { name: '操作对话', exact: true }).click();
|
||||
await workTab.focus();
|
||||
await workTab.press('ArrowLeft');
|
||||
await expect(chatTab).toHaveAttribute('aria-selected', 'true');
|
||||
await expect(chatTab).toBeFocused();
|
||||
await expect(browserToolbar).toHaveCount(0);
|
||||
await expect(composer).toHaveValue('还没有发出的想法');
|
||||
await chatTab.press('ArrowRight');
|
||||
await expect(workTab).toHaveAttribute('aria-selected', 'true');
|
||||
await expect(workTab).toBeFocused();
|
||||
await expect(workspaceToolbar.getByTestId('agent-browser-toolbar')).toBeVisible();
|
||||
await expect(address).toHaveValue('http://127.0.0.1:4173/');
|
||||
const requests = (await readState(electronApp)).captured;
|
||||
const opens = requests.filter((request) => request.path === '/api/agent-browser/ensure-work');
|
||||
expect(opens.length).toBeGreaterThanOrEqual(2);
|
||||
|
||||
Reference in new issue
Block a user