Why Configure Viewports?
Configuring viewports allows you to:- Test responsive design across desktop, tablet, and mobile screen sizes
- Verify that UI elements appear correctly at different resolutions
- Ensure your application is usable on various devices
- Catch layout issues that only appear at specific dimensions
Configuring Viewports in Your Pilot File
You can define viewports at the test case level using theviewports
field. Here’s how to set it
up:
name
: A descriptive name for the viewport (e.g., “Desktop”, “Tablet”, “Mobile”)size
: An array of two integers representing width and height in pixels
How Testpilot Uses Viewports
When you define multiple viewports for a test case, Testpilot will:- Run the test case once for each viewport configuration
- Resize the browser window to match each viewport’s dimensions before starting the test
- Take screenshots and generate reports that show how your site appears at each size
- Identify any issues specific to particular screen sizes
Common Viewport Sizes
Here are some commonly used viewport sizes for different device categories:Desktop
Tablet
Mobile
Tips for Viewport Testing
- Start with key breakpoints: Focus on testing the major breakpoints where your UI changes significantly
- Test critical user flows: Ensure important user journeys work on all screen sizes
- Consider device-specific behaviors: Some features might work differently on touch devices versus desktop
- Test orientation changes: For tablet and mobile viewports, consider testing both portrait and landscape orientations
- Check for overflow issues: Verify that content doesn’t overflow or get cut off at smaller screen sizes