mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
* Update files * Git panel: share checkout actions Hoist checkout-scoped async git actions into a shared store and keep primary Push CTA loading in-place. Also stabilize e2e git flows. * Stabilize git panel async actions and fix e2e flakes
56 lines
2.5 KiB
TypeScript
56 lines
2.5 KiB
TypeScript
import { test, expect } from './fixtures';
|
|
import { ensureHostSelected, gotoHome, setWorkingDirectory } from './helpers/app';
|
|
import { createTempGitRepo } from './helpers/workspace';
|
|
|
|
test('deleting an agent persists after reload', async ({ page }) => {
|
|
const repo = await createTempGitRepo();
|
|
const nonce = Math.random().toString(36).slice(2, 10);
|
|
const prompt = `respond-ready-${nonce}`;
|
|
|
|
try {
|
|
await gotoHome(page);
|
|
await setWorkingDirectory(page, repo.path);
|
|
await ensureHostSelected(page);
|
|
|
|
// Create agent (via message input) so it shows up in the sidebar list.
|
|
const input = page.getByRole('textbox', { name: 'Message agent...' });
|
|
await expect(input).toBeEditable();
|
|
await input.fill(prompt);
|
|
await input.press('Enter');
|
|
await page.waitForURL(/\/agent\//, { waitUntil: 'commit' });
|
|
// Wait for the initial turn to complete so the agent can be archived (web uses a hover action).
|
|
const stopOrCancel = page.getByRole('button', { name: /Stop agent|Canceling agent/ });
|
|
await stopOrCancel.first().waitFor({ state: 'visible', timeout: 30000 }).catch(() => undefined);
|
|
await expect(stopOrCancel).toHaveCount(0, { timeout: 120000 });
|
|
|
|
const match = page.url().match(/\/agent\/([^/]+)\/([^/?#]+)/);
|
|
if (!match) {
|
|
throw new Error(`Expected /agent/:serverId/:agentId URL, got ${page.url()}`);
|
|
}
|
|
const serverId = decodeURIComponent(match[1]);
|
|
const agentId = decodeURIComponent(match[2]);
|
|
|
|
// Return home and delete via long-press in the agent list.
|
|
await gotoHome(page);
|
|
const rowTestId = `agent-row-${serverId}-${agentId}`;
|
|
const agentRow = page.getByTestId(rowTestId).first();
|
|
await expect(agentRow).toBeVisible({ timeout: 30000 });
|
|
|
|
// Web UX: hover shows a quick-archive icon. (Long-press is touch-oriented and unreliable on desktop web.)
|
|
await agentRow.hover();
|
|
const quickArchive = page.getByTestId(`agent-archive-${serverId}-${agentId}`).first();
|
|
await expect(quickArchive).toBeVisible({ timeout: 10000 });
|
|
await quickArchive.click({ force: true });
|
|
|
|
// Ensure deletion finished before reload (avoids races).
|
|
await expect(page.getByTestId(rowTestId)).toHaveCount(0, { timeout: 30000 });
|
|
|
|
// A full reload should not bring the agent back.
|
|
await page.reload();
|
|
await expect(page.getByRole('textbox', { name: 'Message agent...' })).toBeVisible();
|
|
await expect(page.getByTestId(rowTestId)).toHaveCount(0, { timeout: 30000 });
|
|
} finally {
|
|
await repo.cleanup();
|
|
}
|
|
});
|