wdio-cucumber-framework - Keep same webdriver session during single test execution

烈酒焚心 提交于 2019-12-08 06:29:54

问题


I am using wdio-cucumber-framework for my test automation. I have test cases in multiple .feature files. When I execute test cases a new webdriver browser instance is generated for each feature file.

settings in wdio.config.js

  capabilities: [{
                maxInstances: 1,            
                browserName: 'chrome'
            }],
    services: ['selenium-standalone'],
    framework: 'cucumber',
    reporters: ['spec'],
  • Feature File 1 ---> 5 test cases
  • Feature File 2 ---> 2 test cases

When I execute all the test cases in both feature files, a browser instance is launched for feature file 1. Once all the 5 test cases in feature file 1 are executed, browser instance got closed and I see wd/hub/session got deleted.

14:51:22]  COMMAND     DELETE   "/wd/hub/session/a4e7a5e9-3a4a-4129-9a31-c7a1b458aeee"
------------------------------------------------------------------
[chrome #0-1] Session ID: a4e7a5e9-3a4a-4129-9a31-c7a1b458aeee

Then a new browser instance got launched for Feature file 2. New webdriver instance got generated.

 COMMAND     POST     "/wd/hub/session"

I want all the feature files to be executed in a single webdriver instance / Session. Please let me know if there is a way to achieve this ?

来源:https://stackoverflow.com/questions/44555501/wdio-cucumber-framework-keep-same-webdriver-session-during-single-test-executi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!