Merge pull request #2673 from langbot-app/test/quality-frontend-self-duplicates-20261017

test(web): replace self-confirming progress checks and remove duplicates
This commit is contained in:
huanghuoguoguo
2026-10-17 20:10:14 +08:00
committed by GitHub
3 changed files with 35 additions and 83 deletions
-36
View File
@@ -1464,39 +1464,3 @@ test.describe('cross-resource flows', () => {
).toBeVisible();
});
});
test.describe('empty states', () => {
test('shows empty state when no bots exist', async ({ page }) => {
await installLangBotApiMocks(page, { authenticated: true });
await page.goto('/home/bots');
await expect(page.getByText('Select a bot from the sidebar')).toBeVisible();
});
test('shows empty state when no processors exist', async ({ page }) => {
await installLangBotApiMocks(page, { authenticated: true });
await page.goto('/home/agents');
await expect(
page.getByText('Select a processor from the sidebar'),
).toBeVisible();
});
test('shows empty state when no knowledge bases exist', async ({ page }) => {
await installLangBotApiMocks(page, { authenticated: true });
await page.goto('/home/knowledge');
await expect(
page.getByText('Select a knowledge base from the sidebar'),
).toBeVisible();
});
test('shows empty state when no MCP servers exist', async ({ page }) => {
await installLangBotApiMocks(page, { authenticated: true });
await page.goto('/home/mcp');
await expect(
page.getByText('Select an MCP server from the sidebar'),
).toBeVisible();
});
});
+35 -35
View File
@@ -25,7 +25,6 @@ new Function('require', 'module', 'exports', compiled)(
const {
InstallStage,
INSTALL_PROGRESS_CAP,
STAGE_PROGRESS_RANGE,
computeStageProgress,
mapActionToStage,
@@ -92,27 +91,22 @@ test('measured byte counts stay inside the download stage range', () => {
);
});
test('fallback drift never spills into the next stage range', () => {
for (const stage of [
InstallStage.DOWNLOADING,
InstallStage.INSTALLING_DEPS,
InstallStage.INITIALIZING,
InstallStage.LAUNCHING,
]) {
const [start, end] = STAGE_PROGRESS_RANGE[stage];
const progress = computeStageProgress({
stage,
stageElapsedSeconds: 100000,
});
test('fallback drift advances within fixed stage boundaries', () => {
const stages = [
[InstallStage.DOWNLOADING, 5, 25, 44],
[InstallStage.INSTALLING_DEPS, 45, 65, 84],
[InstallStage.INITIALIZING, 85, 87, 87],
[InstallStage.LAUNCHING, 88, 92, 96],
];
assert.ok(
progress >= start && progress <= end,
`stage ${stage} produced ${progress}, outside [${start}, ${end}]`,
);
assert.ok(
progress < INSTALL_PROGRESS_CAP,
`stage ${stage} must not reach the completion cap on drift alone`,
);
for (const [stage, start, midpoint, ceiling] of stages) {
const progressAt = (stageElapsedSeconds) =>
computeStageProgress({ stage, stageElapsedSeconds });
assert.equal(progressAt(0), start);
assert.equal(progressAt(1), start);
assert.equal(progressAt(4), start + 2);
assert.equal(progressAt((midpoint - start) * 2), midpoint);
assert.equal(progressAt(100000), ceiling);
}
});
@@ -173,18 +167,24 @@ test('measured bytes override Host coarse progress and fallback stays bounded',
}
});
test('a missing or zero download total falls back to bounded drift', () => {
const [start, end] = STAGE_PROGRESS_RANGE[InstallStage.DOWNLOADING];
const progress = computeStageProgress({
stage: InstallStage.DOWNLOADING,
downloadCurrent: 10,
downloadTotal: 0,
stageElapsedSeconds: 100000,
});
assert.ok(
progress >= start && progress <= end,
`expected progress within [${start}, ${end}], received ${progress}`,
);
test('a missing or zero download total advances using fallback drift', () => {
for (const downloadTotal of [undefined, 0]) {
for (const [stageElapsedSeconds, expected] of [
[0, 5],
[4, 7],
[20, 15],
[100000, 44],
]) {
assert.equal(
computeStageProgress({
stage: InstallStage.DOWNLOADING,
downloadCurrent: 10,
downloadTotal,
stageElapsedSeconds,
}),
expected,
`download total ${downloadTotal}, elapsed ${stageElapsedSeconds}s`,
);
}
}
});
@@ -31,18 +31,6 @@ const authenticatedPluginResourceSource = readSource(
'src/hooks/useAuthenticatedPluginResource.ts',
);
test('hides the entire workspace switcher slot for a singleton local workspace', () => {
assert.match(homeSidebarSource, /useWorkspaceBootstrap/);
assert.match(
homeSidebarSource,
/const showWorkspaceSwitcher\s*=\s*workspaces\.length\s*>\s*1\s*\|\|\s*currentWorkspace\?\.workspace\.source\s*===\s*'cloud_projection'/,
);
assert.match(
homeSidebarSource,
/\{showWorkspaceSwitcher\s*&&\s*\(\s*<div className="px-2[^>]*>\s*<WorkspaceSwitcher/,
);
});
test('keeps bot forms spaced with responsive setup and detail columns', () => {
const fieldset = botFormSource.match(
/<fieldset\s[\s\S]*?disabled=\{isLoading\}/,