Skip to content

Commit 24e6b2a

Browse files
committed
Tolerate percentage instead of fixed pixels
1 parent 7e3bd9c commit 24e6b2a

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

.github/workflows/NativePipeline.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ jobs:
465465
runs-on: ubuntu-22.04
466466
timeout-minutes: 60
467467
strategy:
468-
max-parallel: 5
468+
max-parallel: 10
469469
matrix:
470470
widget: ${{ fromJson(needs.scope.outputs.widgets) }}
471471
fail-fast: false
@@ -586,7 +586,7 @@ jobs:
586586
runs-on: macos-15
587587
timeout-minutes: 60
588588
strategy:
589-
max-parallel: 5
589+
max-parallel: 10
590590
matrix:
591591
widget: ${{ fromJson(needs.scope.outputs.widgets) }}
592592
fail-fast: false

maestro/helpers/compare_screenshots.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,17 @@ fs.readdirSync(actualDir).forEach(file => {
7171
diffMask: true
7272
});
7373

74-
const pixelTolerance = 50;
75-
74+
const toleranceAmount = 0.02; // 2%
75+
const totalPixels = width * height;
76+
const pixelTolerance = Math.floor(totalPixels * toleranceAmount);
77+
7678
if (numDiffPixels > pixelTolerance) {
7779
fs.writeFileSync(diffPath, PNG.sync.write(diff));
7880
failedComparisons.push(file);
79-
console.log(`❌ Comparison failed for ${file}`);
81+
console.log(`❌ Comparison failed for ${file} (diff: ${numDiffPixels} > tolerance: ${pixelTolerance})`);
8082
} else {
8183
fs.appendFileSync(path.join(__dirname, '../../compare_output.txt'), `✅ Comparison passed for ${file}\n`);
82-
console.log(`✅ Comparison passed for ${file}`);
84+
console.log(`✅ Comparison passed for ${file} (diff: ${numDiffPixels} <= tolerance: ${pixelTolerance})`);
8385
}
8486
} else {
8587
console.log(`⚠️ Expected file not found for ${file}`);
-204 KB
Binary file not shown.
22.6 KB
Loading

0 commit comments

Comments
 (0)