webdriverio-boneyard / v4

Deprecated code base for all WebdriverIO releases up until v4.x
MIT License
8 stars 21 forks source link

browser.reload() failing to reload the session when this was called after a failed test #20

Open christian-bromann opened 5 years ago

christian-bromann commented 5 years ago

From @nareshnayini on February 26, 2019 18:19

I am encountering issues when trying to use reload after every test when preceding test fails.

Environment:

Describe the bug When a test fails, browser.reload() function inside afterTest failing with the below mentioned error. So, browser session is not deleted and it's reloading with session session.

To Reproduce Steps to reproduce the behavior: WDIO config: afterTest: () => { browser.reload(); }, afterSession: async () => { await browser.end().pause(1000); }, after: async () => { await browser.pause(1000); },

Expected behavior It is expected that, upon reload() call, user will be logged out from application and application relaunches.

Log Error in onReload hook: "Error: Don't end the session manually. This will be done automatically. at session("delete") - end.js:31:17 at init() - reload.js:40:23 at end() - reload.js:40:17 at screenshot() - saveScreenshot.js:52:17 at reload() - index.js:312:3"

I have looked into other tickets related to this issue but nowhere found the solution. Most of the tickets were closed saying they are inactive.

Copied from original issue: webdriverio/webdriverio#3634

CrispusDH commented 5 years ago

Move reload to beforeTest :)