Playwright Best Practices

Quick Reference | quality-booster.com | Updated: April 2026
🎯 The 6 Prompt Components
ComponentPurpose
RoleWho answers?
InstructionWhat to do?
ContextBackground info
Input DataConcrete data
ConstraintsLimitations
Output FormatDefine format
🛠️ Prompt Techniques
TechniqueWhen?
Zero-ShotSimple tasks
One-ShotShow format
Few-ShotLearn patterns
PersonaNeed expertise
Chain-of-ThoughtVisible logic
🎛️ System vs. User

System: Personality

You are a conservative
code reviewer...

User: Specific task

Review this endpoint:
📋 Templates

Test Cases:

You are a QA engineer.

User Story: """..."""

Constraints:
- Given-When-Then
- Happy Path + Edge Cases
- Max 8 test cases

Output:
| ID | Description |
| Steps | Expected |

Bug Analysis:

Analyze step by step:

1. Categorize bug
2. Estimate severity
3. Find root causes
4. Next steps
5. Add tests
⚡ Prompt Refinement
ProblemSolution
Too unstructuredImprove Output Format
Too genericExpand Context
Wrong focusPrecise Instruction
Too longAdd Constraints
InconsistentUse Few-Shot
🚨 Common Mistakes
MistakeBetter
"Test this""Generate 5 test cases for..."
No contextInclude User Story
No formatDefine format explicitly
Too complexBreak into sub-steps
🎯 Quick Wins

1. Negative Prompting

Avoid:
- Too similar tests
- Non-testable steps
- Vague formulations

2. LLM-as-a-Judge

Evaluate by:
1. Completeness
2. Clarity
3. Testability
4. Edge Cases
5. Score 1-5