0

I am using WebdriverIO version 5 and would like to see the logs of my test run.

I tried the command: npm run rltest --logLevel=info, but all I can see is the output of the spec reporter.

[chrome 83.0.4103.116 Mac OS X #0-0] Running: chrome (v83.0.4103.116) on Mac OS X
[chrome 83.0.4103.116 Mac OS X #0-0] Session ID: 16d526a6b3cc51f54110024b112b247c
[chrome 83.0.4103.116 Mac OS X #0-0]
[chrome 83.0.4103.116 Mac OS X #0-0] cancel button
[chrome 83.0.4103.116 Mac OS X #0-0]    ✓ Verify that when the user clicks on the Cancel 
button, no changes made to the list
[chrome 83.0.4103.116 Mac OS X #0-0]
[chrome 83.0.4103.116 Mac OS X #0-0] 1 passing (36.2s)

Is there a way to see more detailed logs? Do I need to configure anything inside wdio.conf.js?

Thanks

iamdanchiv
  • 3,828
  • 4
  • 32
  • 40
shay n
  • 185
  • 1
  • 12

2 Answers2

0

Check documentation - logLevel

So basically you need to setup this property in wdio.conf.js:

 // ===================
  // Test Configurations
  // ===================
  // Define all options that are relevant for the WebdriverIO instance here
  //
  // Level of logging verbosity: trace | debug | info | warn | error | silent
  logLevel: 'debug',
Vojtech Cerveny
  • 572
  • 1
  • 3
  • 15
0

You should see the wdio logs in your console, as WebdriverIO defaults to dumping all the Selenium logs into stdout. Hope I understood correctly and you're talking about the webdriver logs, as below:

[0-0] 2020-07-01T09:28:53.869Z INFO webdriver: [GET] http://127.0.0.1:4444/wd/hub/session/933eeee4135ea0ca37d57f0b807cb29e/element/0.45562246642229964-9/displayed
[0-0] 2020-07-01T09:28:53.878Z INFO webdriver: RESULT true
[0-0] 2020-07-01T09:28:53.879Z INFO webdriver: COMMAND findElement("css selector", "#_evidon-l3 button")
[0-0] 2020-07-01T09:28:53.879Z INFO webdriver: [POST] http://127.0.0.1:4444/wd/hub/session/933eeee4135ea0ca37d57f0b807cb29e/element
[0-0] 2020-07-01T09:28:53.879Z INFO webdriver: DATA { using: 'css selector', value: '#_evidon-l3 button' }
[0-0] 2020-07-01T09:28:53.888Z INFO webdriver: RESULT { ELEMENT: '0.45562246642229964-10' }
[0-0] 2020-07-01T09:28:53.889Z INFO webdriver: COMMAND isElementDisplayed("0.45562246642229964-10")

If this is not the case, please check if you have outputDir option set inside the wdio.conf.js file. If indeed you have this setup, then you are overriding the default, sending the log streams to files inside that path:

e.g: outputDir: 'wdio-logs', (wdio.conf.js file)

enter image description here

The logs should be inside the wdio-x-y.log files. So, either debug your cases using the overridden path log files, or remove outputDir entry from your wdio.conf.js file if you want them inside the console.


Even better, you could be fancy and set outputDir: process.env.CONSOLELOGS ? null : 'wdio/logs/path/here'. Then you can run your checks with a system variable to trigger console logging:

CONSOLELOGS=true npm run rltest <params>

iamdanchiv
  • 3,828
  • 4
  • 32
  • 40
  • You understood it correctly. i would like to see the logs in the stdout. I don't have outputDir set on my configuration file. not sure why i am not able to see it. i noticed the even a simple console.log won't output anything in the stdout. maybe it can be something with the allure reporter? – shay n Jul 01 '20 at 10:27
  • No, it shouldn't affect your logging, as allure has it's own `outputDir` path for logging. As for the `outputDir` value inside the `wdio.conf.js` file, just add it inside the object and set the path where you want the webdriver logs to be streamed to. – iamdanchiv Jul 01 '20 at 10:42
  • Maybe the value gets overwritten somewhere, you can also try to give it `outputDir: null` and try to force the default `stdout` logging. – iamdanchiv Jul 01 '20 at 10:44