klamping / ui-testing-book

Content for "The Web App Testing Guidebook"
https://leanpub.com/webapp-testing-guidebook/
Other
29 stars 8 forks source link

Default browser that test runner wants is Chrome #3

Closed jpolley closed 5 years ago

jpolley commented 5 years ago

1.2.5 Reviewing the Standard WebdriverIO Configuration File

https://github.com/klamping/ui-testing-book/blob/35772b5af63f8aa52fbefaef03e4f133028192fa/manuscript/1.2.5%20Reviewing%20the%20Standard%20WebdriverIO%20Configuration%20File.txt#L116

I just went through the exercise using 5.13.0 and the default browser was actually Chrome. So I guess that has changed recently and you can remove the part about Firefox being default browser.

package.json:

  "devDependencies": {
    "@wdio/local-runner": "^5.13.0",
    "@wdio/mocha-framework": "^5.12.1",
    "@wdio/spec-reporter": "^5.12.1",
    "@wdio/sync": "^5.13.0",
    "chromedriver": "^77.0.0",
    "wdio-chromedriver-service": "^5.0.2"
  }

wdio.conf.js

    capabilities: [{
        // maxInstances can get overwritten per capability. So if you have an in-house Selenium
        // grid with only 5 firefox instances available you can make sure that not more than
        // 5 instances get started at a time.
        maxInstances: 5,
        //
        browserName: 'chrome',
        // If outputDir is provided WebdriverIO can capture driver session logs
        // it is possible to configure which logTypes to include/exclude.
        // excludeDriverLogs: ['*'], // pass '*' to exclude all driver session logs
        // excludeDriverLogs: ['bugreport', 'server'],
    }],

Or maybe this is a bug with latest version of WebdriverIO that needs to be addressed if the default is supposed to be Firefox?

jpolley commented 5 years ago

Good news, I'm just an idiot who failed to select the "selenium-standalone" service properly when going through npx wdio setup for the first time. I hit arrow keys to highlight the service then hit <return> thinking it was going to select what was highlighted. And that's not how it works. I needed to de-select chromedriver using <space> and then select selenium-standalone using <space>. When I did that 'firefox' was the default browser.

service
jpolley commented 5 years ago

This would have all been avoided if I had simply followed the instructions you have during setup:

https://github.com/klamping/ui-testing-book/blob/35772b5af63f8aa52fbefaef03e4f133028192fa/manuscript/1.2.4%20Upgrading%20to%20the%20WDIO%20Test%20Runner.txt#L226