mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 04:30:48 +00:00
refactor(tests): reorganize integration tests by execution mode
Move non-interactive tests to cli/, interactive tests to interactive/. Add cron-interactive.test.ts wrapping terminal-capture E2E in vitest. Update npm scripts and release workflow for new directory layout.
This commit is contained in:
parent
707b06ca48
commit
ded89618ec
28 changed files with 261 additions and 327 deletions
71
integration-tests/interactive/hooks-command.test.ts
Normal file
71
integration-tests/interactive/hooks-command.test.ts
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2026 Qwen Team
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||
import { TestRig } from '../test-helper.js';
|
||||
|
||||
describe('/hooks command', () => {
|
||||
let rig: TestRig;
|
||||
|
||||
beforeEach(async () => {
|
||||
rig = new TestRig();
|
||||
await rig.setup('/hooks command test');
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await rig.cleanup();
|
||||
});
|
||||
|
||||
it('should display hooks dialog when /hooks command is entered', async () => {
|
||||
const { ptyProcess } = rig.runInteractive();
|
||||
|
||||
let output = '';
|
||||
ptyProcess.onData((data) => {
|
||||
output += data;
|
||||
});
|
||||
|
||||
// Wait for CLI to be ready
|
||||
const isReady = await rig.waitForText('Type your message', 15000);
|
||||
expect(isReady, 'CLI did not start up in interactive mode correctly').toBe(
|
||||
true,
|
||||
);
|
||||
|
||||
// Type /hooks command
|
||||
ptyProcess.write('/hooks');
|
||||
|
||||
// Wait a bit for the command to be typed
|
||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||
|
||||
// Press Enter to execute the command
|
||||
ptyProcess.write('\r');
|
||||
|
||||
// Wait for hooks dialog to appear
|
||||
const showedHooksDialog = await rig.poll(
|
||||
() => output.includes('Hooks') || output.includes('hooks'),
|
||||
5000,
|
||||
200,
|
||||
);
|
||||
|
||||
// Print output for debugging
|
||||
console.log('Output after /hooks command:');
|
||||
console.log(output);
|
||||
|
||||
expect(showedHooksDialog, `Hooks dialog not shown. Output: ${output}`).toBe(
|
||||
true,
|
||||
);
|
||||
|
||||
// Close the dialog with Escape
|
||||
ptyProcess.write('\x1b');
|
||||
|
||||
// Wait a bit
|
||||
await new Promise((resolve) => setTimeout(resolve, 500));
|
||||
|
||||
// Exit with Ctrl+C twice
|
||||
ptyProcess.write('\x03');
|
||||
await new Promise((resolve) => setTimeout(resolve, 300));
|
||||
ptyProcess.write('\x03');
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue