diff --git a/addons/website/static/tests/tours/configurator_translation.js b/addons/website/static/tests/tours/configurator_translation.js index eb19800f388..e43df05729a 100644 --- a/addons/website/static/tests/tours/configurator_translation.js +++ b/addons/website/static/tests/tours/configurator_translation.js @@ -48,7 +48,7 @@ registry.category("web_tour.tours").add('configurator_translation', { // Features screen { content: "select confidentialité", - trigger: '.card:contains(confidentialité)', + trigger: '.card:contains(Parseltongue_privacy)', }, { content: "Click on build my website", trigger: 'button.btn-primary', @@ -62,16 +62,10 @@ registry.category("web_tour.tours").add('configurator_translation', { timeout: 30000, }, { // Check the content of the save button to make sure the website is in - // French. (The editor should be in the website's default language, - // which should be french in this test.) - // Also note that sometimes the translation is being changed on - // Transifex from "Sauvegarder" to "Sauver" or the other way around. - // TODO: Strengthen this tour by creating a new fake language and some - // translations for the checked terms. See what's done in `Sign` - // `test_translate_sign_instructions` tour with the `Parseltongue` - // language. + // Parseltongue. (The editor should be in the website's default language, + // which should be parseltongue in this test.) content: "exit edit mode", - trigger: '.o_we_website_top_actions button.btn-primary:contains("Sauvegarder"), .o_we_website_top_actions button.btn-primary:contains("Sauver")', + trigger: '.o_we_website_top_actions button.btn-primary:contains("Save_Parseltongue")', }, { content: "wait for editor to be closed", trigger: 'iframe body:not(.editor_enable)', diff --git a/addons/website/tests/test_configurator.py b/addons/website/tests/test_configurator.py index 8b3d21fdea1..2922e7ef996 100644 --- a/addons/website/tests/test_configurator.py +++ b/addons/website/tests/test_configurator.py @@ -19,7 +19,7 @@ class TestConfiguratorCommon(odoo.tests.HttpCase): params = kwargs.get('params', {}) language = params.get('lang', 'en_US') if endpoint.endswith('/api/website/1/configurator/industries'): - if language == 'fr_FR': + if language in ('fr_FR', 'pa_GB'): return {"industries": [ {"id": 1, "label": "abbey in fr"}, {"id": 2, "label": "aboriginal and torres strait islander organisation in fr"}, @@ -50,16 +50,27 @@ class TestConfiguratorCommon(odoo.tests.HttpCase): class TestConfiguratorTranslation(TestConfiguratorCommon): def test_01_configurator_translation(self): + parseltongue = self.env['res.lang'].create({ + 'name': 'Parseltongue', + 'code': 'pa_GB', + 'iso_code': 'pa_GB', + 'url_code': 'pa_GB', + }) self.env["base.language.install"].create({ 'overwrite': True, - 'lang_ids': [(6, 0, [self.env.ref('base.lang_fr').id])], + 'lang_ids': [(6, 0, [parseltongue.id])], }).lang_install() feature = self.env['website.configurator.feature'].search([('name', '=', 'Privacy Policy')]) - feature.with_context(lang='fr_FR').write({'name': 'Politique de confidentialité'}) - self.env.ref('base.user_admin').write({'lang': self.env.ref('base.lang_fr').code}) + feature.with_context(lang=parseltongue.code).write({'name': 'Parseltongue_privacy'}) + self.env.ref('base.user_admin').write({'lang': parseltongue.code}) website_fr = self.env['website'].create({ 'name': "New website", }) + self.env.ref('web_editor.snippets').update_field_translations('arch_db', { + parseltongue.code: { + 'Save': 'Save_Parseltongue' + } + }) # disable configurator todo to ensure this test goes through active_todo = self.env['ir.actions.todo'].search([('state', '=', 'open')], limit=1) active_todo.update({'state': 'done'})