webdriverio-boneyard / wdio-cucumber-framework

A WebdriverIO v4 plugin. Adapter for Cucumber testing framework.
MIT License
77 stars 61 forks source link

"Error in onReload hook" using reload method on update framework version #158

Open xiscocapllonch opened 5 years ago

xiscocapllonch commented 5 years ago

I'm using WebDriverIO and cucumber with the test runner to run tests that need an special clean scenario environment without old cookies or session storages.

I was using the "browser.reload()" method in the "beforeScenario" function without any problem for the next set of versions:

"cucumber": "4.2.1", "wdio-cucumber-framework": "1.1.1", "webdriverio": "4.13.0"

When I updated the wdio-cucumber-framework version form "1.1.1" to "2.2.8", the beforeScenario function:

beforeScenario: function () { browser.reload() }

Throws an exception like the following:

Error in onReload hook: "Error: Don't call the 'init' command when using the wdio test runner. Your session will get initialised and closed automatically.

And "Your session will get initialised and closed automatically" isn't the case between scenarios.

xiscocapllonch commented 5 years ago

Someone?

BorisOsipov commented 5 years ago

@xiscocapllonch please share repo with reproducible example, I will try to help

xiscocapllonch commented 5 years ago

@BorisOsipov thanks, you can try with this example https://github.com/xiscocapllonch/wdio-cucumber-reproducible-example

BorisOsipov commented 5 years ago

@xiscocapllonch didn't get what is happened. Workaraund move browser.reload() to cucumber hook. E.g see patch https://gist.github.com/BorisOsipov/2755ee4e121d2628f71b6f5750405225

BorisOsipov commented 5 years ago

Also if you use sync:true you don't need async\await e.g await browser.waitForExist('#bbcprivacy-continue-button')