Skip to content

Commit 9fe2046

Browse files
bloveclaude
andcommitted
test(c-messages): add aimock e2e (Task #4 pilot slice)
First slice of Task #4 (aimock e2e for newly-eligible caps). Generated via scripts/generate-aimock-scaffold.ts --cap c-messages, with hand-authored fixture content and spec assertions. - 5 new e2e/ files (playwright config + global-setup-impl + tsconfig + fixtures/c-messages.json + c-messages.spec.ts). - project.json gains the e2e Nx target. - ci.yml matrix gains a c-messages entry. Two spec tests: - user message + AI response both render via submitAndWaitForResponse. - chat-message-list renders both turns (regression coverage for PR #466's primitive-demo fix). The demo was broken at the component level in PR #462 (raw ChatMessageListComponent without projected templates). PR #466 fixed that by projecting the four chat-message templates. This re-pilot verifies the aimock e2e against the fixed demo. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5c7724a commit 9fe2046

7 files changed

Lines changed: 83 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ jobs:
270270
- { angular: cockpit-chat-tool-calls-angular, python: cockpit/chat/tool-calls/python }
271271
- { angular: cockpit-chat-subagents-angular, python: cockpit/chat/subagents/python }
272272
- { angular: cockpit-chat-interrupts-angular, python: cockpit/chat/interrupts/python }
273+
- { angular: cockpit-chat-messages-angular, python: cockpit/chat/messages/python }
273274
steps:
274275
- uses: actions/checkout@v6.0.2
275276
- uses: actions/setup-node@v6.3.0
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// SPDX-License-Identifier: MIT
2+
import { test, expect } from '@playwright/test';
3+
import { submitAndWaitForResponse } from '../../../../../libs/e2e-harness/src';
4+
5+
const PROMPT = 'Hello';
6+
7+
test('c-messages: user message and AI response both render', async ({ page }) => {
8+
const bubble = await submitAndWaitForResponse(page, PROMPT);
9+
10+
await expect(
11+
page.locator('chat-message[data-role="user"]').last(),
12+
).toContainText(PROMPT);
13+
14+
await expect(bubble).toContainText('chat-messages capability demo');
15+
});
16+
17+
test('c-messages: chat-message-list renders both turns', async ({ page }) => {
18+
await submitAndWaitForResponse(page, PROMPT);
19+
20+
// Post-PR-#466 the demo projects user + assistant templates, so the
21+
// list renders one bubble per message. Regression coverage for that fix.
22+
await expect(page.locator('chat-message-list chat-message')).toHaveCount(2);
23+
});
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"fixtures": [
3+
{
4+
"match": { "userMessage": "Hello" },
5+
"response": {
6+
"content": "Hi! I'm the chat-messages capability demo. I show how ChatMessageListComponent, ChatInputComponent, and ChatTypingIndicatorComponent render together. Try sending a few messages to see the bubbles and typing indicator in action."
7+
}
8+
}
9+
]
10+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// SPDX-License-Identifier: MIT
2+
import { resolve } from 'node:path';
3+
import { createGlobalSetup } from '../../../../../libs/e2e-harness/src';
4+
5+
export default createGlobalSetup({
6+
langgraphCwd: 'cockpit/chat/messages/python',
7+
langgraphPort: 5501,
8+
angularProject: 'cockpit-chat-messages-angular',
9+
angularPort: 4501,
10+
fixturesDir: resolve(__dirname, 'fixtures'),
11+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// SPDX-License-Identifier: MIT
2+
import { defineConfig, devices } from '@playwright/test';
3+
4+
export default defineConfig({
5+
testDir: '.',
6+
testMatch: '**/*.spec.ts',
7+
fullyParallel: false,
8+
workers: 1,
9+
retries: process.env.CI ? 2 : 0,
10+
reporter: process.env.CI ? [['list'], ['html', { open: 'never' }]] : 'list',
11+
use: {
12+
baseURL: 'http://localhost:4501',
13+
trace: 'retain-on-failure',
14+
},
15+
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
16+
globalSetup: './global-setup-impl.ts',
17+
globalTeardown: require.resolve('../../../../../libs/e2e-harness/src/global-teardown'),
18+
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2022",
4+
"module": "ES2022",
5+
"moduleResolution": "Bundler",
6+
"esModuleInterop": true,
7+
"strict": true,
8+
"skipLibCheck": true,
9+
"noEmit": true,
10+
"types": ["node"]
11+
},
12+
"include": ["**/*.ts"],
13+
"exclude": ["node_modules", "test-results", "playwright-report"]
14+
}

cockpit/chat/messages/angular/project.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@
8787
"cwd": "cockpit/chat/messages/angular",
8888
"command": "npx tsx -e \"import { chatMessagesAngularModule } from './src/index.ts'; const module = chatMessagesAngularModule; if (module.id !== 'chat-messages-angular' || module.title !== 'Chat Messages (Angular)') { throw new Error('Unexpected module shape for ' + module.id); }\""
8989
}
90+
},
91+
"e2e": {
92+
"executor": "@nx/playwright:playwright",
93+
"options": {
94+
"config": "cockpit/chat/messages/angular/e2e/playwright.config.ts"
95+
}
9096
}
9197
}
9298
}

0 commit comments

Comments
 (0)