Issue #2974553 by Mixologic, justafish, drpal, dawehner: Nightwatch testing fails to save console logs for some tests

merge-requests/1654/head
Alex Pott 2018-05-24 23:00:33 +01:00
parent 0076c635dc
commit 2e753970f7
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
3 changed files with 5 additions and 7 deletions

View File

@ -4,5 +4,4 @@ node_modules/**/*
*.js
!*.es6.js
modules/locale/tests/locale_test.es6.js
!nightwatch.conf.js
!tests/Drupal/Nightwatch/**/*.js

View File

@ -12,9 +12,9 @@
"build:js-dev": "cross-env NODE_ENV=development node BABEL_ENV=legacy ./scripts/js/babel-es6-build.js",
"watch:js": "cross-env BABEL_ENV=legacy node ./scripts/js/babel-es6-watch.js",
"watch:js-dev": "cross-env NODE_ENV=development BABEL_ENV=legacy node ./scripts/js/babel-es6-watch.js",
"lint:core-js": "node ./node_modules/eslint/bin/eslint.js --ext=.es6.js . || exit 0",
"lint:core-js-passing": "node ./node_modules/eslint/bin/eslint.js --quiet --config=.eslintrc.passing.json --ext=.es6.js . || exit 0",
"lint:core-js-stats": "node ./node_modules/eslint/bin/eslint.js --format=./scripts/js/eslint-stats-by-type.js --ext=.es6.js . || exit 0",
"lint:core-js": "node ./node_modules/eslint/bin/eslint.js . || exit 0",
"lint:core-js-passing": "node ./node_modules/eslint/bin/eslint.js --quiet --config=.eslintrc.passing.json . || exit 0",
"lint:core-js-stats": "node ./node_modules/eslint/bin/eslint.js --format=./scripts/js/eslint-stats-by-type.js . || exit 0",
"lint:css": "stylelint \"**/*.css\" || exit 0",
"lint:css-checkstyle": "stylelint \"**/*.css\" --custom-formatter ./node_modules/stylelint-checkstyle-formatter/index.js || exit 0",
"test:nightwatch": "cross-env BABEL_ENV=development node -r dotenv-safe/config -r babel-register ./node_modules/.bin/nightwatch --config ./tests/Drupal/Nightwatch/nightwatch.conf.js"

View File

@ -31,12 +31,11 @@ module.exports = {
browser.drupalLogConsole &&
(!browser.drupalLogConsoleOnlyOnError || browser.currentTest.results.errors > 0 || browser.currentTest.results.failed > 0)
) {
let testName = browser.currentTest.name || browser.currentTest.module;
testName = testName.split(' ').join('-');
const resultPath = path.join(__dirname, `../../../${nightwatchSettings.output_folder}/consoleLogs/${browser.currentTest.module}`);
const status = browser.currentTest.results.errors > 0 || browser.currentTest.results.failed > 0 ? 'FAILED' : 'PASSED';
mkdirp.sync(resultPath);
const now = new Date().toString().split(' ').join('-');
const now = new Date().toString().replace(/[\s]+/g, '-');
const testName = (browser.currentTest.name || browser.currentTest.module).replace(/[\s/]+/g, '-');
browser
.getLog('browser', (logEntries) => {
const browserLog = JSON.stringify(logEntries, null, ' ');