# Default Playwright Script Review Hints

## General Guidelines

### 1. Authentication
- Always login through Halo QA (https://halo-qa.hyly.ai)
- Use environment variables: TEST_EMAIL and TEST_PASSWORD
- Include fallback values for local testing

### 2. Page Objects
- Must use existing page objects when available
- Import paths must be correct (../ for same level, ../../ for subfolders)
- Don't create inline page object methods

### 3. Selectors Priority
1. Semantic selectors (getByRole, getByText, getByLabel)
2. Data attributes (data-testid)
3. Class selectors for specific components
4. ID selectors when unique
5. CSS selectors as last resort

### 4. Wait Strategies
✅ **Use:**
- `waitForTimeout(2000-5000)` for stability
- `waitFor()` with specific conditions
- `waitForURL()` for navigation

❌ **Avoid:**
- `waitForLoadState('networkidle')`
- Arbitrary long waits without reason
- No waits at all after navigation

### 5. Test Structure
- Set appropriate timeout at test start
- Use test.step() for organization
- Include meaningful assertions
- Handle both success and failure paths

### 6. Error Handling
- Scripts should be resilient to minor UI changes
- Include fallback selectors where appropriate
- Don't assume exact text matches

## Common Issues to Check

1. **Import Errors**: Verify all imports exist
2. **Selector Fragility**: Check if selectors are too specific
3. **Missing Assertions**: Ensure tests actually verify something
4. **Timeout Issues**: Confirm appropriate timeouts are set
5. **Environment Dependencies**: Check for hardcoded values

## Flexibility Guidelines

- Accept multiple valid approaches to the same problem
- Don't reject scripts for style preferences
- Focus on functionality over perfection
- Consider maintenance implications

## Critical Failures

These issues should result in rejection:
- Security issues (exposed credentials)
- Guaranteed runtime errors
- Infinite loops or recursion
- Missing critical test steps
- Wrong application URLs