Skip to content

Commit 49fc3bd

Browse files
committed
test: add integration tests for --help, --version, and install --skills
The test suite only covered `open` + `delete-data`. This adds coverage for basic CLI flags and the skill installation workflow.
1 parent e63e9b7 commit 49fc3bd

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

tests/integration.spec.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
import fs from 'fs';
1718
import path from 'path';
1819
import { spawn } from 'child_process';
1920
import { test, expect } from '@playwright/test';
@@ -59,6 +60,33 @@ async function runCli(...args: string[]): Promise<CliResult> {
5960
});
6061
}
6162

63+
test('--help prints usage information', async ({}) => {
64+
const result = await runCli('--help');
65+
expect(result.exitCode).toBe(0);
66+
expect(result.output).toContain('playwright-cli');
67+
expect(result.output).toContain('Usage:');
68+
expect(result.output).toContain('open');
69+
expect(result.output).toContain('snapshot');
70+
expect(result.output).toContain('close');
71+
});
72+
73+
test('--version prints version', async ({}) => {
74+
const result = await runCli('--version');
75+
expect(result.exitCode).toBe(0);
76+
expect(result.output).toMatch(/\d+\.\d+/);
77+
});
78+
79+
test('install --skills creates skill files', async ({}) => {
80+
const result = await runCli('install', '--skills');
81+
expect(result.exitCode).toBe(0);
82+
83+
const skillPath = path.join(test.info().outputPath(), '.claude', 'skills', 'playwright-cli', 'SKILL.md');
84+
expect(fs.existsSync(skillPath)).toBe(true);
85+
86+
const content = fs.readFileSync(skillPath, 'utf-8');
87+
expect(content).toContain('playwright-cli');
88+
});
89+
6290
test('open data URL', async ({}) => {
6391
expect(await runCli('open', 'data:text/html,hello', '--persistent')).toEqual(expect.objectContaining({
6492
output: expect.stringContaining('hello'),

0 commit comments

Comments
 (0)