Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,32 @@ jobs:
- working-directory: cockpit/langgraph/streaming/python
run: uv sync
- run: npx playwright install --with-deps chromium
- run: npx nx e2e cockpit --skip-nx-cache
# Explicit sequential loop (not `nx run-many --parallel=1`) so each
# per-example e2e gets a fresh Playwright process and a clean port
# state between invocations. nx run-many's scheduler doesn't insert
# a delay between target completions, which races OS-level port
# release on the second iteration (langgraph dev binds 8123 in
# every example). The 5s sleep between targets gives the OS time
# to fully release the port despite the harness's globalTeardown
# already process-group-killing the langgraph child tree.
#
# Each new cockpit example with an `e2e` target adds one line below.
- name: Run cockpit example aimock e2e suites
run: |
set -e
for proj in cockpit-langgraph-streaming-angular cockpit-chat-tool-calls-angular; do
echo "::group::nx e2e $proj"
npx nx e2e "$proj" --skip-nx-cache
echo "::endgroup::"
sleep 5
done
- name: Upload Playwright trace on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: cockpit-e2e-trace
path: apps/cockpit/e2e/test-results/
path: |
cockpit/**/angular/e2e/test-results/
retention-days: 7

website-e2e:
Expand Down
33 changes: 0 additions & 33 deletions apps/cockpit/e2e/README.md

This file was deleted.

79 changes: 0 additions & 79 deletions apps/cockpit/e2e/global-setup.ts

This file was deleted.

9 changes: 0 additions & 9 deletions apps/cockpit/e2e/global-teardown.ts

This file was deleted.

18 changes: 0 additions & 18 deletions apps/cockpit/e2e/streaming.spec.ts

This file was deleted.

32 changes: 0 additions & 32 deletions apps/cockpit/e2e/test-helpers.ts

This file was deleted.

6 changes: 0 additions & 6 deletions apps/cockpit/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@
"configFile": "apps/cockpit/vite.config.mts"
}
},
"e2e": {
"executor": "@nx/playwright:playwright",
"options": {
"config": "apps/cockpit/e2e/playwright.config.ts"
}
},
"serve-streaming": {
"executor": "nx:run-commands",
"options": {
Expand Down
20 changes: 20 additions & 0 deletions cockpit/chat/tool-calls/angular/e2e/c-tool-calls.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: MIT
import { test, expect } from '@playwright/test';
import { sendPromptAndWait } from '../../../../../libs/internal/aimock-harness/src';

const PROMPT = "What's the status of UA123?";

test('c-tool-calls: parent dispatches lookup_flight tool, continuation surfaces flight data', async ({ page }) => {
const bubble = await sendPromptAndWait(page, PROMPT);

// The chat-tool-calls primitive renders a card per tool call. Card label
// includes the tool name. Asserting it's in the DOM proves the parent's
// tool_call routed through the chat-tool-calls UI primitive.
const toolCallChip = page.getByRole('button', { name: /lookup_flight|tool/i }).first();
await expect(toolCallChip).toBeVisible({ timeout: 30_000 });

// The continuation's text mentions a distinctive phrase from the captured
// response — proves the tool-result-then-text loop completed end-to-end.
const finalText = await bubble.innerText();
expect(finalText.toLowerCase()).toContain('ua123');
});
28 changes: 28 additions & 0 deletions cockpit/chat/tool-calls/angular/e2e/fixtures/c-tool-calls.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"fixtures": [
{
"match": {
"userMessage": "What's the status of UA123?",
"hasToolResult": true
},
"response": {
"content": "I looked up UA123 using lookup_flight. Status: on time.\n\nSummary:\n- Flight: UA123 (United Airlines)\n- Route: LAX \u2192 JFK\n- Departure (local): 08:00 from gate B14\n- Arrival (local): 16:30\n- Aircraft: Boeing 787\n- Scheduled duration: 5 hr 30 min\n\nWould you like me to monitor this flight for updates or find alternate flights?"
}
},
{
"match": {
"userMessage": "What's the status of UA123?"
},
"response": {
"toolCalls": [
{
"name": "lookup_flight",
"arguments": {
"flight_number": "UA123"
}
}
]
}
}
]
}
16 changes: 16 additions & 0 deletions cockpit/chat/tool-calls/angular/e2e/global-setup-impl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: MIT
import { resolve } from 'node:path';
import { createGlobalSetup } from '../../../../../libs/internal/aimock-harness/src';

export default createGlobalSetup({
langgraphCwd: 'cockpit/langgraph/streaming/python',
// Each cockpit example pins its OWN langgraph port to avoid TIME_WAIT
// collisions when a sequential CI loop runs multiple per-example e2es
// back-to-back. The streaming pilot keeps the historical 8123 default;
// tool-calls offsets to 8124. Future examples pick the next unused port.
// The Angular proxy.conf.json target must match.
langgraphPort: 8124,
angularProject: 'cockpit-chat-tool-calls-angular',
angularPort: 4504,
fixturesDir: resolve(__dirname, 'fixtures'),
});
18 changes: 18 additions & 0 deletions cockpit/chat/tool-calls/angular/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: MIT
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
testDir: '.',
testMatch: '**/*.spec.ts',
fullyParallel: false,
workers: 1,
retries: process.env.CI ? 2 : 0,
reporter: process.env.CI ? [['list'], ['html', { open: 'never' }]] : 'list',
use: {
baseURL: 'http://localhost:4504',
trace: 'retain-on-failure',
},
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
globalSetup: './global-setup-impl.ts',
globalTeardown: require.resolve('../../../../../libs/internal/aimock-harness/src/global-teardown'),
});
Loading
Loading