47 lines
1.5 KiB
Markdown
47 lines
1.5 KiB
Markdown
# PlayWrong VS Code Extension
|
|
|
|
This extension provides syntax highlighting for PlayWrong test files (.test).
|
|
|
|
## Installation
|
|
|
|
1. Copy the `playwrong-syntax` folder to your VS Code extensions directory:
|
|
- **Windows**: `%USERPROFILE%\.vscode\extensions\`
|
|
- **macOS**: `~/.vscode/extensions/`
|
|
- **Linux**: `~/.vscode/extensions/`
|
|
|
|
2. Restart VS Code
|
|
|
|
3. Open any `.test` file and enjoy syntax highlighting!
|
|
|
|
4. (Optional) Enable the PlayWrong theme for better colors:
|
|
- Press `Ctrl+Shift+P` → "Preferences: Color Theme"
|
|
- Select "PlayWrong Theme"
|
|
|
|
## Features
|
|
|
|
- **Syntax Highlighting**: Keywords, commands, strings, numbers, and variables
|
|
- **Comment Support**: Use `#` for line comments and `/* */` for multi-line comments
|
|
- **Auto-completion**: Bracket and quote auto-closing
|
|
- **Variable Highlighting**: `$VARIABLE` and `${VARIABLE}` syntax
|
|
- **Custom Theme**: Optimized colors for PlayWrong syntax
|
|
|
|
## Supported Commands
|
|
|
|
- `use`, `open`, `wait`, `click`, `fill`, `scroll`, `sleep`, `dump`, `break`
|
|
- Element selectors: `element`, `childText`, `class`, `id`, `name`, `href`, `type`, `value`, `child`
|
|
- Environment variables: `$PASSWORD`, `${API_KEY}`
|
|
|
|
## Example
|
|
|
|
```playwrong
|
|
/*
|
|
Multi-line comment block
|
|
This test demonstrates login functionality
|
|
*/
|
|
# This is a line comment
|
|
use "Chrome"
|
|
open "data:text/html,<html><body><h1>Comment Test</h1></body></html>"
|
|
fill element=input type="password" value="$PASSWORD"
|
|
click element=button childText="Login" /* inline comment */
|
|
sleep 2000 "wait for page load"
|
|
``` |