Cypress test suite for the ChatBet API with Mochawesome reports.
npm install
npm test # Run all tests
npm run report # Open HTML report in browser
# Run specific suites
npm run test:simple-bet
npm run test:combo-bet
npm run test:errors3 Test Suites:
TS01-simple-bet.cy.js- Place single bet flow (7 tests)TS02-combo-bet.cy.js- Multiple selections combo (9 tests)TS03-error-validation.cy.js- Error handling (12 tests)
Config Files:
cypress/fixtures/simple-bet-config.jsoncypress/fixtures/combo-bet-config.jsoncypress/fixtures/error-tests-config.json
All 28 tests passing ✅
TS01: 7/7 passing (3s) - Stake: $0.50
TS02: 9/9 passing (5s) - Stake: $0.30
TS03: 12/12 passing (5s) - No bets placed
Total: 15s | $0.80 per test run
Automatic HTML report generated after each run:
- Location:
cypress/reports/index.html - View:
npm run report - Includes: Screenshots, execution times, request/response logs
- Screenshots captured on test failures
Screenshots saved in cypress/screenshots/
Edit cypress.config.js to change:
- API base URL
- Test credentials (userId, userKey)
- Report settings
Or set in test config files:
{
"sport_id": 1,
"tournament_id": 101,
"stake": 100.00
}cypress/
├── e2e/
│ ├── TS01-simple-bet.cy.js
│ ├── TS02-combo-bet.cy.js
│ └── TS03-error-validation.cy.js
├── fixtures/
│ ├── simple-bet-config.json
│ ├── combo-bet-config.json
│ └── error-tests-config.json
├── support/
│ ├── commands.js # Custom Cypress commands
│ └── e2e.js
└── reports/ # Mochawesome HTML/JSON reports
All in cypress/support/commands.js:
cy.generateToken()- Get auth tokency.getUserBalance(token)- Get balancecy.getFixtures(tournamentId)- Get fixturescy.getOdds({...})- Get odds for fixturecy.placeBet({...})- Place single/combo bet
During testing, found 5 validation issues where API accepts invalid data:
- Invalid fixture IDs accepted
- Invalid market types accepted
- Bets exceeding balance processed
- Non-existent fixtures in combos accepted
- Missing fixtures return 200
See API_VALIDATION_ISSUES.md for details.
- Tests use cypress-plugin-api for better API testing
- All test names follow TS/TC convention (see NAMING_CONVENTION.md)
- Tests are parameterized - easy to modify test data
- HTML reports auto-generated with embedded screenshots
- Screenshots captured automatically on test failures
Balance Warning:
- Test account balance depletes with each run ($0.80 per run)
- TS01 places $0.50 bet, TS02 places $0.30 bet
- If tests fail with 400 errors, balance is insufficient
- Adjust stakes in config files if needed
TEST_PLAN.md- Test cases and coverageNAMING_CONVENTION.md- TS/TC naming explainedAPI_VALIDATION_ISSUES.md- Known API bugsDESIGN_SOLUTION.md- Real-time data architecture