5.7 KiB
5.7 KiB
LinkdingSync Test Usage Guide
Quick Start
Step 1: Load Test Files in Firefox DevTools
- Open Firefox and navigate to your Linkding instance
- Open DevTools (
F12) and go to the Console tab - Copy the entire contents of
tests/orchestrator.js - Paste into the console (Ctrl+Shift+V)
- Press Enter
You should see:
LinkdingSync Test Orchestrator loaded
Commands:
runAllTests() - Run all tests
runAllTestsWithReset() - Run with cleanup first
runModule("name") - Run specific test module
reset() - Clean up test bookmarks
Step 2: Configure Credentials
The tests/utils.js file already contains your credentials from .creds.txt:
const CONFIG = {
serverUrl: 'https://links.blabber1565.com',
workApiKey: '4108e3aff26fb82bf074f5d4dfa4757763520b06',
workUser: 'linkdingsync_tester',
workBundle: 'work',
personalApiKey: '9b80accd3b9b4b91c2a7adc3dcf41621b025329a',
personalUser: 'linkdingsync_tester_2',
personalBundle: 'personal',
cleanupAfterTests: true
};
If you need to modify credentials, edit tests/utils.js directly.
Step 3: Run Tests
Run All Tests
runAllTests()
This will execute all 8 test scenarios and display results in the console.
Run with Reset First
runAllTestsWithReset()
This cleans up any existing test bookmarks before running tests.
Run Specific Module
runModule('isolation') // Tests 1-2: API Key & User Isolation
runModule('conflicts') // Tests 3-4: Conflict Resolution
runModule('deletion') // Tests 5-6: Delete Propagation
runModule('bundles') // Tests 7-8: Bundle Filtering
Reset Test Bookmarks
reset()
Or run runAllTestsWithReset() which includes reset automatically.
Test Scenarios
| Module | Tests | Purpose |
|---|---|---|
| isolation | 1-2 | Verify API key and user isolation |
| conflicts | 3-4 | Conflict resolution behavior |
| deletion | 5-6 | Delete propagation behavior |
| bundles | 7-8 | Bundle tag filtering |
Expected Output
Each test module produces output like:
=== Test 1: Same URL, Different API Keys, Same User ===
Purpose: Verify if API keys provide isolation within same user
Created: ID=test-0585-ab
Created: ID=test-0585-ac
Work bookmark ID: test-0585-ab
Personal bookmark ID: test-0585-ac
[Test 1] ✓ PASS Different bookmark IDs - API keys provide isolation
→ Different API keys create separate bookmarks
=== Test 2: Different Users - Verify Isolation ===
Bookmark created by work user: ID=test-0586-ab
Work user sees bookmark: Test: test-0586-ab
Personal user sees 1 bookmarks
[Test 2] ✓ PASS Proper user isolation exists
→ Can use different API keys for isolation
Interpreting Results
Isolation Tests
- PASS: Different API keys create separate bookmarks
- FAIL: Same bookmark ID means API keys don't provide isolation
Conflict Resolution Tests
- PASS: Server creates separate bookmarks per API key
- WARN: Unexpected behavior detected
Delete Propagation Tests
- PASS: Each bookmark exists independently
- FAIL: Delete propagates (same bookmark)
Bundle Tests
- PASS: Bundles provide logical separation
- WARN: Bundle filtering unclear
Debugging
View All Test Bookmarks
LinkdingSyncTests.Helpers.getAllBookmarks()
Check a Specific Bookmark
LinkdingSyncTests.Helpers.fetchBookmark('bookmark-id')
Parse Bookmark Notes
LinkdingSyncTests.Helpers.parseNotes(bookmark.notes)
Reset Everything
reset()
Next Steps After Phase 0
Once tests complete:
- Review Results: Check which tests pass/fail
- Document Findings: Update
docs/test-results.md - Finalize Design: Create new architecture based on test results
- Redesign Extension: Implement new LinkdingSync based on findings
- Write Unit Tests: Add tests to
tests/directory
Common Commands
// Run all tests
runAllTestsWithReset()
// Run isolation tests only
runModule('isolation')
// Check current bookmarks
LinkdingSyncTests.Helpers.getAllBookmarks()
// Reset before running
reset()
Troubleshooting
Tests Not Running
- Check: Console shows "Orchestrator loaded"
- Solution: Load
orchestrator.jsfirst, then modules
Credentials Not Working
- Check:
CONFIGinutils.jshas correct values - Solution: Verify API keys work in Linkding UI
Tests Creating Duplicate Bookmarks
- Expected: This is the test behavior
- Solution: Run
reset()to clean up
File Structure
LinkdingSync/
├── tests/
│ ├── utils.js # Shared utilities
│ ├── orchestrator.js # Main test runner
│ ├── test-isolation.js # Isolation tests
│ ├── test-conflicts.js # Conflict tests
│ ├── test-deletion.js # Deletion tests
│ └── test-bundles.js # Bundle tests
├── docs/
│ ├── phase0-plan.md # Phase 0 planning
│ ├── test-usage.md # This file
│ └── phase0-test-scenarios.md
├── test-runner.js # Legacy (can be deleted after migration)
└── .creds.txt # Test credentials
Security Notes
- API keys stored in Firefox session (cleared when browser closes)
- Test bookmarks have unique testId prefix
- All test bookmarks are cleaned up automatically
- No sensitive data in test bookmarks
Support
For issues, check:
- Console output for error messages
.creds.txtfor correct credentials- Linkding server logs for API errors