
| Current Path : /var/www/html/rocksensor2/web/core/tests/Drupal/Nightwatch/Commands/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/rocksensor2/web/core/tests/Drupal/Nightwatch/Commands/drupalInstallModule.js |
/**
* Install the given module.
*
* @param {string} module
* The module machine name to enable.
* @param {boolean} force
* Force to install dependencies if applicable.
* @param {function} callback
* A callback which will be called, when the module has been enabled.
* @return {object}
* The drupalInstallModule command.
*/
exports.command = function drupalInstallModule(module, force, callback) {
const self = this;
this.drupalLoginAsAdmin(() => {
this.drupalRelativeURL('/admin/modules')
// Filter module list to ensure that collapsable <details> elements are expanded.
.updateValue(
'form.system-modules [data-drupal-selector="edit-text"]',
module,
)
.waitForElementVisible(
`form.system-modules [name="modules[${module}][enable]"]`,
10000,
)
.click(`form.system-modules [name="modules[${module}][enable]"]`)
.submitForm('form.system-modules');
if (force) {
// Click `Continue` if applicable.
this.waitForElementPresent(
'#system-modules-confirm-form, #system-modules-non-stable-confirm-form',
10000,
false,
() => self.click('input[value=Continue]'),
);
}
// Wait for the checkbox for the module to be disabled as a sign that the
// module has been enabled.
this.waitForElementPresent(
`form.system-modules [name="modules[${module}][enable]"]:disabled`,
10000,
);
}).perform(() => {
if (typeof callback === 'function') {
callback.call(self);
}
});
return this;
};