Files
decePubClient/tests/e2e/run.sh
T
thepraandClaude Opus 5.5 011bafb6af End-to-end tests against the pasture; profiles, follows, search, votes, reactions
tests/e2e (Playwright for .NET 1.61.0 on xunit v3, the Chromium 1228 already
cached, never downloaded, never in CI) runs the published app against
SocialPub's pasture and its town: run.sh publishes it with the Pasture
environment (wwwroot/appsettings.Pasture.json, published only then; the
deploy fails if it ever ships) and serves it as https://decepub.test. The
tests sign in through the real login page and persona chooser, check that
every request goes only to decepub.test and privapub.test with the right
credential on the right API, render one post of each kind from each
platform as its author wrote it, and check every action on the other
side of the wire (town.sh stored): favourites, boosts and replies with
their undoing, follows from a profile, votes, reactions. Each test is also
a cell of the town's report (out/client.jsonl). They found two PrivaPub
bugs fixed there (a blocked author's status answered null; sensitive
remote media invented a content warning) and a reply addressed to nobody.

New in the app, all checked by those tests:
- profiles at /account/{id}: header, bio, fields, counts, the account's
  posts as posts, posts and replies, or media, and follow, unfollow,
  cancel a request, mute and block (AccountService); post authors and
  notifications open them in the app;
- search at /search: accounts, posts and hashtags, a handle or an address
  resolved by PrivaPub;
- poll voting on the card, and emoji reactions shown and given with one
  tap; before a persona's first reaction or vote it is told once that
  both are public (PublicNoticeService, the owner's decision);
- follow requests answered from their notification.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
2026-10-05 01:23:18 +02:00

27 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# decePub against the pasture: publishes the app with the Pasture environment (its API is https://privapub.test), serves
# it as https://decepub.test next to the running pasture, then runs the Playwright tests. The town must be seeded first
# (../SocialPub/tools/pasture/town.sh seed village); the tests read its accounts and ask it what each server holds.
# usage: tests/e2e/run.sh [dotnet test arguments, e.g. --filter "Category!=Perf"]
set -euo pipefail
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
repo="$(cd "$here/../.." && pwd)"
pasture="$(cd "$repo/../SocialPub/tools/pasture" && pwd)"
dotnet=${DOTNET:-$(command -v dotnet || echo ~/.dotnet/dotnet)}
curl -fsk -o /dev/null --resolve privapub.test:6443:127.0.0.1 https://privapub.test:6443/build.json \
|| { echo "the pasture is not up: $pasture/run.sh up first" >&2; exit 1; }
[ -s "$pasture/.state/town/sessions.json" ] || { echo "the town has no accounts: $pasture/town.sh seed village first" >&2; exit 1; }
# Playwright 1.61.0 runs Chromium headless shell 1228; it is never downloaded here
browsers=~/.nuget/packages/microsoft.playwright/1.61.0/.playwright/package/browsers.json
if [ -f "$browsers" ]; then
rev=$(python3 -c "import json,sys; print(next(b['revision'] for b in json.load(open(sys.argv[1]))['browsers'] if b['name']=='chromium-headless-shell'))" "$browsers")
[ -f ~/.cache/ms-playwright/chromium_headless_shell-$rev/INSTALLATION_COMPLETE ] \
|| { echo "Chromium headless shell $rev is not in ~/.cache/ms-playwright; install it once with Playwright 1.61.0" >&2; exit 1; }
fi
"$dotnet" publish "$repo/decePubClient.csproj" -c Release -p:WasmApplicationEnvironmentName=Pasture -o "$here/.publish" -v quiet
DECEPUB_SITE="$here/.publish/wwwroot" "$pasture/run.sh" add decepub
"$dotnet" test "$here/decePubClient.E2E.csproj" -c Release "$@"