Code Monkey home page Code Monkey logo

Comments (7)

archfz avatar archfz commented on May 20, 2024 3

If for some reason you still want to use console log in test code do: cy.window().then(w => w.console.log()). Mainly it is not advised to use console log in test code for cypress since cypress uses a queue (async) to execute stuff in order, and plain console.log is sync.

from cypress-terminal-report.

andrei1015 avatar andrei1015 commented on May 20, 2024 1

Have just updated to the latest version of the plugin and rechecked.

The plugin installation:

module.exports = (on, config) => {
  let config = {};
  config.printLogsToConsole = 'always';
  require('cypress-terminal-report/src/installLogsPrinter')(on, config);
};

And the support installation:

let config = {};
config.collectTypes = ['cons:log', 'cons:info', 'cons:warn', 'cons:error', 'cy:log'];
require('cypress-terminal-report/src/installLogsCollector')(config);

And in the code I have:

    console.log('help');
    console.info('help');
    console.warn('help');
    console.error('help');
    cy.log('help');

This is in a spec file, also tried from a helper file. Only the cy.log one seems to work.

from cypress-terminal-report.

archfz avatar archfz commented on May 20, 2024 1

You shouldnt be using console logging in test code. Use cy.log there. The console logs only appear from your application that is tested. Cypress test execution is in primary browser frame and your site being tested is running in a child frame (iframe), only in the later we intercept console logging.

from cypress-terminal-report.

archfz avatar archfz commented on May 20, 2024

Please provide the plugin version and the options you are using on the collector install.

from cypress-terminal-report.

nicholaschiang avatar nicholaschiang commented on May 20, 2024

@archfz Is this documented in the README somewhere? I couldn't see it and thus assumed I could use console.log and it would be recorded automatically.

from cypress-terminal-report.

archfz avatar archfz commented on May 20, 2024

No it's not documented. Let s add it in that case.

from cypress-terminal-report.

archfz avatar archfz commented on May 20, 2024

Released in 3.0.2

from cypress-terminal-report.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.