cff41e14b9887c854caa8d30ff85e05a48ff28c0
[yaffs-website] / web / core / tests / Drupal / Nightwatch / Commands / drupalRelativeURL.js
1 /**
2  * Concatenate a DRUPAL_TEST_BASE_URL variable and a pathname.
3  *
4  * This provides a custom command, .relativeURL()
5  *
6  * @param {string} pathname
7  *   The relative path to append to DRUPAL_TEST_BASE_URL
8  * @param {function} callback
9  *   A callback which will be called.
10  * @return {object}
11  *   The 'browser' object.
12  */
13 exports.command = function drupalRelativeURL(pathname, callback) {
14   const self = this;
15   this.url(`${process.env.DRUPAL_TEST_BASE_URL}${pathname}`);
16
17   if (typeof callback === 'function') {
18     callback.call(self);
19   }
20   return this;
21 };