From fa5a01116d10e52a1bbe85d66299aefd875e36f8 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 12 Oct 2026 22:59:56 +0300 Subject: [PATCH] [APP-3245] Fix the nightly Maestro E2E run (#11954) Co-authored-by: Claude Opus 5.5 --- .github/workflows/nightly-e2e.yml | 3 ++ __e2e__/flows/composer.yml | 8 ++++ __e2e__/flows/create-account.yml | 21 +++++++--- __e2e__/setupApp.yml | 27 ++++++++++-- src/components/DraggableList/index.tsx | 58 ++++++++++++++++++++------ 5 files changed, 96 insertions(+), 21 deletions(-) diff --git a/.github/workflows/nightly-e2e.yml b/.github/workflows/nightly-e2e.yml index 6e46ee81f..24b26e655 100644 --- a/.github/workflows/nightly-e2e.yml +++ b/.github/workflows/nightly-e2e.yml @@ -113,6 +113,9 @@ jobs: xcrun simctl shutdown all || true xcrun simctl boot "$udid" xcrun simctl bootstatus "$udid" -b + # Turn off password AutoFill so iOS doesn't offer a strong password on + # the signup form: its panel swallows the text Maestro types. + xcrun simctl spawn "$udid" defaults write com.apple.WebUI AutoFillPasswords -int 0 echo "Using $device_name on $runtime_name ($udid)" - name: 🏷️ Mark iOS development client build phase diff --git a/__e2e__/flows/composer.yml b/__e2e__/flows/composer.yml index e348ec1b2..c0871f859 100644 --- a/__e2e__/flows/composer.yml +++ b/__e2e__/flows/composer.yml @@ -42,6 +42,14 @@ appId: xyz.blueskyweb.app id: "composeFAB" - tapOn: id: "e2eRefreshHome" +# Following v2 (always on in e2e builds) can keep the reader where they were +# and put the refreshed posts above them, out of view - it does on Android. +# Scroll up to the newest post, or the first replyBtn is one scrolled up under +# the header. +- scrollUntilVisible: + element: + text: "Post with a .*link card" + direction: UP - tapOn: id: "replyBtn" # Wait for the composer to fully open before typing. Tapping replyBtn right diff --git a/__e2e__/flows/create-account.yml b/__e2e__/flows/create-account.yml index 89218ecf8..af83e0058 100644 --- a/__e2e__/flows/create-account.yml +++ b/__e2e__/flows/create-account.yml @@ -51,13 +51,22 @@ appId: xyz.blueskyweb.app platform: Android commands: - tapOn: "Switch to selecting a year" - - scrollUntilVisible: - element: - text: "2007" - direction: UP - - tapOn: "2007" + # The Material 3 picker labels year cells "Navigate to year 2007" and day + # cells with the full date (e.g. "Friday, October 12, 2007"), and Maestro + # matches the whole label. The year grid opens at the current year, so + # drag back a couple of rows at a time, slowly, so 2007 can't be skipped. + - repeat: + times: 20 + while: + notVisible: "Navigate to year 2007" + commands: + - swipe: + start: 50%, 45% + end: 50%, 55% + duration: 1000 + - tapOn: "Navigate to year 2007" # Selecting a year changes the displayed month, not the selected date. - - tapOn: "${new Date().getDate()}" + - tapOn: ".* ${new Date().getDate()}, 2007" - tapOn: "OK" - tapOn: id: "nextBtn" diff --git a/__e2e__/setupApp.yml b/__e2e__/setupApp.yml index c7705951f..a79d2a2cf 100644 --- a/__e2e__/setupApp.yml +++ b/__e2e__/setupApp.yml @@ -1,8 +1,29 @@ appId: xyz.blueskyweb.app --- -- launchApp: - appId: "xyz.blueskyweb.app" - clearState: true +# On Android, name the permissions to grant rather than taking launchApp's +# default (all: allow). To grant "all", Maestro pulls the whole debug APK over +# adb on every launch to read its manifest, and that transfer has no timeout, +# so it occasionally hangs a flow for 25-45 minutes. +- runFlow: + when: + platform: Android + commands: + - launchApp: + appId: "xyz.blueskyweb.app" + clearState: true + permissions: + notifications: allow + camera: allow + microphone: allow + medialibrary: allow + contacts: allow +- runFlow: + when: + platform: iOS + commands: + - launchApp: + appId: "xyz.blueskyweb.app" + clearState: true - extendedWaitUntil: visible: "Sign in" timeout: 180000 diff --git a/src/components/DraggableList/index.tsx b/src/components/DraggableList/index.tsx index 8634bb0fc..316c2d161 100644 --- a/src/components/DraggableList/index.tsx +++ b/src/components/DraggableList/index.tsx @@ -254,24 +254,50 @@ function SortableItem({ const lastHapticSlot = useSharedValue(-1) + /** + * Makes this item the one being dragged. Returns false if the item has no + * slot yet. + */ + const startDrag = () => { + 'worklet' + const s = state.get() + const mySlot = s.slots[itemKey] + if (mySlot === undefined) { + return false + } + state.set({...s, activeKey: itemKey, dragStartSlot: mySlot}) + dragY.set(0) + scrollCompensation.set(0) + isGestureActive.set(true) + measureDone.set(false) + lastHapticSlot.set(mySlot) + if (onDragStart) { + scheduleOnRN(onDragStart) + } + scheduleOnRN(playDragStartHaptic) + return true + } + const gesture = usePanGesture({ onActivate: () => { 'worklet' - const s = state.get() - const mySlot = s.slots[itemKey] - state.set({...s, activeKey: itemKey, dragStartSlot: mySlot}) - dragY.set(0) - scrollCompensation.set(0) - isGestureActive.set(true) - measureDone.set(false) - lastHapticSlot.set(mySlot) - if (onDragStart) { - scheduleOnRN(onDragStart) - } - scheduleOnRN(playDragStartHaptic) + startDrag() }, onUpdate: e => { 'worklet' + const activeKey = state.get().activeKey + if (activeKey !== itemKey) { + /* + * RNGH v3 can deliver updates for a pan whose drag we already reset + * in onFinalize, without activating it again. Seen with Maestro's + * synthetic swipes on the iOS simulator, possibly because raising the + * item's zIndex cancels the pan right after it activates. Pick the + * drag back up, unless another item owns it. + */ + if (activeKey !== '' || !startDrag()) { + return + } + } const startSlot = state.get().dragStartSlot const minY = -startSlot * itemHeight const maxY = (itemCount - 1 - startSlot) * itemHeight @@ -293,6 +319,14 @@ function SortableItem({ 'worklet' // Stop auto-scroll BEFORE the snap animation. isGestureActive.set(false) + /* + * Only the item being dragged may commit. Committing while idle + * (dragStartSlot -1) would move sorted[-1], an undefined key, into the + * new order. + */ + if (state.get().activeKey !== itemKey) { + return + } const startSlot = state.get().dragStartSlot const rawNewSlot = Math.round( (startSlot * itemHeight + dragY.get()) / itemHeight, -- knotmirror 0.0.1