X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Ftests%2FDrupal%2FNightwatch%2FCommands%2FdrupalRelativeURL.js;fp=web%2Fcore%2Ftests%2FDrupal%2FNightwatch%2FCommands%2FdrupalRelativeURL.js;h=cff41e14b9887c854caa8d30ff85e05a48ff28c0;hp=0000000000000000000000000000000000000000;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/tests/Drupal/Nightwatch/Commands/drupalRelativeURL.js b/web/core/tests/Drupal/Nightwatch/Commands/drupalRelativeURL.js new file mode 100644 index 000000000..cff41e14b --- /dev/null +++ b/web/core/tests/Drupal/Nightwatch/Commands/drupalRelativeURL.js @@ -0,0 +1,21 @@ +/** + * Concatenate a DRUPAL_TEST_BASE_URL variable and a pathname. + * + * This provides a custom command, .relativeURL() + * + * @param {string} pathname + * The relative path to append to DRUPAL_TEST_BASE_URL + * @param {function} callback + * A callback which will be called. + * @return {object} + * The 'browser' object. + */ +exports.command = function drupalRelativeURL(pathname, callback) { + const self = this; + this.url(`${process.env.DRUPAL_TEST_BASE_URL}${pathname}`); + + if (typeof callback === 'function') { + callback.call(self); + } + return this; +};