Issue #3264940 by star-szr, jungle, smustgrave, lauriii: Add optional parameter to Nightwatch drupalInstallModule command to enable module dependencies

merge-requests/4668/merge
Lauri Eskola 2023-09-27 20:19:52 +03:00
parent b00c941076
commit 22576037d7
No known key found for this signature in database
GPG Key ID: 382FC0F5B0DF53F8
12 changed files with 40 additions and 119 deletions

View File

@ -1,7 +1,11 @@
module.exports = {
'@tags': ['core', 'ckeditor5'],
before(browser) {
browser.drupalInstall({ installProfile: 'minimal' });
browser
.drupalInstall({ installProfile: 'minimal' })
.drupalInstallModule('ckeditor5', true)
.drupalInstallModule('field_ui');
// Set fixed (desktop-ish) size to ensure a maximum viewport.
browser.resizeWindow(1920, 1080);
},
@ -11,17 +15,6 @@ module.exports = {
'Ensure CKEditor respects field widget row value': (browser) => {
browser.drupalLoginAsAdmin(() => {
browser
// Enable required modules.
.drupalRelativeURL('/admin/modules')
.click('[name="modules[ckeditor5][enable]"]')
.click('[name="modules[field_ui][enable]"]')
.submitForm('input[type="submit"]') // Submit module form.
.waitForElementVisible(
'.system-modules-confirm-form input[value="Continue"]',
)
.submitForm('input[value="Continue"]') // Confirm installation of dependencies.
.waitForElementVisible('.system-modules', 10000)
// Create new input format.
.drupalRelativeURL('/admin/config/content/formats/add')
.waitForElementVisible('[data-drupal-selector="edit-name"]')

View File

@ -8,8 +8,7 @@ module.exports = {
before(browser) {
browser
.drupalInstall()
.drupalInstallModule('breakpoint')
.drupalInstallModule('toolbar')
.drupalInstallModule('toolbar', true)
.drupalCreateUser({
name: 'user',
password: '123',

View File

@ -15,8 +15,7 @@ module.exports = {
before(browser) {
browser
.drupalInstall()
.drupalInstallModule('breakpoint')
.drupalInstallModule('toolbar')
.drupalInstallModule('toolbar', true)
.drupalCreateUser({
name: 'user',
password: '123',

View File

@ -3,12 +3,14 @@
*
* @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, callback) {
exports.command = function drupalInstallModule(module, force, callback) {
const self = this;
this.drupalLoginAsAdmin(() => {
this.drupalRelativeURL('/admin/modules')
@ -22,13 +24,22 @@ exports.command = function drupalInstallModule(module, callback) {
10000,
)
.click(`form.system-modules [name="modules[${module}][enable]"]`)
.submitForm('form.system-modules')
// Wait for the checkbox for the module to be disabled as a sign that the
// module has been enabled.
.waitForElementPresent(
`form.system-modules [name="modules[${module}][enable]"]:disabled`,
.submitForm('form.system-modules');
if (force) {
// Click `Continue` if applicable.
this.waitForElementPresent(
'#system-modules-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);

View File

@ -1,20 +1,7 @@
module.exports = {
'@tags': ['core', 'ajax'],
before(browser) {
browser.drupalInstall().drupalLoginAsAdmin(() => {
browser
.drupalRelativeURL('/admin/modules')
.setValue('input[type="search"]', 'Ajax test')
.waitForElementVisible('input[name="modules[ajax_test][enable]"]', 1000)
.click('input[name="modules[ajax_test][enable]"]')
.submitForm('input[type="submit"]') // Submit module form.
.waitForElementVisible(
'.system-modules-confirm-form input[value="Continue"]',
2000,
)
.submitForm('input[value="Continue"]') // Confirm installation of dependencies.
.waitForElementVisible('.system-modules', 10000);
});
browser.drupalInstall().drupalInstallModule('ajax_test', true);
},
after(browser) {
browser.drupalUninstall();

View File

@ -2,25 +2,15 @@ module.exports = {
'@tags': ['core'],
before(browser) {
browser.drupalInstall().drupalLoginAsAdmin(() => {
browser
.drupalRelativeURL('/admin/modules')
.setValue('input[type="search"]', 'FormAPI Test')
.waitForElementVisible('input[name="modules[form_test][enable]"]', 1000)
.click('input[name="modules[form_test][enable]"]')
.submitForm('input[type="submit"]') // Submit module form.
.waitForElementVisible(
'.system-modules-confirm-form input[value="Continue"]',
2000,
)
.submitForm('input[value="Continue"]') // Confirm installation of dependencies.
.waitForElementVisible('.system-modules', 10000);
browser
.drupalRelativeURL('/admin/appearance')
.click('[title="Install Claro as default theme"]')
.waitForElementVisible('.system-themes-list', 10000); // Confirm installation.
});
browser
.drupalInstall()
.drupalInstallModule('form_test', true)
.drupalLoginAsAdmin(() => {
browser
.drupalRelativeURL('/admin/appearance')
.click('[title="Install Claro as default theme"]')
.waitForElementVisible('.system-themes-list', 10000); // Confirm installation.
});
},
after(browser) {
browser.drupalUninstall();

View File

@ -758,17 +758,7 @@ testScenarios.element = testScenarios.selector;
module.exports = {
'@tags': ['core'],
before(browser) {
browser.drupalInstall().drupalLoginAsAdmin(() => {
browser
.drupalRelativeURL('/admin/modules')
.setValue('input[type="search"]', 'position Shim Test')
.waitForElementVisible(
'input[name="modules[position_shim_test][enable]"]',
1000,
)
.click('input[name="modules[position_shim_test][enable]"]')
.click('input[type="submit"]');
});
browser.drupalInstall().drupalInstallModule('position_shim_test');
},
after(browser) {
browser.drupalUninstall();

View File

@ -1,17 +1,7 @@
module.exports = {
'@tags': ['core'],
before(browser) {
browser.drupalInstall().drupalLoginAsAdmin(() => {
browser
.drupalRelativeURL('/admin/modules')
.setValue('input[type="search"]', 'JS Deprecation test')
.waitForElementVisible(
'input[name="modules[js_deprecation_test][enable]"]',
1000,
)
.click('input[name="modules[js_deprecation_test][enable]"]')
.click('input[type="submit"]'); // Submit module form.
});
browser.drupalInstall().drupalInstallModule('js_deprecation_test');
},
after(browser) {
browser.drupalUninstall();

View File

@ -1,17 +1,7 @@
module.exports = {
'@tags': ['core'],
before(browser) {
browser.drupalInstall().drupalLoginAsAdmin(() => {
browser
.drupalRelativeURL('/admin/modules')
.setValue('input[type="search"]', 'JS Once Test')
.waitForElementVisible(
'input[name="modules[js_once_test][enable]"]',
1000,
)
.click('input[name="modules[js_once_test][enable]"]')
.click('input[type="submit"]'); // Submit module form.
});
browser.drupalInstall().drupalInstallModule('js_once_test');
},
after(browser) {
browser.drupalUninstall();

View File

@ -1,15 +1,7 @@
module.exports = {
'@tags': ['core'],
before(browser) {
browser.drupalInstall().drupalLoginAsAdmin(() => {
browser
.drupalRelativeURL('/admin/modules')
.setValue('input[type="search"]', 'FormAPI')
.waitForElementVisible('input[name="modules[form_test][enable]"]', 1000)
.click('input[name="modules[form_test][enable]"]')
.click('input[type="submit"]') // Submit module form.
.click('input[type="submit"]'); // Confirm installation of dependencies.
});
browser.drupalInstall().drupalInstallModule('form_test', true);
},
after(browser) {
browser.drupalUninstall();

View File

@ -258,17 +258,7 @@ const dialogIntegrationTestScenarios = [
module.exports = {
'@tags': ['core'],
before(browser) {
browser.drupalInstall().drupalLoginAsAdmin(() => {
browser
.drupalRelativeURL('/admin/modules')
.setValue('input[type="search"]', 'Tabbable Shim Test')
.waitForElementVisible(
'input[name="modules[tabbable_shim_test][enable]"]',
1000,
)
.click('input[name="modules[tabbable_shim_test][enable]"]')
.click('input[type="submit"]');
});
browser.drupalInstall().drupalInstallModule('tabbable_shim_test');
},
after(browser) {
browser.drupalUninstall();

View File

@ -1,17 +1,7 @@
module.exports = {
'@tags': ['core'],
before(browser) {
browser.drupalInstall().drupalLoginAsAdmin(() => {
browser
.drupalRelativeURL('/admin/modules')
.setValue('input[type="search"]', 'Tabbing Manager Test')
.waitForElementVisible(
'input[name="modules[tabbingmanager_test][enable]"]',
1000,
)
.click('input[name="modules[tabbingmanager_test][enable]"]')
.click('input[type="submit"]');
});
browser.drupalInstall().drupalInstallModule('tabbingmanager_test');
},
after(browser) {
browser.drupalUninstall();