Implements run.sh with argument parsing (--username, --password, --subreddit, --title, --body, optional --headed), environment variable mapping to Task 2's env contract, Playwright invocation with proper exit-code capture via set +e, and result file output to stdout. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Reddit Post Sidecar
A Playwright acceptance test that logs into Reddit with supplied credentials and creates a text post in a given subreddit.
One-time setup
cd sidecars/reddit-post
npm install
npx playwright install chromium
Usage
./run.sh --username=YOUR_USERNAME --password=YOUR_PASSWORD \
--subreddit=test --title="Hello" --body="Post body text" [--headed]
Prints a single JSON line to stdout and exits 0 on success, exits 1 on failure:
{"success": true, "url": "https://www.reddit.com/r/test/comments/.../"}
{"success": false, "error": "Login did not complete — possible CAPTCHA or 2FA prompt"}