docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
A utility that compares screenshot images from different browsers and platforms while intelligently handling rendering differences caused by anti-aliasing variations.
When testing web applications across different browsers and operating systems, screenshots of the same content may differ slightly due to varying text rendering, font anti-aliasing, and sub-pixel rendering techniques. These differences are visual artifacts rather than actual content changes and should be identified separately from genuine visual regressions.
Build a screenshot comparison tool that:
Your tool should accept:
The tool should:
/**
* Compares two screenshot images and generates a diff output
*
* @param {string} baselinePath - Path to the baseline PNG screenshot
* @param {string} comparisonPath - Path to the comparison PNG screenshot
* @param {string} outputPath - Path where the diff PNG should be written
* @returns {Promise<{mismatchedPixelsExcludingAA: number, mismatchedPixelsIncludingAA: number, passed: boolean}>}
*/
async function compareScreenshots(baselinePath, comparisonPath, outputPath) {
// IMPLEMENTATION HERE
}
module.exports = { compareScreenshots };Provides pixel-level image comparison with anti-aliasing detection support.
Provides PNG image encoding and decoding capabilities.