Replies: 1 comment 3 replies
-
Hello, A workaround I have found for a similar issue was to store the object in the gauge datastore in my BeforScenario hook, and map the variable in a before step in every JS file. So when starting your driver you could use:
It's problably not the most elegant way, and might consume unecessary ressources to run this BeforeStep every single step, but working with Playwright and multiple browser contexts in a single test, it was quite efficient. I needed a way to be able to call steps to switch from a browser to another from the spec file easily, while not having any step implemetations tied to a specific context, and it worked. I hope it helps. |
Beta Was this translation helpful? Give feedback.
-
I have a current problem regarding Selenium with Gauge as the BDD framework using NodeJS as programming language.
Context
For instance, I have the following steps that I need to implement:
So in my example above, both specs have
Visit the site that I'm testing.
in order to visit the site on a different set of test cases. The following code forVisit the site that I'm testing.
is as follows:Now if I use this code in other specs, it will throw that the driver is undefined, which is what's happening now.
Questions
Visit the site that I'm testing.
be able to be used by other specifications with driver instance available to the next set of steps? My problem is I can't use the step to other specs because it's looking for a definition of the driver and I am not sure if hooks were the right way to do it (I ran out of ideas.)Beta Was this translation helpful? Give feedback.
All reactions