Skip to content

[MOO-1887] Update screenshot comparison and test config #288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/NativePipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ jobs:
runs-on: ubuntu-22.04
timeout-minutes: 60
strategy:
max-parallel: 10
matrix:
widget: ${{ fromJson(needs.scope.outputs.widgets) }}
fail-fast: false
Expand Down Expand Up @@ -585,6 +586,7 @@ jobs:
runs-on: macos-15
timeout-minutes: 60
strategy:
max-parallel: 10
matrix:
widget: ${{ fromJson(needs.scope.outputs.widgets) }}
fail-fast: false
Expand Down
10 changes: 6 additions & 4 deletions maestro/helpers/compare_screenshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,17 @@ fs.readdirSync(actualDir).forEach(file => {
diffMask: true
});

const pixelTolerance = 50;

const toleranceAmount = 0.02; // 2%
const totalPixels = width * height;
const pixelTolerance = Math.floor(totalPixels * toleranceAmount);

if (numDiffPixels > pixelTolerance) {
fs.writeFileSync(diffPath, PNG.sync.write(diff));
failedComparisons.push(file);
console.log(`❌ Comparison failed for ${file}`);
console.log(`❌ Comparison failed for ${file} (diff: ${numDiffPixels} > tolerance: ${pixelTolerance})`);
} else {
fs.appendFileSync(path.join(__dirname, '../../compare_output.txt'), `✅ Comparison passed for ${file}\n`);
console.log(`✅ Comparison passed for ${file}`);
console.log(`✅ Comparison passed for ${file} (diff: ${numDiffPixels} <= tolerance: ${pixelTolerance})`);
}
} else {
console.log(`⚠️ Expected file not found for ${file}`);
Expand Down
Binary file modified maestro/images/expected/android/background_gradient.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified maestro/images/expected/ios/background_gradient.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified maestro/images/expected/ios/progress_circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ appId: "${APP_ID}"
- extendedWaitUntil:
visible: randText # Any random text that does not exist in the UI
optional: true # This should be true so that the test won't fail
timeout: 15000 # 15 seconds
timeout: 20000 # 20 seconds
- takeScreenshot:
path: "maestro/images/actual/${PLATFORM}/image_url"

Loading