28 lines
1023 B
Markdown
28 lines
1023 B
Markdown
# Twitter/X Post Sidecar
|
|||
|
|
|
||
|
|
A Playwright acceptance test that logs into Twitter/X with supplied credentials and creates a post.
|
||
|
|
|
||
|
|
## One-time setup
|
||
|
|
|
||
|
|
cd sidecars/twitter-post
|
||
|
|
npm install
|
||
|
|
npx playwright install chromium
|
||
|
|
|
||
|
|
## Usage
|
||
|
|
|
||
|
|
./run.sh --username=YOUR_USERNAME --password=YOUR_PASSWORD \
|
||
|
|
--tweet="Your tweet text here" [--headed]
|
||
|
|
|
||
|
|
Prints a single JSON line to stdout and exits 0 on success, exits 1 on failure:
|
||
|
|
|
||
|
|
{"success": true, "url": "https://twitter.com/username/status/..."}
|
||
|
|
{"success": false, "error": "Login failed: Invalid credentials"}
|
||
|
|
|
||
|
|
## Notes
|
||
|
|
|
||
|
|
- On a failed run, Playwright retains a screenshot and trace under `test-results/` for debugging.
|
||
|
|
These are gitignored and not committed, but they persist on disk.
|
||
|
|
- Twitter's UI changes frequently. If posting fails, check the selectors in `tests/twitter-post.spec.js`
|
||
|
|
and update them using: `npx playwright codegen https://twitter.com/i/flow/login`
|
||
|
|
- Twitter may show CAPTCHAs or 2FA prompts which will cause the automation to fail.
|