Skip to content

Commit ca96cb4

Browse files
authored
Merge pull request LambdaTest#1010 from Aman1905/stage
more updates based on the feedback
2 parents e668a7a + 1198e81 commit ca96cb4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/kane-ai-javascript-execution.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,22 @@ The provided code snippet simulates typing into text fields programmatically by
9696
### Step 4: Execute the Test
9797
Once your code is ready, simply press Enter. KaneAI will run your custom JavaScript snippet in the current testing environment.
9898

99+
#### Handling Return Values and Variable Usage
100+
If your JavaScript snippet contains return values, KaneAI will automatically save these values in a variable that can be used later in the test. The output from your JavaScript code will be captured and assigned to a variable. This variable will be available for use throughout your test execution.
101+
102+
For example, in the code snippet provided:
103+
104+
```javascript
105+
return {"First name": "Aman", "Last name": "Chopra", "email": "[email protected]"};
106+
```
107+
108+
The returned object with the keys `First name`, `Last name`, and `email` will be stored in a variable. You can reference this variable later in your test to validate or reuse the values.
109+
110+
> Variables created from return values can be used in subsequent test steps. To use the variable, simply refer to the specific property (e.g., First name) in your test steps for verification or further actions.
111+
112+
#### JavaScript Snippets in Generated Code
113+
When your test is executed, the JavaScript code snippet you provided will be added directly into the generated test code. This ensures that any custom interactions performed with JavaScript are part of the overall test logic. The inclusion of JavaScript in the generated code allows for easy tracking, debugging, and modification if needed.
114+
99115
<video class="right-side" width="100%" controls id="vid">
100116
<source src= {require('../assets/images/kane-ai/kane-ai-js-execution.mp4').default} type="video/mp4" />
101117
</video>

0 commit comments

Comments
 (0)