fix(tests): iteration 12
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
import { expect, test, type Page } from "@playwright/test";
|
import { expect, test, type Page } from "@playwright/test";
|
||||||
|
import {
|
||||||
|
buildCreateAgentPreferences,
|
||||||
|
buildSeededHost,
|
||||||
|
} from "./helpers/daemon-registry";
|
||||||
|
|
||||||
const SERVER_ID =
|
const SERVER_ID =
|
||||||
process.env.PLAYWRIGHT_REPRO_SERVER_ID ?? "srv_ETXtcjYRGrCI";
|
process.env.PLAYWRIGHT_REPRO_SERVER_ID ?? "srv_ETXtcjYRGrCI";
|
||||||
@@ -26,33 +30,17 @@ function seedDaemonRegistryScript(params: {
|
|||||||
endpoint: string;
|
endpoint: string;
|
||||||
nowIso: string;
|
nowIso: string;
|
||||||
}) {
|
}) {
|
||||||
const daemon = {
|
const daemon = buildSeededHost({
|
||||||
serverId: params.serverId,
|
serverId: params.serverId,
|
||||||
label: "localhost",
|
endpoint: params.endpoint,
|
||||||
connections: [
|
nowIso: params.nowIso,
|
||||||
{
|
});
|
||||||
id: `direct:${params.endpoint}`,
|
|
||||||
type: "direct",
|
|
||||||
endpoint: params.endpoint,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
preferredConnectionId: `direct:${params.endpoint}`,
|
|
||||||
createdAt: params.nowIso,
|
|
||||||
updatedAt: params.nowIso,
|
|
||||||
};
|
|
||||||
|
|
||||||
localStorage.setItem("@paseo:e2e", "1");
|
localStorage.setItem("@paseo:e2e", "1");
|
||||||
localStorage.setItem("@paseo:daemon-registry", JSON.stringify([daemon]));
|
localStorage.setItem("@paseo:daemon-registry", JSON.stringify([daemon]));
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
"@paseo:create-agent-preferences",
|
"@paseo:create-agent-preferences",
|
||||||
JSON.stringify({
|
JSON.stringify(buildCreateAgentPreferences(params.serverId))
|
||||||
serverId: params.serverId,
|
|
||||||
provider: "codex",
|
|
||||||
providerPreferences: {
|
|
||||||
claude: { model: "haiku" },
|
|
||||||
codex: { model: "gpt-5.1-codex-mini", thinkingOptionId: "low" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
import { test, expect } from './fixtures';
|
import { test, expect } from './fixtures';
|
||||||
|
import {
|
||||||
|
buildSeededHost,
|
||||||
|
} from './helpers/daemon-registry';
|
||||||
|
|
||||||
test('host removal removes the host from UI and persists after reload', async ({ page }) => {
|
test('host removal removes the host from UI and persists after reload', async ({ page }) => {
|
||||||
const daemonPort = process.env.E2E_DAEMON_PORT;
|
const daemonPort = process.env.E2E_DAEMON_PORT;
|
||||||
@@ -14,27 +17,18 @@ test('host removal removes the host from UI and persists after reload', async ({
|
|||||||
const extraEndpoint = `127.0.0.1:${extraPort}`;
|
const extraEndpoint = `127.0.0.1:${extraPort}`;
|
||||||
const nowIso = new Date().toISOString();
|
const nowIso = new Date().toISOString();
|
||||||
|
|
||||||
const extraDaemon = {
|
const extraDaemon = buildSeededHost({
|
||||||
serverId: 'srv_e2e_extra_daemon',
|
serverId: 'srv_e2e_extra_daemon',
|
||||||
|
endpoint: extraEndpoint,
|
||||||
label: 'extra',
|
label: 'extra',
|
||||||
connections: [
|
nowIso,
|
||||||
{ id: `direct:${extraEndpoint}`, type: 'direct', endpoint: extraEndpoint },
|
});
|
||||||
],
|
|
||||||
preferredConnectionId: `direct:${extraEndpoint}`,
|
|
||||||
createdAt: nowIso,
|
|
||||||
updatedAt: nowIso,
|
|
||||||
};
|
|
||||||
|
|
||||||
const seededTestDaemon = {
|
const seededTestDaemon = buildSeededHost({
|
||||||
serverId: seededServerId,
|
serverId: seededServerId,
|
||||||
label: 'localhost',
|
endpoint: `127.0.0.1:${daemonPort}`,
|
||||||
connections: [
|
nowIso,
|
||||||
{ id: `direct:127.0.0.1:${daemonPort}`, type: 'direct', endpoint: `127.0.0.1:${daemonPort}` },
|
});
|
||||||
],
|
|
||||||
preferredConnectionId: `direct:127.0.0.1:${daemonPort}`,
|
|
||||||
createdAt: nowIso,
|
|
||||||
updatedAt: nowIso,
|
|
||||||
};
|
|
||||||
|
|
||||||
const seedOnceKey = `@paseo:e2e-host-removal-seeded:${Math.random().toString(36).slice(2)}`;
|
const seedOnceKey = `@paseo:e2e-host-removal-seeded:${Math.random().toString(36).slice(2)}`;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
import { test, expect } from './fixtures';
|
import { test, expect } from './fixtures';
|
||||||
|
import {
|
||||||
|
buildCreateAgentPreferences,
|
||||||
|
buildSeededHost,
|
||||||
|
} from './helpers/daemon-registry';
|
||||||
import { ensureHostSelected, gotoHome } from './helpers/app';
|
import { ensureHostSelected, gotoHome } from './helpers/app';
|
||||||
|
|
||||||
test('new agent auto-selects the previous host', async ({ page }) => {
|
test('new agent auto-selects the previous host', async ({ page }) => {
|
||||||
@@ -25,28 +29,12 @@ test('new agent respects serverId in the URL', async ({ page }) => {
|
|||||||
|
|
||||||
// Ensure this test's storage is deterministic even under parallel load.
|
// Ensure this test's storage is deterministic even under parallel load.
|
||||||
const nowIso = new Date().toISOString();
|
const nowIso = new Date().toISOString();
|
||||||
const testDaemon = {
|
const testDaemon = buildSeededHost({
|
||||||
serverId,
|
serverId,
|
||||||
label: 'localhost',
|
endpoint: `127.0.0.1:${daemonPort}`,
|
||||||
connections: [
|
nowIso,
|
||||||
{
|
});
|
||||||
id: `direct:127.0.0.1:${daemonPort}`,
|
const createAgentPreferences = buildCreateAgentPreferences(testDaemon.serverId);
|
||||||
type: 'direct',
|
|
||||||
endpoint: `127.0.0.1:${daemonPort}`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
preferredConnectionId: `direct:127.0.0.1:${daemonPort}`,
|
|
||||||
createdAt: nowIso,
|
|
||||||
updatedAt: nowIso,
|
|
||||||
};
|
|
||||||
const createAgentPreferences = {
|
|
||||||
serverId: testDaemon.serverId,
|
|
||||||
provider: 'codex',
|
|
||||||
providerPreferences: {
|
|
||||||
claude: { model: 'haiku' },
|
|
||||||
codex: { model: 'gpt-5.1-codex-mini', thinkingOptionId: 'low' },
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
await page.goto('/settings');
|
await page.goto('/settings');
|
||||||
await page.evaluate(
|
await page.evaluate(
|
||||||
@@ -60,7 +48,10 @@ test('new agent respects serverId in the URL', async ({ page }) => {
|
|||||||
{ daemon: testDaemon, preferences: createAgentPreferences }
|
{ daemon: testDaemon, preferences: createAgentPreferences }
|
||||||
);
|
);
|
||||||
await page.reload();
|
await page.reload();
|
||||||
await expect(page.getByText('New agent', { exact: true }).first()).toBeVisible({ timeout: 20000 });
|
await expect(page.getByText('Settings', { exact: true }).first()).toBeVisible({ timeout: 20000 });
|
||||||
|
await expect(page.locator(`[data-testid="daemon-card-${serverId}"]:visible`).first()).toBeVisible({
|
||||||
|
timeout: 20000,
|
||||||
|
});
|
||||||
|
|
||||||
await page.goto(`/?serverId=${encodeURIComponent(serverId)}`);
|
await page.goto(`/?serverId=${encodeURIComponent(serverId)}`);
|
||||||
await expect(page.getByText('New agent', { exact: true }).first()).toBeVisible();
|
await expect(page.getByText('New agent', { exact: true }).first()).toBeVisible();
|
||||||
@@ -87,20 +78,11 @@ test('new agent auto-selects first online host when no preference is stored', as
|
|||||||
}
|
}
|
||||||
|
|
||||||
const nowIso = new Date().toISOString();
|
const nowIso = new Date().toISOString();
|
||||||
const testDaemon = {
|
const testDaemon = buildSeededHost({
|
||||||
serverId,
|
serverId,
|
||||||
label: 'localhost',
|
endpoint: `127.0.0.1:${daemonPort}`,
|
||||||
connections: [
|
nowIso,
|
||||||
{
|
});
|
||||||
id: `direct:127.0.0.1:${daemonPort}`,
|
|
||||||
type: 'direct',
|
|
||||||
endpoint: `127.0.0.1:${daemonPort}`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
preferredConnectionId: `direct:127.0.0.1:${daemonPort}`,
|
|
||||||
createdAt: nowIso,
|
|
||||||
updatedAt: nowIso,
|
|
||||||
};
|
|
||||||
|
|
||||||
await gotoHome(page);
|
await gotoHome(page);
|
||||||
await page.evaluate(
|
await page.evaluate(
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ test('manual host add accepts host:port only and persists a direct connection',
|
|||||||
entry?.serverId === serverId &&
|
entry?.serverId === serverId &&
|
||||||
Array.isArray(entry?.connections) &&
|
Array.isArray(entry?.connections) &&
|
||||||
entry.connections.some(
|
entry.connections.some(
|
||||||
(conn: any) => conn?.type === 'direct' && conn?.endpoint === `127.0.0.1:${port}`
|
(conn: any) => conn?.type === 'directTcp' && conn?.endpoint === `127.0.0.1:${port}`
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { test, expect } from './fixtures';
|
import { test, expect } from './fixtures';
|
||||||
|
import { buildDirectTcpConnection } from './helpers/daemon-registry';
|
||||||
import { gotoHome, openSettings } from './helpers/app';
|
import { gotoHome, openSettings } from './helpers/app';
|
||||||
|
|
||||||
test('connects via relay when direct endpoints fail', async ({ page }) => {
|
test('connects via relay when direct endpoints fail', async ({ page }) => {
|
||||||
@@ -18,7 +19,7 @@ test('connects via relay when direct endpoints fail', async ({ page }) => {
|
|||||||
serverId,
|
serverId,
|
||||||
label: 'relay-daemon',
|
label: 'relay-daemon',
|
||||||
connections: [
|
connections: [
|
||||||
{ id: 'direct:127.0.0.1:9', type: 'direct', endpoint: '127.0.0.1:9' },
|
buildDirectTcpConnection('127.0.0.1:9'),
|
||||||
{ id: `relay:${relayEndpoint}`, type: 'relay', relayEndpoint, daemonPublicKeyB64 },
|
{ id: `relay:${relayEndpoint}`, type: 'relay', relayEndpoint, daemonPublicKeyB64 },
|
||||||
],
|
],
|
||||||
preferredConnectionId: 'direct:127.0.0.1:9',
|
preferredConnectionId: 'direct:127.0.0.1:9',
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { test, expect } from './fixtures';
|
import { test, expect } from './fixtures';
|
||||||
|
import { buildDirectTcpConnection } from './helpers/daemon-registry';
|
||||||
import { gotoHome, openSettings } from './helpers/app';
|
import { gotoHome, openSettings } from './helpers/app';
|
||||||
|
|
||||||
test('relay connection stays stable across multiple tabs', async ({ page }) => {
|
test('relay connection stays stable across multiple tabs', async ({ page }) => {
|
||||||
@@ -18,7 +19,7 @@ test('relay connection stays stable across multiple tabs', async ({ page }) => {
|
|||||||
serverId,
|
serverId,
|
||||||
label: 'relay-daemon',
|
label: 'relay-daemon',
|
||||||
connections: [
|
connections: [
|
||||||
{ id: 'direct:127.0.0.1:9', type: 'direct', endpoint: '127.0.0.1:9' },
|
buildDirectTcpConnection('127.0.0.1:9'),
|
||||||
{ id: `relay:${relayEndpoint}`, type: 'relay', relayEndpoint, daemonPublicKeyB64 },
|
{ id: `relay:${relayEndpoint}`, type: 'relay', relayEndpoint, daemonPublicKeyB64 },
|
||||||
],
|
],
|
||||||
preferredConnectionId: 'direct:127.0.0.1:9',
|
preferredConnectionId: 'direct:127.0.0.1:9',
|
||||||
|
|||||||
Reference in New Issue
Block a user