Problem/Motivation
When I install Drupal in a Nightwatch test using the command drupalInstall() with non-default language, like this:
browser.drupalInstall({ langcode: 'fr' })
- it takes 6+ times more time to install, compared to the default 'en' language!
This happens because Drupal downloads translations from the remote server for all non-en languages every time, which takes a lot of time.
But actually, in most cases, in the tests scope we don't need to download translations for the full Drupal Core, usually tests check translations only for their custom strings.
So, spending 30+ seconds each time to run each tests is not necessary, and disabling downloading translations will significantly increase tests with non-default language!
Also, it produces a lot of additional load to the ftp.drupal.org server.
Steps to reproduce
A Nightwatch test script to reproduce the problem:
module.exports = {
'Compare drupalInstall time with languages': async (browser) => {
let startTime;
startTime = new Date();
await browser.drupalInstall();
console.log(
`drupalInstall default time: ${(new Date() - startTime) / 1000} seconds`,
);
await browser.drupalUninstall();
startTime = new Date();
await browser.drupalInstall({ langcode: 'fr' });
console.log(
`drupalInstall fr time: ${(new Date() - startTime) / 1000} seconds`,
);
await browser.drupalUninstall();
startTime = new Date();
await browser.drupalInstall({ langcode: 'en' });
console.log(
`drupalInstall en time: ${(new Date() - startTime) / 1000} seconds`,
);
await browser.drupalUninstall();
startTime = new Date();
await browser.drupalInstall({ langcode: 'de' });
console.log(
`drupalInstall de time: ${(new Date() - startTime) / 1000} seconds`,
);
await browser.drupalUninstall();
},
};
And the output:
Running Compare drupalInstall time with languages:
───────────────────────────────────────────────────────────────────────────────────────────────────────────
ℹ Loaded url http://web in 154ms
drupalInstall default time: 5.603 seconds
ℹ Loaded url http://web in 117ms
drupalInstall fr time: 40.206 seconds
ℹ Loaded url http://web in 86ms
drupalInstall en time: 5.921 seconds
ℹ Loaded url http://web in 84ms
drupalInstall de time: 39.92 secondsProposed resolution
The proposed resolution is to disable downloading translations by default and provide a separate option to enable it only if needed.
Comments
Comment #2
murzThe Nightwatch command
drupalInstall()actually uses thescripts/test-site.phpto install Drupal, which provides no way to control the translation downloading feature (enable/disable).But the root cause of this issue is that the Drupal install system has an issue with forcing downloading translation even if the flag 'download_translation' is FALSE.
I reported a separate issue about this: #3482251: The 'download_translation' flag in install_state_defaults is not respected during install
Comment #3
murzComment #4
murzComment #5
cilefen commentedComment #6
quietone commentedThis would be fixed on 11.x first.
What is this postponed on? Is it #3482251: The 'download_translation' flag in install_state_defaults is not respected during install?