Customizing and Debugging Code
BlinqIO generates standard JavaScript test code that you own completely. You can customize it to add business logic, install third-party packages, debug with breakpoints, and upload your changes back to the platform.
Where the code lives
Generated test automation code is in the features/step_definitions/ folder. Each .mjs file contains the step definitions for a feature. You can modify these files to include any custom JavaScript logic you need.
Project structure reference
| Path | Purpose |
|---|---|
environments/ | JSON files for each environment (URLs, variables) |
features/ | .mjs step definitions and Gherkin feature files |
node_modules/ | Node.js dependencies |
logs/ | Logs from previous test runs |
reports/ | Metadata and screenshots for test reports |
runs/ | Metadata for previous test runs |
ai_config.json | Project-level AI settings (popup handlers, network idle) |
package.json | Node.js dependency manifest |
Adding dependencies
BlinqIO projects use npm for dependency management. Install any package you need:
bash
npm install axiosWARNING
When you upload modified code back to BlinqIO, include package.json and package-lock.json if you changed dependencies.
Uploading modified code
After testing your changes locally, push them back to BlinqIO:
- Open the BlinqIO Editor.
- Go to File > Project Information to open the Project Manager.
- Find your project and click the upload button.
- Select the modified files and click Upload.
INFO
On Windows, the Editor hides the top menu bar by default. Press the Alt key to show it.
Debugging in VS Code
Step through your test code with breakpoints using the VS Code debugger.
Prerequisites
- An implemented scenario (via GenerateAll, GenerateStep, Recorder, or API App)
- VS Code installed on your machine
Steps
- Go to the AI Tests page and locate the scenario you want to debug.
- Click the Execute/Run button and select Run via CI/CD.
- Copy the generated command to your clipboard.
- On the Projects page, click the three-dot menu and select Open in VS Code. This syncs the project locally and opens it.
- Open the
.mjsfile underfeatures/step_definitionsand add a breakpoint on the line you want to inspect. - Open the VS Code terminal (View > Terminal or Ctrl+`).
- Switch to the JavaScript Debug Terminal by selecting Create JavaScript Debug Terminal from the terminal dropdown.
- Paste the command you copied earlier and press Enter. The test runs and pauses at your breakpoints.
For more on VS Code debugging, see the VS Code Debugging Documentation.
Test hooks
CucumberJS provides hooks that run custom code at specific points during test execution. Use them for setup, teardown, logging, or resource management.
| Hook | When it runs | Scope |
|---|---|---|
Before | Before each scenario | Scenario-level |
After | After each scenario | Scenario-level |
BeforeAll | Once before all scenarios | Suite-level |
AfterAll | Once after all scenarios | Suite-level |
Place hooks in any .mjs file inside the step-definitions folder.
Scenario-level hooks
js
Before(async function () {
console.log('Test is starting');
});
After(async function () {
console.log('Test has run successfully');
});Suite-level hooks
js
BeforeAll(async function () {
console.log('Starting the test suite');
});
AfterAll(async function () {
console.log('Finished running all scenarios');
});After adding hooks, upload the modified files back to BlinqIO or push them via Git to apply the changes.
