refactor(events): group event selection options

This commit is contained in:
RockChinQ
2026-08-25 23:59:52 +08:00
parent 4d7a333802
commit d28b385a9f
8 changed files with 223 additions and 101 deletions
+23 -2
View File
@@ -353,7 +353,10 @@ test.describe('bot advanced flows', () => {
test('keeps event routing compact and hides raw status errors', async ({
page,
}) => {
await installLangBotApiMocks(page, { authenticated: true });
await installLangBotApiMocks(page, {
authenticated: true,
withAdapterEvents: true,
});
await page.route('**/api/v1/platform/bots/*/event-routes/status', (route) =>
route.fulfill({
status: 500,
@@ -416,7 +419,9 @@ test.describe('bot advanced flows', () => {
await expect(page).toHaveURL(/\/home\/bots\?id=bot-1$/);
await expect(page.getByText('Supported events')).toBeVisible();
await expect(page.getByText('1 event types')).toBeVisible();
await expect(page.getByText('5 event types')).toBeVisible();
await expect(page.getByText('Messages · 2')).toBeVisible();
await expect(page.getByText('Groups · 2')).toBeVisible();
await expect(page.getByText('Internal server error')).toHaveCount(0);
await expect(
page.getByText('Events that match no route are ignored.'),
@@ -436,6 +441,14 @@ test.describe('bot advanced flows', () => {
dangerBox!.y - (routingBox!.y + routingBox!.height),
).toBeGreaterThanOrEqual(20);
await routingCard.getByRole('button', { name: 'View all' }).click();
await expect(
routingCard.getByText('Messages', { exact: true }),
).toBeVisible();
await expect(
routingCard.getByText('Groups', { exact: true }),
).toBeVisible();
await page.getByRole('button', { name: 'Refresh status' }).hover();
await expect(
page.getByText('Failed to refresh route status.'),
@@ -461,6 +474,14 @@ test.describe('bot advanced flows', () => {
await expect(
routeDialog.getByRole('button', { name: 'Run full test' }),
).toBeVisible();
await routeDialog.getByRole('combobox').first().click();
await expect(
page.getByText('Messages', { exact: true }).last(),
).toBeVisible();
await expect(
page.getByText('Groups', { exact: true }).last(),
).toBeVisible();
await page.keyboard.press('Escape');
await routeDialog.getByRole('button', { name: 'Preview match' }).click();
await expect(routeDialog.getByText('Matched route')).toBeVisible();
@@ -106,6 +106,8 @@ test.describe('processor detail workbench', () => {
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 page.keyboard.press('Escape');
await flow.getByRole('tab').nth(1).click();