Log console errors in tests. .meteorignore

This commit is contained in:
vjrj 2018-05-23 10:53:35 +02:00
parent b54707f2dc
commit 783967c0e1
3 changed files with 31 additions and 0 deletions

3
.meteorignore Normal file
View file

@ -0,0 +1,3 @@
# Don't reload meteor server when we modify or do test
cucumber
output.json

View file

@ -1,5 +1,8 @@
Feature: Test all secundary pages Feature: Test all secundary pages
Background:
Given I am on the home page
Scenario: Check that all secondary pages work well Scenario: Check that all secondary pages work well
Given a list of page ids and contents Given a list of page ids and contents
| license | License | | license | License |

View file

@ -2,6 +2,31 @@
(function () { (function () {
module.exports = function () { module.exports = function () {
const printLog = (type) => {
client.log(type).value.forEach((logItem) => {
const { source, message } = logItem;
if (type === 'browser' && source === 'console-api') {
// Clean messages of type:
// http://localhost:3000/app/app.js?hash=34da4258bd2caa4e14c7c0c20ba6396f309e7236 13325:18 "GMaps script just loaded"
// to get the last part
const cleanMessage = message.replace(/[^ ]{1,} [^ ]{1,} "(.*)"$/g, '$1');
console.log(`${logItem.level}: ${cleanMessage}`);
} else {
// Right now we don't need logs like:
// %cDownload the React DevTools for a better development experience: https://fb.me/react-devtools
// console.log(`${logItem.level}: ${message}`);
}
});
};
this.StepResult((stepResult) => {
if (stepResult.getStatus() === 'failed') {
// http://webdriver.io/api/protocol/log.html
console.log(`Step result: ${stepResult.getStatus()}`);
printLog('browser');
}
});
this.Before(() => { this.Before(() => {
// global.expect = require('@xolvio/jasmine-expect').expect; // global.expect = require('@xolvio/jasmine-expect').expect;