Skip to content

Commit 12b9e7e

Browse files
committed
test: add integration tests for --help and --version
The test suite only covered `open` + `delete-data`. This adds coverage for basic CLI flags that don't require a browser session.
1 parent e63e9b7 commit 12b9e7e

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/integration.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,22 @@ async function runCli(...args: string[]): Promise<CliResult> {
5959
});
6060
}
6161

62+
test('--help prints usage information', async ({}) => {
63+
const result = await runCli('--help');
64+
expect(result.exitCode).toBe(0);
65+
expect(result.output).toContain('playwright-cli');
66+
expect(result.output).toContain('Usage:');
67+
expect(result.output).toContain('open');
68+
expect(result.output).toContain('snapshot');
69+
expect(result.output).toContain('close');
70+
});
71+
72+
test('--version prints version', async ({}) => {
73+
const result = await runCli('--version');
74+
expect(result.exitCode).toBe(0);
75+
expect(result.output).toMatch(/\d+\.\d+/);
76+
});
77+
6278
test('open data URL', async ({}) => {
6379
expect(await runCli('open', 'data:text/html,hello', '--persistent')).toEqual(expect.objectContaining({
6480
output: expect.stringContaining('hello'),

0 commit comments

Comments
 (0)