Skip to content

Commit 7ceda10

Browse files
authored
[MOO-1887] Update screenshot comparison and test config (#288)
2 parents 10364ca + 24e6b2a commit 7ceda10

File tree

6 files changed

+9
-5
lines changed

6 files changed

+9
-5
lines changed

.github/workflows/NativePipeline.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ jobs:
465465
runs-on: ubuntu-22.04
466466
timeout-minutes: 60
467467
strategy:
468+
max-parallel: 10
468469
matrix:
469470
widget: ${{ fromJson(needs.scope.outputs.widgets) }}
470471
fail-fast: false
@@ -585,6 +586,7 @@ jobs:
585586
runs-on: macos-15
586587
timeout-minutes: 60
587588
strategy:
589+
max-parallel: 10
588590
matrix:
589591
widget: ${{ fromJson(needs.scope.outputs.widgets) }}
590592
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}`);
4 Bytes
Loading
-24.8 KB
Loading
22.6 KB
Loading

packages/pluggableWidgets/image-native/e2e/specs/maestro/Image_url.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ appId: "${APP_ID}"
1313
- extendedWaitUntil:
1414
visible: randText # Any random text that does not exist in the UI
1515
optional: true # This should be true so that the test won't fail
16-
timeout: 15000 # 15 seconds
16+
timeout: 20000 # 20 seconds
1717
- takeScreenshot:
1818
path: "maestro/images/actual/${PLATFORM}/image_url"
1919

0 commit comments

Comments
 (0)