Files
InkNote/e2e/run.sh
T
marcandClaude Opus 5 df279a5d36 Replace unused vector clocks with a conflict check that works, drop the rest
The vector clocks in the server were never reached: no client sent one,
so the branch was dead and every write was a blind overwrite. Not "the
newer edit wins" — "the request that arrives last wins", which is worse:
a phone that was offline all day buries the laptop's newer work simply by
reconnecting late.

Each write now carries baseUpdatedAt, the revision it was written on top
of. If the note has moved on since, the incoming edit still wins — a
rejection would throw away what was just typed — but the state it
replaces is kept as a version marked "conflict", so both exist and the
history is where you choose. Clocks could have told a real conflict from
a device catching up, but that precision only pays off with a merge
interface, and this reuses the version history already built.

adoptRevision() stores the revision the server reports back, or the
second save in a row would be flagged as conflicting with the first.

Also removed, as agreed:
- POST /api/notes/pdf — accepted PDFs that nothing could ever read back,
  with no retrieval route and no viewer. The readme advertised "PDF
  Import & Annotation"; that claim is gone too.
- POST /api/sync — a batch endpoint the client never called.
- the tags column — notebooks, starring and search already cover it.

Columns on existing databases are left in place. Dropping them buys
nothing and is not worth touching a live database for.

Tables now have a right-click menu (editor/tableMenu.js) for rows,
columns, header and merging. It needs stopPropagation: without it the
same event reaches window, where the menu that is mounting reads it as a
click elsewhere and closes instantly — the reason the other context menus
in App.jsx already do this.

92 browser checks across seven suites, 125 unit tests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-08 18:59:08 +02:00

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)
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