My question is basically the same as this one. But I am writing my tests in JavaScript. I want to have several step definition files. I tried creating a file with exported driver like this
var webdriver = require('selenium-webdriver');
var driver = new webdriver.Builder().forBrowser('chrome').build();
module.exports = driver;
I am importing this file in my step definition files with const { driver } = require('test-driver')
When I run the tests there are two browser windows opened insted of one.
What is the right way of sharing the same WebDriver between several step definition files?