Comments (7)
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.
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.
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.
Please provide the plugin version and the options you are using on the collector install.
from cypress-terminal-report.
@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.
No it's not documented. Let s add it in that case.
from cypress-terminal-report.
Released in 3.0.2
from cypress-terminal-report.
Related Issues (20)
- Upgrading from Cypress 9.5.4 to cypress 12.16.0 results in plugin crash w/ typerror HOT 8
- After Cypress version migration, cypress-terminal-report no longer prints console output on failure HOT 9
- Cypress terminal report does not generate logs in CLI in Cypress 12.12.0. HOT 2
- Options for specifying request-modifying callback HOT 5
- Is there a way to get the logging to write/append to the file in the afterEach portion of test runs. HOT 3
- Possible memory leak in v5.3.2 HOT 20
- Cypress not found error HOT 1
- Output timestamp HOT 7
- cy:xhr logs show "undefined" in Cypress 13 HOT 4
- Log spec code runtime errors HOT 5
- v5.3.5 error when running, 'import' and 'export' may only appear with sourceType: module HOT 2
- Commands from subsequent test retries are not logged to console HOT 1
- Integration with cypress-io/github-action@v6 HOT 2
- Vulnerability - semver - Regular Expression Denial of Service (ReDoS) HOT 2
- Doesn't work with Component tests HOT 3
- unconditional "debugger" statement is pausing execution for all tests that use LogCollectCypressFetch HOT 1
- How to filter `Verbose level` HOT 2
- Getting error in component testing HOT 3
- cy.api request as cy:request logs and not cy:command HOT 1
- Bug: Cypress Component testing on React logs console logs recursively HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cypress-terminal-report.