Prerequisites
Prerequisites
- Node.js 18+ installed
- A Checkly account (sign up at checklyhq.com)
- Basic familiarity with JavaScript/TypeScript
Step 1: Initialize Your Project
Start by creating a new Checkly project using the CLI:Terminal
- Create a new project directory
- Install the Checkly CLI and dependencies
- Set up a basic project structure
- Generate example checks to get you started
- Choose your project name
- Select your preferred language (JavaScript or TypeScript)
- Configure basic project settings
Step 2: Project Structure
After initialization, your project will have the following structure:Step 3: Configure Your Project
Opencheckly.config.ts
to configure your monitoring setup:
Checkly.config.ts
Step 4: Write Your First Test
Create a new Playwright test file in the__checks__
directory:
Playwright.test.ts
Step 5: Test Locally
Before deploying, test your checks locally:Terminal
- Execute your Playwright tests
- Run API checks
- Generate screenshots, videos, and traces
- Provide detailed output and debugging information
Step 6: View Results
After deployment, you can:- View check results in the Checkly dashboard
- Set up alert channels to get notified of failures
- Access detailed traces and screenshots
- Monitor performance trends over time
Advanced Check Configuration
For more control over your browser checks:Checkly.config.ts
Best Practices
- Start Simple: Begin with basic page load tests before adding complex interactions
- Use Page Object Model: Organize your tests with reusable page objects
- Test Critical User Journeys: Focus on the most important user flows
- Set Appropriate Frequencies: Don’t over-monitor; balance coverage with costs
- Use Environment Variables: Keep sensitive data and URLs configurable
- Add Meaningful Assertions: Test both functionality and performance
- Take Screenshots: Helpful for debugging when tests fail
- Monitor APIs and UI: Combine browser and API checks for comprehensive coverage
Troubleshooting
Common Issues
Check fails locally but works in browser:- Verify selectors are stable
- Add proper waits for dynamic content
- Check for timing issues
Terminal
Playwright.test.ts
- Check the Checkly documentation
- Join the Checkly community
- Review example projects on GitHub
Next Steps
Once you have your first test running:- Add More Tests: Cover additional user journeys and API endpoints
- Set Up CI/CD: Integrate Checkly into your deployment pipeline
- Configure Alerts: Set up notifications for your team
- Explore Traces: Use OpenTelemetry integration for deeper insights
- Scale Your Monitoring: Add checks for different environments and regions