Unverified Commit b496f2d6 authored by lauriii's avatar lauriii
Browse files

Issue #3017176 by finnsky, mogtofu33, alexpott, huzooka, dawehner: Support...

Issue #3017176 by finnsky, mogtofu33, alexpott, huzooka, dawehner: Support install profile and language code params in drupalInstall Nightwatch command
parent 305c401f
......@@ -5,27 +5,36 @@ import { commandAsWebserver } from '../globals';
/**
* Installs a Drupal test site.
*
* @param {oject} [settings={}]
* @param {object} [settings={}]
* Settings object
* @param {string} [settings.setupFile='']
* Setup file used by TestSiteApplicationTest
* @param {string} [settings.installProfile='']
* The install profile to use.
* @param {string} [settings.langcode='']
* The language to install the site in.
* @param {function} callback
* A callback which will be called, when the installation is finished.
* @return {object}
* The 'browser' object.
*/
exports.command = function drupalInstall({ setupFile = '' } = {}, callback) {
exports.command = function drupalInstall(
{ setupFile = '', installProfile = 'nightwatch_testing', langcode = '' } = {},
callback,
) {
const self = this;
try {
setupFile = setupFile ? `--setup-file "${setupFile}"` : '';
installProfile = `--install-profile "${installProfile}"`;
const langcodeOption = langcode ? `--langcode "${langcode}"` : '';
const dbOption =
process.env.DRUPAL_TEST_DB_URL.length > 0
? `--db-url ${process.env.DRUPAL_TEST_DB_URL}`
: '';
const install = execSync(
commandAsWebserver(
`php ./scripts/test-site.php install ${setupFile} --install-profile nightwatch_testing --base-url ${process.env.DRUPAL_TEST_BASE_URL} ${dbOption} --json`,
`php ./scripts/test-site.php install ${setupFile} ${installProfile} ${langcodeOption} --base-url ${process.env.DRUPAL_TEST_BASE_URL} ${dbOption} --json`,
),
);
const installData = JSON.parse(install.toString());
......
module.exports = {
'@tags': ['core'],
before(browser) {
browser.drupalInstall({
setupFile: 'core/tests/Drupal/TestSite/TestSiteInstallTestScript.php',
installProfile: 'demo_umami',
});
},
after(browser) {
browser.drupalUninstall();
},
'Test umami profile': browser => {
browser
.drupalRelativeURL('/test-page')
.waitForElementVisible('body', 1000)
.assert.elementPresent('#block-umami-branding')
.drupalLogAndEnd({ onlyOnError: false });
},
};
module.exports = {
'@tags': ['core'],
before(browser) {
browser.drupalInstall({
setupFile: 'core/tests/Drupal/TestSite/TestSiteInstallTestScript.php',
langcode: 'fr',
});
},
after(browser) {
browser.drupalUninstall();
},
'Test page with langcode': browser => {
browser
.drupalRelativeURL('/test-page')
.assert.attributeEquals('html', 'lang', 'fr')
.drupalLogAndEnd({ onlyOnError: false });
},
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment