Open Code in Online Editor
The View the Code feature on the Features page allows you to directly view and edit the full .mjs
file that contains the implementation of the selected step. It provides complete visibility into the underlying code for each step and enables quick inline edits, directly from the project interface.
Beta Feature
This feature is currently in beta and is actively being improved. Some functionality may change over time.
View the Code for a Step
Follow these steps to access the generated code for a step through the online editor from the Features page:
Navigate to the Features page and open a scenario that contains recorded steps.
Select a specific step within the scenario that you want to inspect.
Click View the Code to open the
.mjs
file that contains the implementation of the selected step.The file opens in an online code editor and scrolls directly to the relevant step.
You can navigate to other steps in the scenario to view their code in the editor as well.
NOTE
When a scenario doesn’t have any steps, the View the Code button is disabled. Hover over it to see the tooltip message: “No steps available to show code.”
Edit the Code in Online Editor
You can also edit the code directly in the online editor.
After opening the code in the online editor, make your changes directly in the editor window.
Once your changes are ready, you can choose from the following actions:
- Test Changes: Run the updated step to verify the behavior.
- Discard: Revert your changes and restore the original code.
- Review Changes: View a side-by-side comparison of your edits.
Note
If you wish to open the code locally in Visual Studio Code (VS Code), click the View in VSCode button inside the online editor. This will open the .mjs
file in your local VS Code editor for further inspection and editing.
Handle Steps Without Generated Code
Sometimes, a step may not have any code generated, typically when you manually add the step in Gherkin format without recording or prior implementation.
When you open such a step in the online editor, the AI Test Engineer provides three options to help you complete the step implementation:
Write Custom Code
The editor will auto-generate the step's code stub (syntax scaffold). You can manually add your own custom JavaScript logic for the step or use the prompt feature.
Once code generated the editor provides the following actions:
- Test Changes – Run the updated step before saving.
- Save Changes – Apply and save the final code.
- Discard – Revert to the previous version.
Generate code using AI
Describe the expected behavior in plain English. The AI will generate the appropriate automation code for the step.
Note
Learn more about Generate code for gherkin steps using AI.
Record the Step
Launch the recorder to capture the desired action and automatically generate code for the step.
Note
Learn more about the AI Recorder.