Closed esp0314 closed 1 month ago
Thanks @esp0314 for reporting the bug, Will verify and fix it asap.
@esp0314 looks like await
keyword is missing when calling imported function.
use this code - await baseUrl();
also await
keyword missing for tc.runRequest("reqId");
that works, thanks!
What about the CLI error? Same request and same settings
CLI Issue could be file path issue.
try below (added / at the start)
const { baseUrl } = "/api-tests/test-import.js
Hi @rangav,
I tried with your suggestion but It is not working
Using relative path, only UI works not on CLI
Using full absolute path, CLI and UI is working. But i will be running the api collection in the pipeline(CICD) so i cant use the full absulute path
Are you using git-sync feature right?
right click on the test-imports.js
file and select copy relative path and use this path
Yes i am using git sync feature. I did and got the same result(right click -> copy relative path)
Only UI is working
I am using this command line tc --ws api-tests/connectivity test-poc
and this my api tests structure, this might help analyze the issue
Issue is with --ws
argument
remove the argument and try use the workspace relative path
setting - Docs
That will work @rangav.
But what if i have multiple collections separated in different folders. This is the reason why i am using --ws. I created a new folder on my POC project added a new api request, run the api and it is not working.
Using --ws
Please note that --ws argument is very useful for us since we have multiple collections separated in folders and we are running our api tests in cicd pipeline
Btw, i am open for a call to further discuss this
Hi @rangav, any update regarding the --ws argument? Thank you
Will verify and get back to you
looks like there is a path issue with CLI then using the --ws
argument for importing JS files.
Will try to fix it asap. Alternatively, you have to use the workspace relative path
vs code setting
We have published a new version of CLI to fix this issue. Please update CLI to v1.16.2
.
Right click on the test-imports.js
file and select Copy Relative Path
Please test and let me know your feedback.
@rangav, thanks for the fixed. It is working now using v1.16.2
Thanks for the confirmation
I am in the process of migrating custom scripts using Import JS Files as the feature is deprecated.
I have a pre-run script that will execute an api(tc.runRequest) that returns a token and setting up the baseUrl(tc.SetVar) in local environment. And these values will be used as part of authorization headers and baseUrl in our main endpoints.
When executed, it successfully saved the values in the local environment, but it was not recognized those values on the initial run, causing the main api to fail.
Successful on the 2nd run
Another issue i encountered is “File Path not Found” when the request is executed via CLI. Please note that same setup was used here in the command line.
I have filed a similar issue before and I encountered again using this version: Thunderclient v2.24.12 CLI v1.16.0 https://github.com/thunderclient/thunder-client-support/issues/1496