Closed suchitrak closed 3 years ago
What error are you finding? There shouldn't be any problem with calling setupBrowser in the before block, it's working for me if I try to do it in the repo's tests but we aren't using cucumber or anything. It would probably break if the browser is entirely recreated between tests or something? A sessionReload call would still be fine though!
Sorry my bad. It works fine if added to Before hook.
@suchitrak , which version of cucumber and wdio are you using? I'm unsuccessful of getting this to work with latest of @wdio/cucumber-framework.
It was v6
Where should
setupBrowser
be invoked. Currently I am using it like below and it works perfectly. `const { When, Then } = require('cucumber'); const debugModule = require('debug'); const { setupBrowser } = require('@testing-library/webdriverio');const debug = debugModule('box:wdio-utils:step_definitions:interact');
When('I {word} the/a(n) {word} named/called/labelled/labeled {string}', (action, ariaRole, text) => { setupBrowser(browser); browser.findByRole(ariaRole, { name: text })[action](); browser.pause(5000); });`
But with this I would have to invoke
setupBrowser(browser);
within every stepdefenition. I tried invoking it in the before() hook in webdriverio conf. But that gave an error. Which common place can this be invoked?