A visual testing framework using Playwright and Applitools Eyes for automated visual testing. This framework enables reliable visual regression testing with cross-browser and cross-device coverage.
- Visual regression testing with Applitools Eyes
- Playwright test automation
- Cross-browser testing support
- Configurable test environments
- Easy-to-use test utilities
- Detailed visual test reporting
applitools-playwright-poc/
├── tests/
│ ├── visual/
│ │ └── login.visual.spec.ts # Visual test scenarios
│ └── utils/
│ └── eyes-setup.ts # Applitools configuration
├── playwright.config.ts # Playwright configuration
├── package.json # Project dependencies
└── .env # Environment variables
- Node.js 14 or higher
- Applitools account and API key
- npm or yarn package manager
- Clone the repository:
git clone https://github.com/poojamehta01/applitools-playwright-poc.git
cd applitools-playwright-poc
- Install dependencies:
npm install
- Configure environment variables:
Create a
.env
file in the root directory and add your Applitools API key:
APPLITOOLS_API_KEY=your_api_key_here
npm test
npm run test:visual
npm run test:debug
{
testDir: './tests',
timeout: 30000,
expect: {
timeout: 5000
},
use: {
actionTimeout: 0,
baseURL: 'http://localhost:3000',
trace: 'on-first-retry',
}
}
configuration.setApiKey(process.env.APPLITOOLS_API_KEY);
configuration.setBatch(new BatchInfo('Playwright Visual Tests'));
Example of a visual test:
visualTest('Login page visual test', async ({ page, eyes }) => {
await eyes.open(page, 'My App', 'Login Page Test');
await page.goto('/login');
await eyes.check('Login Page', Target.window().fully());
await eyes.close();
});
-
Naming Conventions
- Use descriptive test names
- Follow a consistent naming pattern for test files
- Use meaningful baseline names
-
Test Organization
- Group tests by feature or page
- Keep test files focused and maintainable
- Separate test data from test logic
-
Visual Testing
- Set appropriate viewport sizes
- Use layout regions when needed
- Handle dynamic content appropriately
- Maintain baseline images
-
Error Handling
- Implement proper error handling
- Use custom error messages
- Log relevant test information
Solution: Use layout regions or ignore regions for dynamic areas
Solution: Configure browser-specific settings in playwright.config.ts
Solution: Implement proper test setup with authentication helpers
- Playwright HTML reports are generated automatically
- View detailed test results in Applitools Test Manager
- Access visual diffs and test analytics
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Pooja Mehta
- GitHub: @poojamehta01
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ for QA Engineers and Developers