Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 50 additions & 1 deletion apps/world-lab/src/components/world-lab.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen, waitFor } from '@testing-library/react';
import { render, screen, waitFor, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { simulationSnapshotSchema } from '@hexzero/shared';
Expand Down Expand Up @@ -351,4 +351,53 @@ describe('WorldLab swarm workspace', () => {
screen.getByRole('button', { name: 'Download JSON' }),
).toBeDisabled();
});

it('model console shows exactly one Agent Zero planner row and no per-agent override controls', async () => {
vi.stubGlobal(
'fetch',
vi.fn(() => response(snapshot)),
);
const user = userEvent.setup();
render(<WorldLab />);
await user.click(await screen.findByLabelText('More World Lab actions'));
await user.click(screen.getByRole('button', { name: 'Agent setup' }));
const trigger = await screen.findByRole('button', {
name: /Agent Zero model/,
});
await user.click(trigger);
const dialog = await screen.findByRole('dialog', {
name: 'Agent Zero model selection',
});
expect(dialog).toBeVisible();
await user.click(screen.getByRole('tab', { name: 'Overview' }));
expect(within(dialog).getByText('Agent Zero')).toBeVisible();
for (const { name } of world.agents) {
expect(within(dialog).queryByText(name)).not.toBeInTheDocument();
}
await user.click(screen.getByRole('tab', { name: 'Models' }));
expect(screen.queryByText('Agent overrides')).not.toBeInTheDocument();
expect(
screen.queryByText('Apply global model to all agents'),
).not.toBeInTheDocument();
});

it('export dialog offers JSON serialization but no agent / turn / level / outcome / action filters', async () => {
vi.stubGlobal(
'fetch',
vi.fn(() => response(snapshot)),
);
const user = userEvent.setup();
render(<WorldLab />);
await user.click(await screen.findByLabelText('More World Lab actions'));
await user.click(screen.getByRole('button', { name: 'Export' }));
expect(screen.queryByText('Export level')).not.toBeInTheDocument();
expect(screen.queryByText('Turn range')).not.toBeInTheDocument();
expect(screen.queryByText('Outcomes')).not.toBeInTheDocument();
expect(screen.queryByText('Actions')).not.toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Preview' })).toBeVisible();
expect(
screen.getByRole('button', { name: 'Generate export' }),
).toBeVisible();
expect(screen.getByLabelText('JSON serialization')).toBeVisible();
});
});
Loading
Loading