- Replace token-based auth with HTTP Basic Authentication per Binect API v1 spec - Improve PDF detection: check current tab first, then background service, fallback to recent downloads - Add password visibility toggle in login form - Add extensive debug logging throughout for troubleshooting - Update manifest with alarms, activeTab permissions and <all_urls> host permission - Add documentation files and development helper scripts - Add Binect API specs for reference Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
6.5 KiB
Quick Test Guide - BinectChrome
1. Setup (2 minutes)
# Rebuild extension
npm run build
# Load in Chrome
# 1. Open chrome://extensions/
# 2. Enable "Developer mode"
# 3. Click "Reload" on BinectChrome (or "Load unpacked" if first time, select dist/)
# 4. Accept new permissions when prompted
2. Open Debug Consoles
Service Worker:
chrome://extensions/→ Click "service worker" under BinectChrome- Keep this window open
Popup (optional):
- Click extension icon → Right-click → "Inspect"
3. Test PDF Viewer Detection (RECOMMENDED - Most Reliable)
This is the easiest way to test the API integration!
-
Open a test PDF in Chrome:
https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdfJust paste the URL in the address bar and press Enter
-
Click the extension icon
- Should detect the PDF immediately
- Shows filename, domain, "Send PDF to Binect" button
-
Sign in and send:
- Enter your Binect credentials
- Click "Send PDF to Binect"
- Watch for "Uploading..." → "Success!"
Expected Popup Logs:
[Popup] Loading last PDF...
[Popup] Found PDF in current tab: dummy.pdf
✅ This method always works - no service worker timing issues!
4. Test Download Detection (May Need Fallback)
Method 1: Right-click → Save
- Right-click this link: https://www.africau.edu/images/default/sample.pdf
- Select "Save link as..."
- Save to Downloads
- Watch service worker console for logs
Method 2: Direct download
- Paste URL: https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611_sample_explain.pdf
- Chrome starts download
- Watch service worker console
Expected Service Worker Logs (if working):
[PDF Detector] Download changed: {...}
[PDF Detector] Download complete, searching for item: X
[PDF Detector] PDF detected!
[Service Worker] PDF DETECTED CALLBACK: sample.pdf
[Service Worker] Badge updated, PDF stored in memory
If badge shows "1": Download detection worked! ✅
If no badge: Fallback will still work! Continue...
- Click extension icon
- Even if service worker missed it, popup checks recent downloads
- PDF should appear
Expected Popup Logs (fallback):
[Popup] Background has no PDF, checking recent downloads as fallback...
[Popup] Checked recent downloads: X items
[Popup] Found recent PDF: sample.pdf
5. Test Binect API Integration
Prerequisites:
- Have Binect credentials ready
- PDF is detected (from viewer OR download)
Steps:
- Click extension icon
- If not signed in:
- Enter username and password
- Click "Sign In"
- Should show main view
- PDF details should be visible
- Click "Send PDF to Binect"
- Wait for upload
Expected Results:
Status: Uploading...
→ Success! Document ID: [id]
Check Tracking:
- Click "?" button in popup
- Opens tracking page
- Should show the transfer with success status
6. Test Error Handling
Invalid Credentials:
- Sign out (if signed in)
- Enter wrong username/password
- Click "Sign In"
- Should show error: "Invalid credentials"
Network Error:
- Disconnect from internet
- Try to authenticate or send PDF
- Should show network error
Quick Debug Checklist
If PDF viewer detection doesn't work:
- Is the URL actually a PDF? (ends with .pdf)
- Check popup console for error logs
- Try refreshing the PDF tab
If download detection doesn't work:
- Check service worker console for
[PDF Detector]logs - Look for "Listener registered successfully"
- Try downloading again while service worker console is open
- Open popup - fallback should still find it
If API upload fails:
- Check credentials are correct
- Verify PDF URL is accessible (try opening in new tab)
- Check popup console for detailed error
- Look at Network tab in popup DevTools for API calls
Expected Console Output Summary
Service Worker (when working):
[Service Worker] ===== BinectChrome service worker loaded =====
[Service Worker] Initializing PDF detection...
[PDF Detector] Starting PDF detection, registering download listener
[PDF Detector] Listener registered successfully
# On download:
[PDF Detector] Download changed: {id: X, ...}
[PDF Detector] PDF detected!
[Service Worker] PDF DETECTED CALLBACK: filename.pdf
[Service Worker] Badge updated, PDF stored in memory
Popup (viewer detection):
[Popup] Loading last PDF...
[Popup] Found PDF in current tab: document.pdf
Popup (fallback):
[Popup] Loading last PDF...
[Popup] No PDF in current tab, checking background script...
[Service Worker] Returning last PDF: none
[Popup] Background has no PDF, checking recent downloads as fallback...
[Popup] Found recent PDF: document.pdf
Common Questions
Q: Badge doesn't show but popup finds the PDF? A: Normal! Service worker may have been asleep. Fallback handled it.
Q: PDF disappears after a few minutes? A: Service worker memory is cleared when it sleeps. Fallback will re-fetch it.
Q: Which detection method should I use? A: PDF viewer detection is more reliable. Just open PDFs in Chrome instead of downloading.
Q: Can I test without Binect credentials? A: You can test PDF detection, but not the upload. You'll see authentication errors when trying to send.
Test URLs
Small PDFs (quick tests):
- https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf (1 page)
- https://www.africau.edu/images/default/sample.pdf (1 page)
Medium PDFs:
- https://www.adobe.com/support/products/enterprise/knowledgecenter/media/c4611_sample_explain.pdf (multi-page)
Next Steps
- Test viewer detection - Most reliable
- Test download detection - May need fallback
- Test API integration - Requires credentials
- Check tracking page - Verify data is recorded
Getting Help
If something doesn't work:
- Check the detailed guides:
DEBUG_DOWNLOAD_DETECTION.md- Download debuggingTESTING_PDF_VIEWER.md- Viewer testingDOWNLOAD_DETECTION_FIXES.md- Technical details
- Export console logs (right-click → Save as)
- Note your Chrome version:
chrome://version/ - Email: bernd.worsch@binect.de
Success Criteria
✅ PDF viewer detection works consistently ✅ Download detection works OR fallback finds PDFs ✅ API authentication succeeds ✅ PDF upload succeeds ✅ Tracking records the transfer ✅ Badge updates (when service worker is awake)
You're ready to use BinectChrome!