A note is in exactly one chapter, or in none — which means the notebook itself. Chapters sit above the loose notes; tapping one opens its own list and the menu button becomes the way back out, which on a phone is the only way, since the list fills the screen. A chapter is not a wastebasket. Removing one never removes what it held: the notes come back to the notebook, where they can be seen and filed again. That is ON DELETE SET NULL, and it is also written out in the delete route, because it is the promise the whole thing rests on and should be visible where it happens rather than inferred from a schema. The dialog says so too, with the number of notes affected, and the suite removes a chapter holding three notes and asks the server for all three. Three rules keep the two levels honest. A note filed into a chapter leaves the notebook's own list, or filing it would appear to do nothing. A chapter belongs to its notebook, so the server refuses to file a note into a chapter of a book it is not in, and moving a note to another notebook clears its chapter. And separators belong to the list they were drawn in: a separator's order counts the notes before it, which means nothing across lists. Two bugs found while building it, both a day old and both affecting the desktop rather than the phone they were written for: - A submenu was clipped away. The context menu had been given `overflow-y: auto`, which cuts off anything flying out sideways — so the notebooks under "Move to..." were invisible and every click on them landed on the note list behind. The side was inverted too: `right: 100%` places a panel on the left. - A separator was a one-pixel hairline in the border colour with faint grey text on near-black. Present, and on a phone effectively invisible. And one test that never measured what it claimed. It asked whether a dragged note had become "the most recently changed" by reading the order on screen — but three notes made seconds apart share an `updated_at` second, so that order is a tie broken arbitrarily. It passed on luck for weeks and fell over on a run a fraction faster. It now compares the timestamps themselves, before and after the drag. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
49 lines
1.5 KiB
Bash
Executable File
49 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Runs the browser suites against a running InkNote.
|
|
#
|
|
# ./e2e/run.sh # all suites
|
|
# ./e2e/run.sh editor drawing # only these
|
|
#
|
|
# Needs the dev stack up (docker compose -f docker-compose.dev.yml up -d) and an
|
|
# admin account to create throwaway users with — marc/geheim123 by default,
|
|
# override with INKNOTE_ADMIN / INKNOTE_ADMIN_PASS.
|
|
set -uo pipefail
|
|
cd "$(dirname "$0")"
|
|
|
|
IMAGE="mcr.microsoft.com/playwright:v1.49.0-noble"
|
|
URL="${INKNOTE_URL:-http://localhost:3000}"
|
|
SUITES=("$@")
|
|
[ ${#SUITES[@]} -eq 0 ] && SUITES=(admin editor search-attachments history drawing export conflict pdf attachments-lifecycle organise chapters offline sync)
|
|
|
|
mkdir -p shots
|
|
if [ ! -d node_modules ]; then
|
|
echo "→ installing playwright once"
|
|
docker run --rm -v "$PWD:/w" -w /w "$IMAGE" npm install --no-audit --no-fund >/dev/null
|
|
fi
|
|
|
|
if ! curl -sf -o /dev/null "$URL"; then
|
|
echo "✗ $URL is not answering — start the stack first:"
|
|
echo " docker compose -f docker-compose.dev.yml up -d --build"
|
|
exit 1
|
|
fi
|
|
|
|
failed=()
|
|
for s in "${SUITES[@]}"; do
|
|
echo
|
|
echo "═══ $s ═══"
|
|
docker run --rm --network host \
|
|
-v "$PWD:/w" -v "$PWD/shots:/out" -w /w \
|
|
-e INKNOTE_URL="$URL" \
|
|
-e INKNOTE_ADMIN="${INKNOTE_ADMIN:-marc}" \
|
|
-e INKNOTE_ADMIN_PASS="${INKNOTE_ADMIN_PASS:-geheim123}" \
|
|
"$IMAGE" node "$s.mjs" || failed+=("$s")
|
|
done
|
|
|
|
echo
|
|
if [ ${#failed[@]} -eq 0 ]; then
|
|
echo "═══ all suites passed ═══"
|
|
else
|
|
echo "═══ FAILED: ${failed[*]} ═══"
|
|
exit 1
|
|
fi
|