mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-08-25 12:36:30 +00:00
test(e2e): add a populated settings-providers visual baseline
The route-manifest visual sweep only captured the empty providers state. Add a populated cassette (enabled defaults + a user-defined provider row) and a dedicated visual spec with light/dark baselines, generated in the pinned container. Dates render deterministically because the visual project inherits the mock clock via the backend fixture. Also bind --update-snapshots=all in run-visual.sh so a trailing spec-file filter is not swallowed as the option's optional [mode] argument. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
dcea92e17b
commit
17d34161cd
@@ -115,3 +115,69 @@ export const settingsProvidersCassette = (override: Cassette = {}): Cassette =>
|
||||
},
|
||||
override,
|
||||
);
|
||||
|
||||
const populatedProviders: ResultOf<typeof SettingsProvidersDocument> = {
|
||||
settingsProviders: entity('ProvidersConfig', {
|
||||
default: entity('DefaultProvidersConfig', {
|
||||
anthropic: defaultConfig('default-anthropic', ProviderType.Anthropic),
|
||||
bedrock: null,
|
||||
custom: null,
|
||||
deepseek: null,
|
||||
gemini: null,
|
||||
glm: null,
|
||||
kimi: null,
|
||||
minimax: null,
|
||||
ollama: null,
|
||||
openai: defaultConfig('default-openai', ProviderType.Openai),
|
||||
qwen: null,
|
||||
}),
|
||||
enabled: entity('ProvidersReadinessStatus', {
|
||||
anthropic: true,
|
||||
bedrock: false,
|
||||
custom: false,
|
||||
deepseek: false,
|
||||
gemini: false,
|
||||
glm: false,
|
||||
kimi: false,
|
||||
minimax: false,
|
||||
ollama: false,
|
||||
openai: true,
|
||||
qwen: false,
|
||||
}),
|
||||
models: entity('ProvidersModelsList', {
|
||||
anthropic: [],
|
||||
bedrock: [],
|
||||
custom: [],
|
||||
deepseek: [],
|
||||
gemini: [],
|
||||
glm: [],
|
||||
kimi: [],
|
||||
minimax: [],
|
||||
ollama: [],
|
||||
openai: [],
|
||||
qwen: [],
|
||||
}),
|
||||
userDefined: [
|
||||
entity('ProviderConfig', {
|
||||
agents: agentsConfig(),
|
||||
createdAt: T,
|
||||
id: 'custom-1',
|
||||
name: 'My Custom Endpoint',
|
||||
type: ProviderType.Custom,
|
||||
updatedAt: T,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
};
|
||||
|
||||
export const populatedSettingsProvidersCassette = (override: Cassette = {}): Cassette =>
|
||||
mergeCassettes(
|
||||
{
|
||||
queries: {
|
||||
...baseQueries(),
|
||||
settingsProviders: [{ data: populatedProviders }],
|
||||
},
|
||||
rest: baseRest(),
|
||||
},
|
||||
override,
|
||||
);
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import { expect, test } from '../../fixtures/test.ts';
|
||||
import { populatedSettingsProvidersCassette } from '../../mocks/cassettes/settings-providers.ts';
|
||||
|
||||
// The route-manifest visual sweep only captures the empty providers state. This
|
||||
// pins the populated layout (enabled defaults + a user-defined provider row).
|
||||
const THEMES = ['light', 'dark'] as const;
|
||||
|
||||
test.describe('visual: settings providers (populated)', { tag: '@visual' }, () => {
|
||||
for (const theme of THEMES) {
|
||||
test.describe(theme, () => {
|
||||
test.use({ cassette: populatedSettingsProvidersCassette() });
|
||||
|
||||
test('matches the baseline', async ({ page }) => {
|
||||
await page.addInitScript((value) => window.localStorage.setItem('theme', String(value)), theme);
|
||||
await page.goto('/settings/providers');
|
||||
await expect(page.getByText('My Custom Endpoint')).toBeVisible();
|
||||
await page.evaluate(() => document.fonts.ready);
|
||||
|
||||
await expect(page).toHaveScreenshot(`settings-providers-populated-${theme}.png`, {
|
||||
fullPage: true,
|
||||
mask: [page.locator('.xterm')],
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
@@ -17,7 +17,9 @@ fi
|
||||
|
||||
UPDATE_ARGS=()
|
||||
if [[ "${1:-}" == "--update" ]]; then
|
||||
UPDATE_ARGS=(--update-snapshots)
|
||||
# `=all` binds the mode so a trailing spec-file filter isn't swallowed as the
|
||||
# option's optional [mode] argument (`--update-snapshots <file>` fails to parse).
|
||||
UPDATE_ARGS=(--update-snapshots=all)
|
||||
shift
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user