Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / tests / Drupal / Nightwatch / Commands / drupalRelativeURL.js
diff --git a/web/core/tests/Drupal/Nightwatch/Commands/drupalRelativeURL.js b/web/core/tests/Drupal/Nightwatch/Commands/drupalRelativeURL.js
new file mode 100644 (file)
index 0000000..cff41e1
--- /dev/null
@@ -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;
+};