Registration & Sync
Register your external library in ReAPI and sync components.
Adding a Library
- Go to Project Settings → External Libraries
- Click Add Library
- Fill in the required fields
Required Fields
| Field | Description | Example |
|---|---|---|
| Title | Display name in UI | ”Payment Test Library” |
| Library URL | URL to UMD bundle | https://unpkg.com/@org/lib@1.0.0/dist/build.umd.js |
| Library Name | Global variable name | PaymentTestLib |
Optional Fields
| Field | Description | Example |
|---|---|---|
| Description | What this library provides | ”Payment validation and test utilities” |
| Type URL | URL to TypeScript definitions | https://unpkg.com/@org/lib@1.0.0/dist/build.d.ts |
Finding the Library Name
The library name is the global variable your bundle exposes:
// In your bundle (build.umd.js)
var PaymentTestLib = (function() {
// ...
})();Check your build config:
// rollup.config.js
export default {
output: {
name: 'PaymentTestLib', // This is your library name
format: 'umd',
},
};Sync Process
After filling in the fields, click Sync from URL.
What Happens
- Fetch: ReAPI downloads your bundle from the URL
- Execute: Bundle runs in sandbox, exposing the global
- Inspect: ReAPI reads exported arrays:
$$AssertionFunctions$$ValueFunctions$$ApiHooks$$Utilities$$TestCases
- Index: Component metadata saved to database
Sync Output
Synced components:
✓ 5 custom assertions
✓ 3 value generators
✓ 2 API hooks
✓ 4 utilities
✓ 8 test casesEnabling the Library
After sync, toggle Enabled to make components available:
- Disabled: Components not available anywhere
- Enabled: Components available in test engine and UI
Viewing Components
After sync, you can browse discovered components:
Assertions Tab
- View all custom assertions
- See ID, name, description
- Check enabled/deprecated status
Generators Tab
- View all value generators
- See parameter schemas
Hooks Tab
- View before/after hooks
- See hook type
Test Cases Tab
- View all external test cases
- See tags, priority, timeout
- Run individual tests
Re-syncing
When you deploy a new version:
- Update the Library URL (if version changed)
- Click Sync from URL
- Review component changes
What Changes on Re-sync
- New components are added
- Removed components are marked deprecated
- Updated metadata is refreshed
- Existing component IDs preserved
Multiple Libraries
You can register multiple external libraries:
Library 1: AuthTestLib
- Auth assertions
- Auth generators
Library 2: PaymentTestLib
- Payment assertions
- Payment test cases
Library 3: CommonUtils
- Shared utilitiesLoading Order
Libraries load in the order they appear in the list. Use drag-and-drop to reorder if one library depends on another.
Troubleshooting Sync
”Failed to fetch library”
- Verify URL is accessible (try in browser)
- Check CORS headers are set
- Ensure HTTPS for production
”Library name not found”
- Verify the global variable name matches bundle
- Check bundle format is IIFE/UMD, not ESM
”No components found”
- Verify export names:
$$AssertionFunctions,$$ValueFunctions, etc. - Check exports are arrays
- Ensure components have required fields (id, name, function)
“Component X not showing”
- Check
enabled: trueon the component - Check
deprecated: falsefor new components - Re-sync after making changes
Best Practices
Use Versioned URLs
# ✅ Good: Specific version
https://unpkg.com/@org/lib@1.0.0/dist/build.umd.js
# ⚠️ Risky: Latest version (for dev only)
https://unpkg.com/@org/lib@latest/dist/build.umd.jsProvide Type Definitions
Adding Type URL enables:
- Autocomplete in web editor
- Better error messages
- Parameter documentation
Document Component IDs
Keep a reference of component IDs:
## Component IDs
### Assertions
- `is-valid-email` - Email format validation
- `is-valid-iban` - IBAN validation
### Test Cases
- `auth-login` - Login flow test
- `auth-logout` - Logout flow test