Defining a global variable in Cypress that can be used in all test files without creating a new one everytime #28097
mariamaslam
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am very desperately looking for a solution to define a global variable and access it everything in all my test files. This is my commands.js. Here i am generating a random mobile number using faker.js. I am doing APIs automated testing but the APIs are executed in a sequence which means there should be one mobile number and one user ID that should be used throughout the test execution.
Now these commands are defined here and are working perfectly fine but when I use it in my test classes everything generates a new mobile number and new userID whereas I want one UserID and mobileNumber that can be used throughout the execution.
This is my test file
I have tried multiple options as follow, but nothing seems to be working for me:
I look forward to prompt support
Beta Was this translation helpful? Give feedback.
All reactions