You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Problem]
Maintaining custom JS actions in Testim is not convenient for us for several reasons:
changes can't be tracked
anyone can change it
code doesn't go through the standard development cycle
[Suggestion]
have a private repo of custom steps, that we can run and manage - sort of this repo, but private, separately for each account.
To do so we suggest creating a custom action that reads JS code from a private git repo and executes it.
Thoughts?
The text was updated successfully, but these errors were encountered:
var my_message = (typeof customStepParam !== 'undefined') ? customStepParam : "Default message";
function myFunction(message) {
console.log("myFunction('" + message +"') called");
return "myFunction received input: " + message;
}
let response = myFunction(my_message);
console.log("myFunction's response was '" + response + "'");
I then created a custom step in Testim with the following body and JS parameter "customStepParam":
let src = "http://localhost:8081/scripts/myscript.js";
let myScript = document.createElement("script");
myScript.setAttribute("src", src);
document.head.appendChild(myScript);
var message = (typeof customStepParam !== 'undefined') ? customStepParam : "Default message";
let response = myFunction(message);
console.log("myFunction's response was '" + response + "'");
I ran the test and my remote JS file function was called. Once when loaded as the script itself calls the function and once by Testim in the custom step with the test user defined parameter (customStepParam) as seen in the webpage's console log:
myFunction('Default message') called
VM98 myscript.js:11 myFunction's response was 'myFunction received input: Default message'
VM98 myscript.js:6 myFunction('YO YO YO!') called
VM103:15 myFunction's response was 'myFunction received input: YO YO YO!
Note:
You will want to wrap the step's logic in a function and then call the function with the test parameters in the custom step itself and not the remote JS.
Also, if you want to make it so nobody messes with the custom step you can always obfuscate it with a site like https://obfuscator.io/
Dear Testim custom actions team.
[Problem]
Maintaining custom JS actions in Testim is not convenient for us for several reasons:
[Suggestion]
have a private repo of custom steps, that we can run and manage - sort of this repo, but private, separately for each account.
To do so we suggest creating a custom action that reads JS code from a private git repo and executes it.
Thoughts?
The text was updated successfully, but these errors were encountered: