annotate core/tests/Drupal/Nightwatch/Commands/drupalLogAndEnd.js @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 129ea1e6d783
children
rev   line source
Chris@17 1 /**
Chris@17 2 * Ends the browser session and logs the console log if there were any errors.
Chris@17 3 * See globals.js.
Chris@17 4 *
Chris@17 5 * @param {Object}
Chris@17 6 * (optional) Settings object
Chris@17 7 * @param onlyOnError
Chris@17 8 * (optional) Only writes out the console log file if the test failed.
Chris@17 9 * @param {function} callback
Chris@17 10 * A callback which will be called.
Chris@17 11 * @return {object}
Chris@17 12 * The 'browser' object.
Chris@17 13 */
Chris@17 14 exports.command = function drupalLogAndEnd({ onlyOnError = true }, callback) {
Chris@17 15 const self = this;
Chris@17 16 this.drupalLogConsole = true;
Chris@17 17 this.drupalLogConsoleOnlyOnError = onlyOnError;
Chris@17 18
Chris@17 19 // Nightwatch doesn't like it when no actions are added in a command file.
Chris@17 20 // https://github.com/nightwatchjs/nightwatch/issues/1792
Chris@17 21 this.pause(1);
Chris@17 22
Chris@17 23 if (typeof callback === 'function') {
Chris@17 24 callback.call(self);
Chris@17 25 }
Chris@17 26 return this;
Chris@17 27 };