From 12b9e7e68fcc318f9567244e6d3d3b187b547a34 Mon Sep 17 00:00:00 2001 From: Mani Movassagh Date: Sat, 21 Mar 2026 00:07:27 +0100 Subject: [PATCH] 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. --- tests/integration.spec.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/integration.spec.ts b/tests/integration.spec.ts index b48732d..986361e 100644 --- a/tests/integration.spec.ts +++ b/tests/integration.spec.ts @@ -59,6 +59,22 @@ async function runCli(...args: string[]): Promise { }); } +test('--help prints usage information', async ({}) => { + const result = await runCli('--help'); + expect(result.exitCode).toBe(0); + expect(result.output).toContain('playwright-cli'); + expect(result.output).toContain('Usage:'); + expect(result.output).toContain('open'); + expect(result.output).toContain('snapshot'); + expect(result.output).toContain('close'); +}); + +test('--version prints version', async ({}) => { + const result = await runCli('--version'); + expect(result.exitCode).toBe(0); + expect(result.output).toMatch(/\d+\.\d+/); +}); + test('open data URL', async ({}) => { expect(await runCli('open', 'data:text/html,hello', '--persistent')).toEqual(expect.objectContaining({ output: expect.stringContaining('hello'),