fix(mobile): the rail fades where its entries scroll on a short window; the watch capture says why it retries

On a wide window too short for every entry (a folded Duo on its side) the
rail's list scrolls with its scrollbar hidden, and settings and
administration at its foot were cut off without a sign. The list now fades
at the edge with more behind it, as other scrolling lists do.

watch-screens.sh names the step that failed (launch, not ready,
screenshot) and tries once more after 20 seconds before it gives up.
This commit is contained in:
Maurice
2026-11-08 00:33:07 +00:00
parent 41752887dc
commit 3b7cdf516a
3 changed files with 36 additions and 10 deletions
+7 -6
View File
@@ -66,12 +66,12 @@ wait_ready() {
TOKEN=0
# shot <udid> <file> <screen> <scenario> <time or -> <language>: one launch, retried
# after 2, 5 and 10 seconds when the simulator refuses it.
# after 2, 5, 10 and 20 seconds when the simulator refuses it, saying which step failed.
shot() {
local udid=$1 file=$2 screen=$3 scenario=$4 clock=$5 lang=$6
local locale=${lang//-/_} attempt
for attempt in 0 2 5 10; do
[ "$attempt" -gt 0 ] && { echo "retrying $(basename "$file") in ${attempt}s"; sleep "$attempt"; }
local locale=${lang//-/_} attempt failed=
for attempt in 0 2 5 10 20; do
[ "$attempt" -gt 0 ] && { echo "retrying $(basename "$file") in ${attempt}s ($failed)"; sleep "$attempt"; }
TOKEN=$((TOKEN + 1))
xcrun simctl terminate "$udid" "$BUNDLE" >/dev/null 2>&1 || true
sleep 0.5
@@ -79,11 +79,12 @@ shot() {
[ "$clock" = - ] || extra=(-TrekNow "$clock")
xcrun simctl launch "$udid" "$BUNDLE" \
-AppleLanguages "($lang)" -AppleLocale "$locale" -TrekDemo "$screen" -TrekScenario "$scenario" \
-TrekReady "$TOKEN" ${extra[@]+"${extra[@]}"} >/dev/null 2>&1 || continue
wait_ready "$udid" "$TOKEN" || continue
-TrekReady "$TOKEN" ${extra[@]+"${extra[@]}"} >/dev/null 2>&1 || { failed=launch; continue; }
wait_ready "$udid" "$TOKEN" || { failed='not ready'; continue; }
# The map's tiles come over the network after the screen is up.
[ "$screen" = place ] && sleep 6
xcrun simctl io "$udid" screenshot --type=png "$file" >/dev/null 2>&1 && return 0
failed=screenshot
done
echo "gave up on $(basename "$file")"
}
+10 -3
View File
@@ -1,4 +1,5 @@
import { useLayoutEffect, useRef, type ReactNode, type RefObject } from 'react';
import { useLayoutEffect, useRef, useState, type ReactNode, type RefObject } from 'react';
import { edgeFadeClass, useEdgeFade } from './useEdgeFade';
/**
* The rail on the leading edge that takes the dock's place on a wide window
@@ -27,6 +28,9 @@ export function MRail({
}) {
const listRef = useRef<HTMLDivElement>(null);
useEvenLines(listRef);
// On a short window the entries scroll; the cut edge fades, so the foot's entries read as more below.
const [list, setList] = useState<HTMLDivElement | null>(null);
const fade = useEdgeFade(list, 'y');
return (
<nav
aria-label={label}
@@ -34,8 +38,11 @@ export function MRail({
>
{head && <div className="mb-2 flex flex-none justify-center">{head}</div>}
<div
ref={listRef}
className="flex min-h-0 w-full flex-1 flex-col items-center gap-1 overflow-y-auto px-1 [scrollbar-width:none]"
ref={(node) => {
listRef.current = node;
setList(node);
}}
className={`flex min-h-0 w-full flex-1 flex-col items-center gap-1 overflow-y-auto px-1 [scrollbar-width:none] ${edgeFadeClass(fade, 'y')}`}
>
{children}
</div>
+19 -1
View File
@@ -9,7 +9,7 @@ import { useAddonStore } from '../../../src/store/addonStore';
import { useAuthStore } from '../../../src/store/authStore';
import { usePluginStore } from '../../../src/store/pluginStore';
import { buildUser } from '../../helpers/factories';
import { fireEvent, render, screen, within } from '../../helpers/render';
import { act, fireEvent, render, screen, within } from '../../helpers/render';
import { setSizeClass } from '../../helpers/sizeClass';
// FE-MOB-RAIL-001 onwards
@@ -84,6 +84,24 @@ describe('MNavRail', () => {
expect(within(rail()).getByRole('button', { name: 'My Trips' })).not.toHaveAttribute('aria-current');
});
it('FE-MOB-RAIL-013: on a window too short for every entry the list fades at the edge that has more behind it', () => {
useAuthStore.setState({ user: buildUser({ role: 'admin' }) });
render(<MNavRail />, { initialEntries: ['/dashboard'] });
const list = rail().querySelector('.overflow-y-auto') as HTMLElement;
expect(list.className).not.toMatch(/m-fade-/);
Object.defineProperty(list, 'scrollHeight', { configurable: true, value: 800 });
Object.defineProperty(list, 'clientHeight', { configurable: true, value: 400 });
act(() => {
list.dispatchEvent(new Event('scroll'));
});
expect(list).toHaveClass('m-fade-b');
list.scrollTop = 400;
act(() => {
list.dispatchEvent(new Event('scroll'));
});
expect(list).toHaveClass('m-fade-t');
});
it("FE-MOB-RAIL-004: the create button keeps the dock's meaning and its exceptions", () => {
const { unmount } = render(
<>