Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion .claude/skills/playwright-dev/dashboard.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ npx playwright cli video-stop
# afterwards, use ffmpeg to turn the video into mp4 for sharing.
```

For using Playwright CLI, refer to the `packages/playwright-core/src/tools/cli-client/skill/SKILL.md` skill.
For more about using Playwright CLI, look at `npx playwright cli --help` and the referenced Skill.
While developing in in this repo, it's important to use `npx playwright cli` instead of `playwright-cli`.

1 change: 1 addition & 0 deletions packages/playwright-core/src/cli/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ export function decorateProgram(program: Command) {
.command('cli', { hidden: true })
.allowExcessArguments(true)
.allowUnknownOption(true)
.helpOption(false)
.action(async options => {
process.argv.splice(process.argv.indexOf('cli'), 1);
cliProgram().catch(logErrorAndExit);
Expand Down
3 changes: 2 additions & 1 deletion packages/playwright-core/src/tools/cli-client/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@ export async function program(options?: { embedderVersion?: string}) {
}

const command = commandName && help.commands[commandName];
if (args.help || args.h) {
if (args.help || args.h || !commandName) {
if (command) {
console.log(command.help);
} else {
console.log('playwright-cli - run playwright mcp commands from terminal\n');
console.log(`Agent skill: ${path.relative(process.cwd(), libPath('tools', 'cli-client', 'skill', 'SKILL.md'))}\n`);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should be sending the user to a relative path to the npm cache folder for skills? Rather should recommend running install --skills?

console.log(help.global);
}
process.exit(0);
Expand Down
7 changes: 6 additions & 1 deletion tests/mcp/cli-help.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@

import { test, expect } from './cli-fixtures';

test('prints help by default', async ({ cli }) => {
test('prints help', async ({ cli }) => {
const { output } = await cli('--help');
expect(output).toContain('Usage: playwright-cli <command>');
});

test('prints help by default', async ({ cli }) => {
const { output } = await cli();
expect(output).toContain('Usage: playwright-cli <command>');
});

test('prints command help', async ({ cli }) => {
const { output } = await cli('click', '--help');
expect(output).toContain('playwright-cli click <target> [button]');
Expand Down
Loading