Comprehensive test suite for 10XKit Browser Extension WebSocket integration.
This test suite validates:
- WebSocket connection establishment
- Heartbeat/ping-pong functionality
- LinkedIn actions (profile views, connections, messages)
- Instagram actions (likes, comments, follows, DMs)
- Twitter/X actions (tweets, likes, retweets, DMs)
- Google search actions (web, image, news, maps)
Windows:
# Download from https://nodejs.org/
# Or use Chocolatey:
choco install nodejsVerify installation:
node --version # Should be v14.0.0 or higher
npm --versionThe tests require the Canvas WebSocket server to be running:
cd C:\Users\Anit\Downloads\10x-Outreach-Skill\canvas
npm install
npm startServer should be available at:
- HTTP:
http://localhost:3000 - WebSocket:
ws://localhost:3000/ws
Load the extension in Chrome:
- Open
chrome://extensions - Enable "Developer mode"
- Click "Load unpacked"
- Select:
C:\Users\Anit\Downloads\10x-Outreach-Skill\.claude\skills\browser-extension
Verify the extension badge shows:
- ✓ (green) = Connected
- ✗ (red) = Not connected
For LinkedIn, Instagram, Twitter tests:
- Log into each platform in Chrome
- Keep at least one tab open for each platform
- Tests will use existing sessions
Install test dependencies:
cd C:\Users\Anit\Downloads\10x-Outreach-Skill\.claude\skills\browser-extension\tests
npm installThis installs:
ws- WebSocket client library
Windows (Batch):
run-all-tests.batCross-platform (Node.js):
npm test
# OR
node run-all-tests.jsThis runs all tests sequentially with delays between each test.
Connection Test:
npm run test:connection
# OR
node test-connection.jsLinkedIn Tests:
npm run test:linkedin
# OR
node test-linkedin.jsInstagram Tests:
npm run test:instagram
# OR
node test-instagram.jsTwitter Tests:
npm run test:twitter
# OR
node test-twitter.jsGoogle Tests:
npm run test:google
# OR
node test-google.jsTests WebSocket connection basics:
- ✓ WebSocket connection establishment
- ✓ Extension identification message
- ✓ Ping/pong heartbeat
- ✓ Connection status check
- ✓ Error handling (invalid messages)
- ✓ Graceful connection close
Duration: ~5 seconds
Usage:
node test-connection.jsTests LinkedIn automation actions:
- ✓ View profile (scrape data)
- ✓ Send connection request (with note)
- ✓ Send message
- ✓ Like post
- ✓ Comment on post
- ✓ Send InMail
Duration: ~15-20 seconds
Requirements:
- Logged into LinkedIn
- Valid test profile URLs
Usage:
node test-linkedin.jsConfiguration:
Edit TEST_DATA object in the file:
const TEST_DATA = {
profileUrl: 'https://www.linkedin.com/in/your-test-profile/',
connectionNote: 'Your connection message',
// ... more config
};Tests Instagram automation actions:
- ✓ Like post
- ✓ Comment on post
- ✓ Follow user
- ✓ Send DM
- ✓ View story
- ✓ Rate limit enforcement
Duration: ~20-25 seconds
Requirements:
- Logged into Instagram
- Valid test account/posts
Usage:
node test-instagram.jsTests Twitter/X automation actions:
- ✓ Post tweet
- ✓ Like tweet
- ✓ Retweet
- ✓ Reply to tweet
- ✓ Follow user
- ✓ Send DM
- ✓ View profile
- ✓ Search tweets
Duration: ~25-30 seconds
Requirements:
- Logged into X/Twitter
- Valid test accounts
Usage:
node test-twitter.jsTests Google search actions:
- ✓ Navigate to Google
- ✓ Web search
- ✓ Image search
- ✓ News search
- ✓ Maps search
- ✓ Extract snippets
- ✓ Auto-suggest
- ✓ Click search result
Duration: ~20 seconds
Requirements:
- None (no login needed)
Usage:
node test-google.js============================================================
Browser Extension Test Suite
============================================================
[2026-01-22T17:24:35.123Z] Starting WebSocket Connection Tests
[2026-01-22T17:24:35.456Z] ✓ PASS: WebSocket connection established
[2026-01-22T17:24:36.123Z] ✓ PASS: Sent identification message
[2026-01-22T17:24:37.456Z] ✓ PASS: Ping/Pong heartbeat working
...
============================================================
Test Summary: 7 passed, 0 failed
============================================================
[RESULT] All tests PASSED
[2026-01-22T17:24:35.123Z] ✗ FAIL: WebSocket connection - Connection timeout
Error details: Error: Connection timeout
at Timeout._onTimeout (test-connection.js:45:16)
...
============================================================
Test Summary: 5 passed, 2 failed
============================================================
[RESULT] Some tests FAILED
0- All tests passed1- One or more tests failed
Use in CI/CD:
node test-connection.js
if %ERRORLEVEL% NEQ 0 (
echo Tests failed
exit /b 1
)Problem:
✗ FAIL: WebSocket connection - Connection timeout
Solutions:
-
Check if Canvas server is running:
curl http://localhost:3000/api/status
-
Check firewall settings (Windows):
netsh advfirewall firewall show rule name=all | findstr 3000
-
Try restarting server:
cd canvas npm start
Problem:
✗ FAIL: Commands not executing
Solutions:
- Check extension badge (should be green ✓)
- Reload extension:
chrome://extensions→ Reload button - Check browser console (F12) for errors
- Verify WebSocket URL in
background.js:ws://localhost:3000/ws
Problem:
✗ FAIL: View LinkedIn profile - Element not found
Solutions:
- Ensure logged into platform
- Update selectors if LinkedIn/Instagram UI changed
- Check rate limits (may be throttling)
- Try manually: open platform in browser first
Problem:
✗ FAIL: Send connection - Rate limit exceeded
Solutions:
- Wait 24 hours (rate limits reset daily)
- Clear extension storage:
// In browser console chrome.storage.local.clear()
- Use different test account
Problem:
Error: Cannot find module 'ws'
Solution:
cd tests
npm installDefault timeout: 30 seconds
To change timeout, edit in test file:
const TIMEOUT = 30000; // 30 seconds → change to 60000 for 60sEdit test data in each file:
const TEST_DATA = {
profileUrl: 'https://www.linkedin.com/in/your-profile/',
// ... customize for your tests
};To test against different server:
const WS_URL = 'ws://your-server:3000/ws';Never run tests on production accounts!
- Create dedicated test accounts
- Use disposable email addresses
- Set privacy to private
LinkedIn/Instagram/Twitter have daily limits:
- LinkedIn connections: 15/day
- Instagram likes: 100/day
- Twitter tweets: 50/day
Run tests sparingly - once per feature change, not continuously.
After testing:
// Clear test data
chrome.storage.local.clear()
// Unfollow test accounts
// Delete test posts
// Remove test connectionsCheck platform activity logs:
- LinkedIn: Settings → Account Activity
- Instagram: Settings → Security → Login Activity
- Twitter: Settings → Account → Account Access History
Always run tests sequentially (never parallel) to:
- Avoid rate limiting
- Prevent race conditions
- Get accurate results
Use built-in delays:
await new Promise(resolve => setTimeout(resolve, 3000)); // 3s delayname: Browser Extension Tests
on: [push, pull_request]
jobs:
test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
working-directory: ./.claude/skills/browser-extension/tests
run: npm install
- name: Start Canvas Server
working-directory: ./canvas
run: |
npm install
npm start &
- name: Wait for server
run: timeout /t 5
- name: Run connection tests
working-directory: ./.claude/skills/browser-extension/tests
run: npm run test:connection
# Note: Platform tests require authentication
# Skip in CI or use test accounts with secrets- Documentation: ../IMPLEMENTATION-GUIDE.md
- WebSocket API: ../../../WEBSOCKET-API.md
- Issues: Report in GitHub repository
MIT License - see project root for details
Last Updated: 2026-01-22 Version: 1.0.0 Platform: Windows 10 / Node.js 14+