Problem/Motivation

Nightwatch commands that come in from different places (i.e. Nightwatch core commands, commands provided by Drupal core, commands from modules etc) could potentially conflict if they have the same name.

Proposed resolution

Prefix all our commands with "drupal" e.g. relativeURL -> drupalRelativeURL

CommentFileSizeAuthor
#8 2976593-8.patch584 bytesMixologic
#2 2976593-2.patch4.13 KBGrandmaGlassesRopeMan

Comments

justafish created an issue. See original summary.

GrandmaGlassesRopeMan’s picture

Issue tags: +JavaScript, +JavaScriptTest
StatusFileSize
new4.13 KB

- namespace all nightwatch custom commands with drupal

GrandmaGlassesRopeMan’s picture

Status: Active » Needs review
dawehner’s picture

Status: Needs review » Reviewed & tested by the community

As written in slack it feels like the old Simpletest function, which we got rid when moving to phpunit.
On the other hand though, JS doesn't have the namespace advantage of PHP, so I think this is fine.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 8aef9a8 and pushed to 8.6.x. Thanks!

  • alexpott committed 8aef9a8 on 8.6.x
    Issue #2976593 by drpal, justafish, dawehner: Prefix Nightwatch commands...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Mixologic’s picture

+++ b/core/tests/Drupal/Nightwatch/Commands/drupalUninstall.js
@@ -9,7 +9,7 @@ import { commandAsWebserver } from '../globals';
+exports.command = function drupalUninstal(callback) {

Uninstall should have two L's.

Also, not sure what/where/how we decide if this is an API or not. I know of at least one contrib module that had a test that stopped working, probably NBD, as it seems like a difficult thing to balance between "its not really an API yet, because its not in a full stable release", vs "please write nightwatch tests so we can know if theres something missing/needed"

Also we probs ought to have our sample tests at least exercise some of these functions: I opened a followup: #2981308: Ensure nightwatch tests exercise all apis at least once.

Since I cant reopen this, maybe this typo fix could just get rolled into that.

jibran’s picture

Issue tags: -

The latest patch in #3059356: [Security] Update yarn packages to fix 19 vulnerabilities by updating nightwatch is purposing the following change:

+++ b/core/tests/Drupal/Nightwatch/Commands/drupalLogAndEnd.js
@@ -2,16 +2,14 @@
-exports.command = function drupalLogAndEnd({ onlyOnError = true }, callback) {
+exports.command = function drupalLogAndEnd(onlyOnError, callback) {

We'd love to have someone review the patch.