- Install dependencies:
npm install- Create
.envfrom sample:
cp .env.sample .env- Set valid credentials in
.env:
DBC_USERNAME=your_dbc_username
DBC_PASSWORD=your_dbc_password- Ensure browser + driver are available (
firefox+geckodriverby default).
npm run test:unitnpm run test:coveragenpm run test:integration:apiThis test validates:
- server/user check (
get_user) - balance (
get_balance) - upload text captcha (
type=0) usingimages/normal.jpg - decode response contains text
- report call returns boolean
Test file:
npm run test:integration:seleniumThe test file is:
npm run test:integrationGitLab CI is configured in:
The pipeline runs unit tests on Node.js versions:
- 20
- 22
- 24
Each matrix job runs:
npm install
npm run test:coverageCoverage is visible in the GitLab job output and the coverage/ folder is uploaded as a job artifact.
GitLab also runs the basic API integration test on Node.js 24.
For credentials, the integration job tries these options in order:
- local
.envfile in the workspace DBC_ENV_FILEGitLab variable (File type recommended)DBC_ENVGitLab variable with full.envcontents
This avoids declaring multiple separate username/password variables in GitLab.
For local gitlab-ci-local runs, the easiest option is a local-only variables file:
- Copy .gitlab-ci-local-variables.example.yml to
.gitlab-ci-local-variables.yml - Fill your real credentials there
- Run:
gitlab-ci-local --file ./.gitlab-ci.ymlgitlab-ci-local loads .gitlab-ci-local-variables.yml automatically, and the pipeline will pass DBC_ENV into the integration job without requiring committed .env credentials.
GitHub Actions is configured in:
- .github/workflows/unit-tests.yml
- .github/workflows/unit-tests-node22.yml
- .github/workflows/unit-tests-node24.yml
- .github/workflows/coverage.yml
- .github/workflows/api-integration.yml
- Runs as separate workflows for Node.js 20, 22 and 24
- Each executes:
npm install
npm run test:unit- Uses only native GitHub Actions
- Exposes native workflow badges per Node.js version
- Runs on Node.js 22
- Executes:
npm install
npm run test:coverage- Uses only native GitHub Actions
- Uploads the
coverage/folder as an artifact - Exposes a separate native coverage badge
- Runs the basic API integration test on Node.js 24
- Executes:
npm install
npm run test:integration:api-
Uses GitHub secrets:
DBC_USERNAMEDBC_PASSWORD
-
Optional runtime env in workflow:
MOZ_HEADLESS=1
-
No committed
.envfile is required in GitHub Actions -
If either secret is missing, the workflow skips the integration test without failing the pipeline
-
Exposes a native GitHub Actions workflow badge
| Workflow | Node | Status |
|---|---|---|
| Unit Tests | 20 | |
| Unit Tests | 22 | |
| Unit Tests | 24 | |
| API Integration | 24 | |
| Selenium Integration | 24 | |
| API npm Integration | 24 | |
| Coverage | 22 |