DocumentationLogging & debugging
Logging & debugging
Debugging end-to-end tests is notoriously difficult. To help give visibility, Carbonate provides extensive logging capabilities.
Automatic log dumping
When your test fails, Carbonate automatically injects its logs into the test exception so that they appear in your test output:
info: Loading page [...]
info: Querying action [...]
info: Waiting for DOM update to finish [...]
notice: No actions found, extracting from page [...]
info: Successfully extracted actions [...]
info: Performing action [...]
info: Querying assertion [...]
notice: No assertions found, extracting from page [...]
Alternative logging:
Alternatively, if you want log to a file, you can specify this in the logging parameter of the SDK constructor:
sdk = new SDK(
browser,
path.join(__dirname, path.parse(__filename).name),
"<your user ID>", // TODO: Change me
"<your API key>" // TODO: Change me
// Log to a file:
'var/log/tests.log'
);
You can also provide your ownlogger, providing it is compatible with the logger interface. When providing your own logger, all logs will be sent to the logger - regardless of whether the test passed or failed.
Disabling log dumping
If you don't need this feature, you can disable log dumping by passing false
to the logging parameter of the SDK constructor
sdk = new SDK(
browser,
path.join(__dirname, path.parse(__filename).name),
"<your user ID>", // TODO: Change me
"<your API key>" // TODO: Change me
// Disable logging for all tests:
false
);