From 41f0a93e7d603ca1fda0a049f47fe90970463a6b Mon Sep 17 00:00:00 2001 From: Yen Truong Date: Wed, 9 Jun 2021 16:19:47 -0400 Subject: [PATCH 1/5] add multilang testing to theme J=1363 --- test-site/config/locale_config.json | 6 ++++++ test-site/scripts/create-verticals.js | 2 +- tests/percy/index.js | 8 ++++++++ tests/percy/photographer.js | 10 ++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/test-site/config/locale_config.json b/test-site/config/locale_config.json index 5897cf38d..a381c2ac7 100644 --- a/test-site/config/locale_config.json +++ b/test-site/config/locale_config.json @@ -6,6 +6,12 @@ // "translationFile": ".po", // the filepath for the translation file // "urlOverride": "", // provide an override for the url path for this locale if you want it to be different than specified in the urlFormat object "experienceKey": "slanswers" // the unique key of your search configuration for this locale + }, + "es": { + // "fallback": [""], // allows you to specify locale fallbacks for this locale + // "translationFile": ".po", // the filepath for the translation file + // "urlOverride": "", // provide an override for the url path for this locale if you want it to be different than specified in the urlFormat object + "experienceKey": "slanswers-es" // the unique key of your search configuration for this locale } }, "urlFormat": { diff --git a/test-site/scripts/create-verticals.js b/test-site/scripts/create-verticals.js index 4dcdd4172..a56760f29 100644 --- a/test-site/scripts/create-verticals.js +++ b/test-site/scripts/create-verticals.js @@ -90,7 +90,7 @@ const testSiteDir = path.resolve(__dirname, '..'); process.chdir(testSiteDir); Object.entries(verticalConfiguration).forEach(([pageName, config]) => { - execSync(`npx jambo vertical --name ${pageName} --verticalKey ${config.verticalKey} --template ${config.template} --cardName ${config.cardName}`); + execSync(`npx jambo vertical --name ${pageName} --verticalKey ${config.verticalKey} --template ${config.template} --cardName ${config.cardName} --locales es`); configMerger.mergeConfigForPage(pageName); pagePatcher.applyPatchToPage(pageName); }); diff --git a/tests/percy/index.js b/tests/percy/index.js index 213426a03..684a0c72f 100644 --- a/tests/percy/index.js +++ b/tests/percy/index.js @@ -17,11 +17,19 @@ PercyScript.run(async (page, percySnapshot) => { const standardPageNavigator = new StandardPageNavigator(page, `http://localhost:${PORT}`); const iframePageNavigator = new IframePageNavigator(page, `http://localhost:${PORT}`, 'iframe_test'); + + const es_standardPageNavigator = new StandardPageNavigator(page, `http://localhost:${PORT}/es/`); + const es_iframePageNavigator = new IframePageNavigator(page, `http://localhost:${PORT}/es/`, 'iframe_test'); + const standardCamera = new Camera(percySnapshot); const iframeCamera = new Camera(percySnapshot, true); await (new Photographer(standardPageNavigator, standardCamera).captureSnapshots()); await (new Photographer(iframePageNavigator, iframeCamera).captureSnapshots()); + + await (new Photographer(es_standardPageNavigator, standardCamera).captureSnapshots()); + await (new Photographer(es_iframePageNavigator, iframeCamera).captureSnapshots()); + server.shutdown(); }); \ No newline at end of file diff --git a/tests/percy/photographer.js b/tests/percy/photographer.js index c8a14cae5..68d573153 100644 --- a/tests/percy/photographer.js +++ b/tests/percy/photographer.js @@ -23,6 +23,16 @@ class Photographer { await this._captureVerticalMapSearch(); await this._captureVerticalFullPageMapSearch(); await this._captureDirectAnswers(); + + await this._captureUniversalSearchES(); + } + + async _captureUniversalSearchES () { + await this._pageNavigator.gotoUniversalPage(); + await this._camera.snapshot('universal-search'); + + await this._pageNavigator.gotoUniversalPage({ query: 'a' }); + await this._camera.snapshot('universal-search--no-results'); } async _captureUniversalSearch () { From 4864645b30ac4bbef0dbd56f61652807ab381bc9 Mon Sep 17 00:00:00 2001 From: Yen Truong Date: Wed, 9 Jun 2021 16:45:02 -0400 Subject: [PATCH 2/5] percy snapshots --- test-site/config-overrides/events.es.json | 8 +++ test-site/config-overrides/people.es.json | 7 +++ .../pages-patches/people.es.htnl.hbs.patch | 50 +++++++++++++++++++ test-site/scripts/create-verticals.js | 2 + tests/percy/index.js | 13 ++--- tests/percy/photographer.js | 6 ++- 6 files changed, 78 insertions(+), 8 deletions(-) create mode 100644 test-site/config-overrides/events.es.json create mode 100644 test-site/config-overrides/people.es.json create mode 100644 test-site/pages-patches/people.es.htnl.hbs.patch diff --git a/test-site/config-overrides/events.es.json b/test-site/config-overrides/events.es.json new file mode 100644 index 000000000..1d847f823 --- /dev/null +++ b/test-site/config-overrides/events.es.json @@ -0,0 +1,8 @@ +{ + "pageTitle": "Eventos", + "verticalsToConfig": { + "events": { + "label": "Eventos" + } + } +} \ No newline at end of file diff --git a/test-site/config-overrides/people.es.json b/test-site/config-overrides/people.es.json new file mode 100644 index 000000000..61b706508 --- /dev/null +++ b/test-site/config-overrides/people.es.json @@ -0,0 +1,7 @@ +{ + "verticalsToConfig": { + "people": { + "label": "Pesonas" + } + } +} \ No newline at end of file diff --git a/test-site/pages-patches/people.es.htnl.hbs.patch b/test-site/pages-patches/people.es.htnl.hbs.patch new file mode 100644 index 000000000..6ece9f638 --- /dev/null +++ b/test-site/pages-patches/people.es.htnl.hbs.patch @@ -0,0 +1,50 @@ +--- people.es.html.hbs 2021-06-09 16:38:37.000000000 -0400 ++++ people.es.updated.html.hbs 2021-06-09 16:38:50.000000000 -0400 +@@ -1,7 +1,7 @@ + {{#> layouts/html }} + {{#> script/core }} + {{> cards/all }} +- {{!-- {{> templates/vertical-grid/collapsible-filters/page-setup }} --}} ++ {{> templates/vertical-grid/collapsible-filters/page-setup }} + {{> templates/vertical-grid/script/appliedfilters }} + {{> templates/vertical-grid/script/verticalresultscount }} + {{> templates/vertical-grid/script/searchbar }} +@@ -10,8 +10,8 @@ + {{> templates/vertical-grid/script/verticalresults }} + {{> templates/vertical-grid/script/pagination }} + {{> templates/vertical-grid/script/locationbias }} +- {{!-- {{> templates/vertical-grid/script/sortoptions }} --}} +- {{!-- {{> templates/vertical-grid/script/facets }} --}} ++ {{> templates/vertical-grid/script/sortoptions }} ++ {{> templates/vertical-grid/script/facets }} + {{!-- {{> templates/vertical-grid/script/filterbox }} --}} + {{!-- {{> templates/vertical-grid/script/qasubmission }} --}} + {{/script/core }} +@@ -30,8 +30,8 @@ +
+ {{> templates/vertical-grid/markup/verticalresultscount }} + {{> templates/vertical-grid/markup/appliedfilters }} +- {{!-- {{> templates/vertical-grid/collapsible-filters/markup/filterlink }} --}} +- {{!-- {{> templates/vertical-grid/collapsible-filters/markup/viewresultsbutton }} --}} ++ {{> templates/vertical-grid/collapsible-filters/markup/filterlink }} ++ {{> templates/vertical-grid/collapsible-filters/markup/viewresultsbutton }} +
+
+ {{> templates/vertical-grid/markup/spellcheck }} +@@ -40,11 +40,11 @@ + {{!-- {{> templates/vertical-grid/markup/qasubmission }} --}} +
+ +- {{!--
--}} +- {{!-- {{> templates/vertical-grid/markup/sortoptions }} --}} +- {{!-- {{> templates/vertical-grid/markup/filterbox }} --}} +- {{!-- {{> templates/vertical-grid/markup/facets }} --}} +- {{!--
--}} ++
++ {{> templates/vertical-grid/markup/sortoptions }} ++ {{> templates/vertical-grid/markup/filterbox }} ++ {{> templates/vertical-grid/markup/facets }} ++
+ + -