Mercurial > hg > isophonics-drupal-site
annotate core/tests/Drupal/Nightwatch/Commands/drupalRelativeURL.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 * Concatenate a DRUPAL_TEST_BASE_URL variable and a pathname. |
Chris@17 | 3 * |
Chris@17 | 4 * This provides a custom command, .relativeURL() |
Chris@17 | 5 * |
Chris@17 | 6 * @param {string} pathname |
Chris@17 | 7 * The relative path to append to DRUPAL_TEST_BASE_URL |
Chris@17 | 8 * @param {function} callback |
Chris@17 | 9 * A callback which will be called. |
Chris@17 | 10 * @return {object} |
Chris@17 | 11 * The 'browser' object. |
Chris@17 | 12 */ |
Chris@17 | 13 exports.command = function drupalRelativeURL(pathname, callback) { |
Chris@17 | 14 const self = this; |
Chris@17 | 15 this.url(`${process.env.DRUPAL_TEST_BASE_URL}${pathname}`); |
Chris@17 | 16 |
Chris@17 | 17 if (typeof callback === 'function') { |
Chris@17 | 18 callback.call(self); |
Chris@17 | 19 } |
Chris@17 | 20 return this; |
Chris@17 | 21 }; |