2026-07-18 18:08:07 +03:00
|
|
|
# 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"}
|
2026-07-18 19:03:50 +03:00
|
|
|
|
|
|
|
|
## Notes
|
|
|
|
|
|
|
|
|
|
- On a failed run, Playwright retains a screenshot and trace under
|
|
|
|
|
`test-results/` for debugging (`npx playwright show-trace test-results/.../trace.zip`).
|
|
|
|
|
These are gitignored and not committed, but they persist on disk and may
|
|
|
|
|
contain the username you passed in (the password field is masked in the
|
|
|
|
|
browser, so its value isn't captured). Clear `test-results/` if you want
|
|
|
|
|
to remove them.
|
|
|
|
|
- The post-composer selectors (text-post tab, title/body fields, submit
|
|
|
|
|
button) are marked `UNVERIFIED` in `tests/reddit-post.spec.js` — they've
|
|
|
|
|
only been confirmed as far as this sidecar's original development
|
|
|
|
|
environment could reach live Reddit before being network-blocked. If a
|
|
|
|
|
real run on your own network fails after a successful login, start by
|
|
|
|
|
checking those selectors with:
|
|
|
|
|
`npx playwright codegen https://www.reddit.com/r/test/submit`
|