Skip to content

Commit 3603eac

Browse files
authored
test: place diff images next to baselines (#503)
# Summary Previously, due to a recent bug in maestro, diff images were placed in the `.maestro/screenshots/android/.maestro/screenshots/android` directory, same for iOS. This PR fixes that, by using absolute paths we ensure diff images are placed next to the baselines meaning in `.maestro/screenshots/{android, ios}` directories. ## Test Plan + Check if tests still pass. + "Break" a single baseline by for example coloring part of it and verify `*_diff.png` image is created in the same directory as the baseline. ## Screenshots / Videos N/A ## Compatibility | OS | Implemented | | ------- | :---------: | | iOS | ✅ | | Android | ✅ | ## Checklist - [x] E2E tests are passing - [ ] Required E2E tests have been added (if applicable)
1 parent 07c01db commit 3603eac

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

.maestro/scripts/run-tests.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ if [ "$(printf '%s\n' "$MIN_MAESTRO_VERSION" "$MAESTRO_VERSION" | sort -V | head
3434
fi
3535

3636
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
37+
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
38+
SCREENSHOT_ROOT="$REPO_ROOT/.maestro/screenshots"
3739
BUNDLE_ID="swmansion.enriched.example"
3840

3941
PLATFORM=""
@@ -80,8 +82,8 @@ else
8082
echo "=== App ($BUNDLE_ID) already installed, skipping build ==="
8183
fi
8284

83-
EXTRA=""
84-
[ -n "$UPDATE_SCREENSHOTS" ] && EXTRA="--env UPDATE_SCREENSHOTS=true"
85+
EXTRA="--env SCREENSHOT_ROOT=$SCREENSHOT_ROOT"
86+
[ -n "$UPDATE_SCREENSHOTS" ] && EXTRA="$EXTRA --env UPDATE_SCREENSHOTS=true"
8587

8688
# Exclude tests tagged for the other platform.
8789
case "$PLATFORM" in

.maestro/subflows/capture_or_assert_screenshot.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ appId: swmansion.enriched.example
88
true: ${UPDATE_SCREENSHOTS === "true"}
99
commands:
1010
- takeScreenshot:
11-
path: ".maestro/screenshots/${maestro.platform}/${SCREENSHOT_NAME}"
11+
path: "${SCREENSHOT_ROOT}/${maestro.platform}/${SCREENSHOT_NAME}"
1212
cropOn:
1313
id: "editor-input"
1414

@@ -17,7 +17,7 @@ appId: swmansion.enriched.example
1717
true: ${UPDATE_SCREENSHOTS !== "true"}
1818
commands:
1919
- assertScreenshot:
20-
path: ".maestro/screenshots/${maestro.platform}/${SCREENSHOT_NAME}.png"
20+
path: "${SCREENSHOT_ROOT}/${maestro.platform}/${SCREENSHOT_NAME}"
2121
thresholdPercentage: 100
2222
cropOn:
2323
id: "editor-input"

0 commit comments

Comments
 (0)