drupalRelativeURL.js 565 B

123456789101112131415161718192021
  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. if (typeof callback === 'function') {
  17. callback.call(self);
  18. }
  19. return this;
  20. };