Testing Resources ๐งช
Overview
CardScan.ai maintains a public testing repository with sample insurance cards and test videos for validating your integration. These resources help ensure consistent testing across development, staging, and CI/CD environments.
Quick Start
Clone the repository:
git clone https://github.com/CardScan-ai/testing-resources.git
Use sample cards from
insurance-card-images/
for testingUse test videos from
insurance-test-videos/
for automated testing
Browser Testing with Fake Webcam
Chrome Launch Flags
Test with consistent video input instead of a live webcam:
# macOS
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--use-fake-device-for-media-stream \
--use-file-for-fake-video-capture=./path/to/test-video.y4m
# Windows
chrome.exe \
--use-fake-device-for-media-stream \
--use-file-for-fake-video-capture=./path/to/test-video.y4m
# Linux
google-chrome \
--use-fake-device-for-media-stream \
--use-file-for-fake-video-capture=./path/to/test-video.y4m
Cypress Integration
Configure Cypress to use test videos as webcam input:
1. Update cypress/plugins/index.js
:
module.exports = (on, config) => {
on('before:browser:launch', (browser = {}, launchOptions) => {
if (browser.family === 'chromium' && browser.name !== 'electron') {
if (process.env.CYPRESS_WEBCAM_VIDEO_PATH) {
console.log("Setting Video to be: ", process.env.CYPRESS_WEBCAM_VIDEO_PATH)
launchOptions.args.push(
`--use-file-for-fake-video-capture=${process.env.CYPRESS_WEBCAM_VIDEO_PATH}`
)
}
}
return launchOptions
})
}
2. Run tests with video input:
CYPRESS_WEBCAM_VIDEO_PATH=./testing-resources/insurance-test-videos/1080p.y4m cypress run
3. Example test:
describe('Card Scanning', () => {
it('should scan test card successfully', () => {
cy.visit('/scan')
// Your CardScan implementation will receive video frames
// from the test video instead of live webcam
cy.get('[data-testid="scan-button"]').click()
// Wait for scan completion
cy.get('[data-testid="scan-complete"]', { timeout: 10000 })
.should('be.visible')
})
})
Testing Best Practices
1. Test Multiple Scenarios
Different card types and payers
Various video resolutions
Front and back card scanning
Error conditions and edge cases
2. Continuous Integration
Example GitHub Actions workflow:
name: E2E Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup test resources
run: |
git clone https://github.com/CardScan-ai/testing-resources.git
cd testing-resources/insurance-test-videos
unzip videos.zip
- name: Run tests
env:
CYPRESS_WEBCAM_VIDEO_PATH: ./testing-resources/insurance-test-videos/1080p.y4m
run: |
npm install
npm run test:e2e
Available Resources
The testing repository includes:
Sample card images - High-quality insurance card images (front/back)
Test videos - Pre-recorded scanning videos in multiple resolutions
Additional resources - Check the repository for the latest test materials
The repository contents may change over time. Always check the latest README for current resources.
Related Documentation
Support
Need help with testing?
Email: [email protected]
Slack: Available for Enterprise customers
Last updated
Was this helpful?