Replace separate sidebar stores with a unified panel store that uses a discriminated union state machine on mobile. This makes it impossible for both the agent list and file explorer sidebars to be open at the same time on mobile. Mobile state machine (mobileView): - 'agent': Main agent view (no overlay panel) - 'agent-list': Agent list sidebar (left overlay) - 'file-explorer': File explorer sidebar (right overlay) Desktop retains independent boolean toggles since sidebars sit alongside content rather than overlaying it. Key changes: - Created stores/panel-store.ts with unified state - Deleted stores/sidebar-store.ts and explorer-sidebar-store.ts - Updated all components to use new panel store - Animation contexts derive isOpen from unified state
62 lines
2.1 KiB
TypeScript
62 lines
2.1 KiB
TypeScript
import { expect, type Page } from '@playwright/test';
|
|
|
|
export const gotoHome = async (page: Page) => {
|
|
await page.goto('/');
|
|
await expect(page.getByText('New Agent', { exact: true }).first()).toBeVisible();
|
|
await expect(page.getByRole('textbox', { name: 'Message agent...' })).toBeVisible();
|
|
};
|
|
|
|
export const openSettings = async (page: Page) => {
|
|
const settingsLink = page.getByText('Settings', { exact: true }).first();
|
|
await expect(settingsLink).toBeVisible();
|
|
await settingsLink.click();
|
|
await expect(page).toHaveURL(/\/settings$/);
|
|
};
|
|
|
|
export const setWorkingDirectory = async (page: Page, directory: string) => {
|
|
const workingDirectoryLabel = page.getByText('WORKING DIRECTORY', { exact: true }).first();
|
|
await expect(workingDirectoryLabel).toBeVisible();
|
|
await workingDirectoryLabel.click();
|
|
|
|
const input = page.getByRole('textbox', { name: '/path/to/project' });
|
|
await expect(input).toBeVisible();
|
|
await input.fill(directory);
|
|
await input.press('Enter');
|
|
|
|
const useOption = page.getByText(`Use "${directory}"`);
|
|
await expect(useOption).toBeVisible();
|
|
await useOption.click();
|
|
await expect(page.getByText(directory, { exact: true })).toBeVisible();
|
|
};
|
|
|
|
export const ensureHostSelected = async (page: Page) => {
|
|
const input = page.getByRole('textbox', { name: 'Message agent...' });
|
|
await expect(input).toBeVisible();
|
|
|
|
if (await input.isEditable()) {
|
|
return;
|
|
}
|
|
|
|
const selectHost = page.getByText('Select host', { exact: true });
|
|
if (await selectHost.isVisible()) {
|
|
await selectHost.click();
|
|
|
|
// Wait for the host option to appear and click it
|
|
const hostOption = page.getByText('localhost', { exact: true }).first();
|
|
await expect(hostOption).toBeVisible();
|
|
await hostOption.click();
|
|
}
|
|
|
|
await expect(input).toBeEditable();
|
|
};
|
|
|
|
export const createAgent = async (page: Page, message: string) => {
|
|
const input = page.getByRole('textbox', { name: 'Message agent...' });
|
|
await expect(input).toBeEditable();
|
|
await input.fill(message);
|
|
await input.press('Enter');
|
|
|
|
await page.waitForURL(/\/agent\//);
|
|
await expect(page.getByText(message, { exact: true })).toBeVisible();
|
|
};
|