The new command was introduced in https://www.drupal.org/node/3264978, which takes you to the modules page and installs the modules

It doesn't take into account

1) modules with underscores in their machine names
2) modules under the Testing package. This is because the testing modules loaded under a collapsed <details> element, under which nothing can be clicked by nightwatch.

CommentFileSizeAuthor
#7 3272727-7.patch1 KBmherchel
#5 3272727.patch1.16 KBmherchel

Comments

mherchel created an issue. See original summary.

mherchel’s picture

Adding the following fixes it. Will post patch later

// Testing <details> element is collapsed by default, so open it before click.
      .click('[data-drupal-selector="edit-modules-testing"]:not([open]) summary')
      .waitForElementVisible('[data-drupal-selector="edit-modules-testing"][open]', 10000)
      .click(`input[data-drupal-selector="edit-modules-${module.replaceAll('_', '-')}-enable"]`)
nod_’s picture

yeah the command wasn't made very robust, happy to review

nod_’s picture

To show the modules we can use the search bar to search for the module name, that will expand any collapsed detail element so we can click the checkbox afterwards

mherchel’s picture

Status: Active » Needs review
StatusFileSize
new1.16 KB

Patch attached.

This
1) Expands all collapsed details elements
2) replaces any underscores with hyphens within the module name.

nod_’s picture

Status: Needs review » Needs work
  1. +++ b/core/tests/Drupal/Nightwatch/Commands/drupalInstallModule.js
    @@ -12,7 +12,20 @@ exports.command = function drupalInstallModule(module, callback) {
    +          .querySelectorAll('.package-listing:not([open]) summary')
    +          .forEach((el) => {
    +            el.click();
    +          });
    

    instead of opening everything I'd type the module name in the search area like here https://git.drupalcode.org/project/drupal/-/blob/10.0.x/core/tests/Drupa... (we can search for the machine name of the module that'll work).

  2. +++ b/core/tests/Drupal/Nightwatch/Commands/drupalInstallModule.js
    @@ -12,7 +12,20 @@ exports.command = function drupalInstallModule(module, callback) {
    +        `input[data-drupal-selector="edit-modules-${module.replaceAll(
    +          '_',
    +          '-',
    +        )}-enable"]`,
    

    I went with the drupal selector but I'd rather use the name attribute so that we don't have to mess with the module name.

mherchel’s picture

Status: Needs work » Needs review
StatusFileSize
new1 KB

Thanks for the review. Updated patch attached!

nod_’s picture

Status: Needs review » Reviewed & tested by the community

Perfect, thanks

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 7: 3272727-7.patch, failed testing. View results

mherchel’s picture

Status: Needs work » Reviewed & tested by the community

Unrelated failure.

  • lauriii committed c4b374b on 10.0.x
    Issue #3272727 by mherchel, nod_: Nightwatch's drupalModuleInstall()...

  • lauriii committed 353ba71 on 9.4.x
    Issue #3272727 by mherchel, nod_: Nightwatch's drupalModuleInstall()...
lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Committed c4b374b and pushed to 10.0.x. Also cherry-picked to 9.4.x. Thanks!

Status: Fixed » Closed (fixed)

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