flotwig / cypress-log-to-output

A Cypress plugin that sends all logs that occur in the browser to stdout in the terminal.
146 stars 19 forks source link

No console output on Chrome 76 #3

Closed arsduo closed 5 years ago

arsduo commented 5 years ago

Hi! I'm very excited about this plugin as it would help us diagnose a number of issues we see on Cypress; unfortunately I'm getting an error message:

[cypress-log-to-output] Warning: An unsupported browser family was used, output will not be logged to console: undefined

This is happening even though we're using Chrome and I've added it to cypress/plugins/index.js exactly as described in the readme:

 /Users/user/project/node_modules/.bin/cypress run --browser chrome
  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:    3.1.5                                                                              │
  │ Browser:    Chrome 76                                                                          │
  │ Specs:      42 found                                                                           │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘

Are there any issues with newer versions of Chrome, or could we be doing something wrong?

Thanks!

arsduo commented 5 years ago

Figured it out, apparently for Chrome browser.family doesn't exist but browser.name is chrome. I'll take out a PR.

flotwig commented 5 years ago

Hey @arsduo, thanks for the report. You should update your version of Cypress, family was added in 3.2.0 and the latest release is 3.4.1.

stevenvachon commented 4 years ago

@flotwig, I'm getting this:

[cypress-log-to-output] Warning: An unsupported browser family was used, output will not be logged to console: chromium
marciaga commented 4 years ago

@stevenvachon Logging the browser object from the isChrome function reveals why it doesn't return true from the Cypress defaults:

 name: 'electron',
  channel: 'stable',
  family: 'chromium',
  displayName: 'Electron',
  version: '80.0.3987.165',
  path: '',
  majorVersion: 80,
  info: 'Electron is the default browser that comes with Cypress. This is the default browser that runs in headless mode. Selecting this browser is useful when debugging. The version number indicates the underlying Chromium version that Electron uses.',
  isHeadless: true,
  isHeaded: false
function isChrome(browser) {
  return browser.family === 'chrome' || ['chrome', 'chromium', 'canary'].includes(browser.name)
}

This is in version 1.0.8. But yeah it clearly doesn't work because the default is Electron even if the family is 'chromium'. Passing the browser flag at the Cypress run command should work for you: --browser chrome.