mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-09-12 12:57:14 +00:00
test(web): align smoke fixtures with current processor UI
This commit is contained in:
@@ -89,7 +89,7 @@ test.describe('frontend CRUD smoke flows', () => {
|
||||
await expect(
|
||||
page.locator('[data-processor-kind="pipeline"]'),
|
||||
).toContainText(
|
||||
'流水线即为经典的“收到消息、请求AI、回复用户”流程,并辅以常用的配置功能。仅处理消息事件,适合步骤明确、需要稳定控制处理过程的场景。',
|
||||
'流水线按“接收消息、调用 AI、回复用户”的固定流程运行,可配置知识库和插件扩展。仅处理消息事件,适合步骤明确、需要控制处理过程的场景。',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1034,7 +1034,7 @@ test.describe('agent runner resource selectors', () => {
|
||||
await expect(
|
||||
page.getByText('No Runner extension is installed yet.'),
|
||||
).toBeVisible();
|
||||
await expect(page.getByText('Runner Marketplace')).toBeVisible();
|
||||
await expect(page.getByText('Runner plugins in Marketplace')).toBeVisible();
|
||||
const selectorPopup = page.locator('[data-slot="select-content"]');
|
||||
await expect(
|
||||
selectorPopup.getByText('Runner used by the grouped selector test.', {
|
||||
@@ -1055,20 +1055,35 @@ test.describe('agent runner resource selectors', () => {
|
||||
});
|
||||
|
||||
await page
|
||||
.getByRole('option')
|
||||
.filter({ hasText: 'Marketplace Runner' })
|
||||
.getByRole('button', { name: 'Install Marketplace Runner', exact: true })
|
||||
.click();
|
||||
|
||||
await expect.poll(() => installRequests).toBe(1);
|
||||
await expect.poll(() => taskPolls).toBeGreaterThan(0);
|
||||
await expect(
|
||||
page.getByRole('option', {
|
||||
name: 'Marketplace Runner Runner used by the grouped selector test.',
|
||||
exact: true,
|
||||
}),
|
||||
).toBeVisible();
|
||||
await page
|
||||
.getByRole('option', {
|
||||
name: 'Marketplace Runner Runner used by the grouped selector test.',
|
||||
exact: true,
|
||||
})
|
||||
.click();
|
||||
await expect(runnerSelect).toContainText('Marketplace Runner');
|
||||
|
||||
await runnerSelect.click();
|
||||
await expect(
|
||||
page.getByRole('option').filter({ hasText: runnerId }),
|
||||
page.getByRole('option', {
|
||||
name: 'Marketplace Runner Runner used by the grouped selector test.',
|
||||
exact: true,
|
||||
}),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByText('Runner used by the grouped selector test.', {
|
||||
page.getByRole('button', {
|
||||
name: 'Install Marketplace Runner',
|
||||
exact: true,
|
||||
}),
|
||||
).toHaveCount(0);
|
||||
@@ -1130,7 +1145,7 @@ test.describe('agent runner resource selectors', () => {
|
||||
const runnerSelect = page.getByRole('combobox', { name: 'Runner' });
|
||||
await runnerSelect.click();
|
||||
await expect(page.getByText('Installed Runners')).toBeVisible();
|
||||
await expect(page.getByText('Runner Marketplace')).toBeVisible();
|
||||
await expect(page.getByText('Runner plugins in Marketplace')).toBeVisible();
|
||||
await expect(
|
||||
page
|
||||
.locator('[data-slot="select-content"]')
|
||||
@@ -1139,9 +1154,10 @@ test.describe('agent runner resource selectors', () => {
|
||||
}),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page
|
||||
.getByRole('option')
|
||||
.filter({ hasText: 'Pipeline Marketplace Runner' }),
|
||||
page.getByRole('button', {
|
||||
name: 'Install Pipeline Marketplace Runner',
|
||||
exact: true,
|
||||
}),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
@@ -1214,8 +1230,11 @@ test.describe('agent and pipeline save concurrency', () => {
|
||||
|
||||
await page.goto('/home/agents?id=agent-save-race');
|
||||
const saveButton = page.getByRole('button', { name: /^Save$/ });
|
||||
await page.getByRole('tab', { name: 'Bindable Event Range' }).click();
|
||||
const eventPatterns = page.getByLabel('Event Range');
|
||||
await page.getByRole('tab', { name: 'Events & tools' }).click();
|
||||
const eventPatterns = page.getByRole('button', {
|
||||
name: 'Add event',
|
||||
exact: true,
|
||||
});
|
||||
await expect(eventPatterns).toBeVisible();
|
||||
|
||||
await eventPatterns.click();
|
||||
@@ -1231,8 +1250,8 @@ test.describe('agent and pipeline save concurrency', () => {
|
||||
await eventPatterns.click();
|
||||
await page.getByRole('option').filter({ hasText: 'group.*' }).click();
|
||||
await page
|
||||
.getByRole('option')
|
||||
.filter({ hasText: 'message.received' })
|
||||
.getByRole('button', { name: 'Remove event', exact: true })
|
||||
.first()
|
||||
.click();
|
||||
await page.keyboard.press('Escape');
|
||||
await forceFormSubmit(page, '#agent-form');
|
||||
|
||||
@@ -725,10 +725,12 @@ async function handleBackendApi(route: Route, state: LangBotApiMockState) {
|
||||
return fulfillJson(route, { agents: state.pipelines });
|
||||
}
|
||||
|
||||
const agentDebugMatch = path.match(/^\/api\/v1\/agents\/([^/]+)\/debug$/);
|
||||
const agentDebugMatch = path.match(
|
||||
/^\/api\/v1\/agents\/([^/]+)\/debug(?:\/stream)?$/,
|
||||
);
|
||||
if (agentDebugMatch) {
|
||||
const payload = parseJsonBody(route);
|
||||
return fulfillJson(route, {
|
||||
const result = {
|
||||
event_id: nextId(state, 'event'),
|
||||
event_type: String(payload.event_type || 'message.received'),
|
||||
conversation_id: String(payload.conversation_id || 'debug-session'),
|
||||
@@ -740,7 +742,15 @@ async function handleBackendApi(route: Route, state: LangBotApiMockState) {
|
||||
text: 'Mock Agent response',
|
||||
},
|
||||
],
|
||||
});
|
||||
};
|
||||
if (path.endsWith('/stream')) {
|
||||
return route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'application/x-ndjson',
|
||||
body: JSON.stringify({ kind: 'completed', data: result }) + '\n',
|
||||
});
|
||||
}
|
||||
return fulfillJson(route, result);
|
||||
}
|
||||
|
||||
const agentMatch = path.match(/^\/api\/v1\/agents\/([^/]+)$/);
|
||||
|
||||
@@ -11,7 +11,7 @@ const appRoutes = [
|
||||
{
|
||||
path: '/home/agents',
|
||||
heading: 'Processors',
|
||||
bodyText: 'Select an Agent or Pipeline from the sidebar',
|
||||
bodyText: 'Select a processor from the sidebar',
|
||||
},
|
||||
{
|
||||
path: '/home/extensions',
|
||||
|
||||
@@ -60,8 +60,8 @@ test.describe('processor detail workbench', () => {
|
||||
|
||||
const appShell = page.locator('[class*="group/sidebar-wrapper"]');
|
||||
const sidebarInset = page.locator('[data-slot="sidebar-inset"]');
|
||||
await expect(appShell).toHaveCSS('overflow', 'clip');
|
||||
await expect(sidebarInset).toHaveCSS('overflow', 'clip');
|
||||
await expect(appShell).toHaveCSS('overflow', 'hidden');
|
||||
await expect(sidebarInset).toHaveCSS('overflow', 'hidden');
|
||||
await appShell.evaluate((element) => {
|
||||
element.scrollTop = 300;
|
||||
});
|
||||
@@ -79,9 +79,7 @@ test.describe('processor detail workbench', () => {
|
||||
const flow = configPanel.getByRole('tablist');
|
||||
await expect(flow.getByRole('tab').nth(0)).toContainText('Runner');
|
||||
await expect(flow.getByRole('tab').nth(1)).toContainText('Local Agent');
|
||||
await expect(flow.getByRole('tab').nth(2)).toContainText(
|
||||
'Bindable Event Range',
|
||||
);
|
||||
await expect(flow.getByRole('tab').nth(2)).toContainText('Events & tools');
|
||||
await expect(flow.getByRole('tab')).toHaveCount(3);
|
||||
await expect(flow.getByText('Management')).toHaveCount(0);
|
||||
|
||||
@@ -126,19 +124,32 @@ test.describe('processor detail workbench', () => {
|
||||
|
||||
await flow.getByRole('tab').nth(2).click();
|
||||
await expect(
|
||||
configPanel.getByText('Bindable Event Range', { exact: true }).last(),
|
||||
configPanel.getByText('Events & tools', { exact: true }).last(),
|
||||
).toBeVisible();
|
||||
const eventPicker = configPanel.getByRole('combobox', {
|
||||
name: 'Event Range',
|
||||
const eventPicker = configPanel.getByRole('button', {
|
||||
name: 'Add event',
|
||||
exact: true,
|
||||
});
|
||||
await expect(eventPicker).toBeVisible();
|
||||
await expect(configPanel.getByRole('textbox')).toHaveCount(0);
|
||||
await expect(configPanel.getByRole('textbox')).toHaveCount(1);
|
||||
await expect(
|
||||
configPanel.getByRole('textbox', { name: 'Search tools…' }),
|
||||
).toBeVisible();
|
||||
await eventPicker.click();
|
||||
await expect(
|
||||
page.getByRole('option').filter({ hasText: 'message.received' }),
|
||||
).toBeVisible();
|
||||
await expect(page.getByRole('group', { name: 'Messages' })).toHaveCount(1);
|
||||
await expect(page.getByRole('group', { name: 'Groups' })).toHaveCount(1);
|
||||
await expect(
|
||||
page.getByRole('option').filter({ hasText: 'group.*' }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page
|
||||
.locator('[cmdk-group-heading]')
|
||||
.getByText('Messages', { exact: true }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.locator('[cmdk-group-heading]').getByText('Groups', { exact: true }),
|
||||
).toBeVisible();
|
||||
await page
|
||||
.getByRole('option')
|
||||
.filter({ hasText: 'message.*' })
|
||||
@@ -189,7 +200,7 @@ test.describe('processor detail workbench', () => {
|
||||
}
|
||||
if (
|
||||
request.method() === 'POST' &&
|
||||
path === '/api/v1/agents/agent-workbench/debug'
|
||||
path === '/api/v1/agents/agent-workbench/debug/stream'
|
||||
) {
|
||||
requests.push('debug');
|
||||
}
|
||||
@@ -237,15 +248,17 @@ test.describe('processor detail workbench', () => {
|
||||
}) => {
|
||||
await installLangBotApiMocks(page, { authenticated: true });
|
||||
await page.route(
|
||||
'**/api/v1/agents/agent-workbench/debug',
|
||||
'**/api/v1/agents/agent-workbench/debug/stream',
|
||||
async (route) => {
|
||||
await route.fulfill({
|
||||
status: 422,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({
|
||||
code: 'dify.config_invalid',
|
||||
msg: 'api-key is required',
|
||||
}),
|
||||
status: 200,
|
||||
contentType: 'application/x-ndjson',
|
||||
body:
|
||||
JSON.stringify({
|
||||
kind: 'error',
|
||||
code: 'dify.config_invalid',
|
||||
msg: 'api-key is required',
|
||||
}) + '\n',
|
||||
});
|
||||
},
|
||||
);
|
||||
@@ -454,8 +467,8 @@ test.describe('processor detail workbench', () => {
|
||||
|
||||
const appShell = page.locator('[class*="group/sidebar-wrapper"]');
|
||||
const sidebarInset = page.locator('[data-slot="sidebar-inset"]');
|
||||
await expect(appShell).toHaveCSS('overflow', 'clip');
|
||||
await expect(sidebarInset).toHaveCSS('overflow', 'clip');
|
||||
await expect(appShell).toHaveCSS('overflow', 'hidden');
|
||||
await expect(sidebarInset).toHaveCSS('overflow', 'hidden');
|
||||
await expect
|
||||
.poll(() => appShell.evaluate((element) => element.scrollTop))
|
||||
.toBe(0);
|
||||
|
||||
Reference in New Issue
Block a user