From 9f9019800a0b5ddee05ddbac6214bddb079cc14b Mon Sep 17 00:00:00 2001 From: Stephanie Hobson Date: Fri, 1 Sep 2023 11:27:53 -0700 Subject: [PATCH] WNP 118 (#13619) --- .../whatsnew/includes/fx118/arrow-blue.svg | 7 + .../whatsnew/includes/fx118/arrow-white.svg | 7 + .../includes/fx118/translate-icon.svg | 4 + .../firefox/whatsnew/whatsnew-fx118-de.html | 60 +++++++++ .../whatsnew/whatsnew-fx118-en-CA.html | 54 ++++++++ .../whatsnew/whatsnew-fx118-en-GB.html | 60 +++++++++ .../whatsnew/whatsnew-fx118-en-US.html | 54 ++++++++ .../firefox/whatsnew/whatsnew-fx118-fr.html | 60 +++++++++ bedrock/firefox/tests/test_base.py | 49 +++++++ bedrock/firefox/views.py | 19 +++ media/css/firefox/whatsnew/whatsnew-118.scss | 127 ++++++++++++++++++ media/js/firefox/whatsnew/whatsnew-118.es6.js | 79 +++++++++++ media/static-bundles.json | 12 ++ .../firefox/whatsnew/test_whatsnew_118.py | 23 ++++ tests/pages/firefox/whatsnew/whatsnew_118.py | 34 +++++ 15 files changed, 649 insertions(+) create mode 100644 bedrock/firefox/templates/firefox/whatsnew/includes/fx118/arrow-blue.svg create mode 100644 bedrock/firefox/templates/firefox/whatsnew/includes/fx118/arrow-white.svg create mode 100644 bedrock/firefox/templates/firefox/whatsnew/includes/fx118/translate-icon.svg create mode 100644 bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-de.html create mode 100644 bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-en-CA.html create mode 100644 bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-en-GB.html create mode 100644 bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-en-US.html create mode 100644 bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-fr.html create mode 100644 media/css/firefox/whatsnew/whatsnew-118.scss create mode 100644 media/js/firefox/whatsnew/whatsnew-118.es6.js create mode 100644 tests/functional/firefox/whatsnew/test_whatsnew_118.py create mode 100644 tests/pages/firefox/whatsnew/whatsnew_118.py diff --git a/bedrock/firefox/templates/firefox/whatsnew/includes/fx118/arrow-blue.svg b/bedrock/firefox/templates/firefox/whatsnew/includes/fx118/arrow-blue.svg new file mode 100644 index 00000000000..528a9d10878 --- /dev/null +++ b/bedrock/firefox/templates/firefox/whatsnew/includes/fx118/arrow-blue.svg @@ -0,0 +1,7 @@ + diff --git a/bedrock/firefox/templates/firefox/whatsnew/includes/fx118/arrow-white.svg b/bedrock/firefox/templates/firefox/whatsnew/includes/fx118/arrow-white.svg new file mode 100644 index 00000000000..a22c203b531 --- /dev/null +++ b/bedrock/firefox/templates/firefox/whatsnew/includes/fx118/arrow-white.svg @@ -0,0 +1,7 @@ + diff --git a/bedrock/firefox/templates/firefox/whatsnew/includes/fx118/translate-icon.svg b/bedrock/firefox/templates/firefox/whatsnew/includes/fx118/translate-icon.svg new file mode 100644 index 00000000000..9c68aeed583 --- /dev/null +++ b/bedrock/firefox/templates/firefox/whatsnew/includes/fx118/translate-icon.svg @@ -0,0 +1,4 @@ + diff --git a/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-de.html b/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-de.html new file mode 100644 index 00000000000..e38e71502f0 --- /dev/null +++ b/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-de.html @@ -0,0 +1,60 @@ +{# + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at https://mozilla.org/MPL/2.0/. + #} + +{% extends "firefox/whatsnew/base.html" %} + +{% block page_title %}What’s new with Firefox{% endblock %} + +{#- This will appear as which can be used for social share -#} +{% block page_og_desc %}{{ ftl('whatsnew-page-description') }}{% endblock %} + +{% block body_id %}firefox-whatsnew{% endblock %} + +{% block page_css %} + {{ css_bundle('firefox_whatsnew_118') }} +{% endblock %} + +{% block site_header %}{% endblock %} + + +{% block wnp_content %} +
+
+ + +

Sag Hola zu Firefox translations

+ +
+
+

Übersetze das Web lokal auf deinem Gerät, damit deine Daten sicher bleiben. Firefox hat jetzt einen eingebauten Übersetzer, damit du nie wieder eine Drittanbieter-App zum Übersetzen brauchst.

+

Klicke auf das {% include 'firefox/whatsnew/includes/fx118/translate-icon.svg' %} Icon in der Adressleiste von Firefox und genieße noch mehr Inhalte aus dem Web.

+ Jetzt ausprobieren +
+ +
+

Übersetze das Web lokal auf deinem Gerät, damit deine Daten sicher bleiben. Wenn du Firefox zu deinem Standardbrowser machst, brauchst du dank des eingebauten Übersetzers nie wieder eine andere App oder Website zum Übersetzen.

+ Mach Firefox zum Standardbrowser +
+
+ +
+ +
+{% endblock %} + +{% block js %} + {{ js_bundle('firefox_whatsnew_update') }} + {{ js_bundle('firefox_whatsnew_118') }} +{% endblock %} diff --git a/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-en-CA.html b/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-en-CA.html new file mode 100644 index 00000000000..2a6f340456b --- /dev/null +++ b/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-en-CA.html @@ -0,0 +1,54 @@ +{# + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at https://mozilla.org/MPL/2.0/. + #} + +{% extends "firefox/whatsnew/base.html" %} + +{% block page_title %}What’s new with Firefox{% endblock %} + +{#- This will appear as which can be used for social share -#} +{% block page_og_desc %}{{ ftl('whatsnew-page-description') }}{% endblock %} + +{% block body_id %}firefox-whatsnew{% endblock %} + +{% block page_css %} + {{ css_bundle('firefox_whatsnew_118') }} +{% endblock %} + +{% block site_header %}{% endblock %} + + +{% block wnp_content %} +
+
+ + +

Say ‘Bonjour’ to Firefox translations

+ +

Translate the web within Firefox, so your data stays safe.

+ +

Click the {% include 'firefox/whatsnew/includes/fx118/translate-icon.svg' %} icon in Firefox’s address bar and enjoy content across the web.

+ +

+ Try it now +

+ +
+ +
+{% endblock %} + +{% block js %} + {{ js_bundle('firefox_whatsnew_update') }} +{% endblock %} diff --git a/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-en-GB.html b/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-en-GB.html new file mode 100644 index 00000000000..c6cec688457 --- /dev/null +++ b/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-en-GB.html @@ -0,0 +1,60 @@ +{# + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at https://mozilla.org/MPL/2.0/. + #} + +{% extends "firefox/whatsnew/base.html" %} + +{% block page_title %}What’s new with Firefox{% endblock %} + +{#- This will appear as which can be used for social share -#} +{% block page_og_desc %}{{ ftl('whatsnew-page-description') }}{% endblock %} + +{% block body_id %}firefox-whatsnew{% endblock %} + +{% block page_css %} + {{ css_bundle('firefox_whatsnew_118') }} +{% endblock %} + +{% block site_header %}{% endblock %} + + +{% block wnp_content %} +
+
+ + +

Say ‘Bonjour’ to Firefox translations

+ +
+
+

Translate the web locally, so your data stays safe. Firefox now comes with an integrated translation tool, so you never have to use a third-party app again.

+

Click the {% include 'firefox/whatsnew/includes/fx118/translate-icon.svg' %} in Firefox’s address bar and enjoy content from around the world.

+ Try it now +
+ +
+

Translate the web locally, so your data stays safe. Our translation tool is now integrated in Firefox, so by setting it as your default browser, you’d never have to use another app or website again.

+ Set Firefox as your default browser +
+
+ +
+ +
+{% endblock %} + +{% block js %} + {{ js_bundle('firefox_whatsnew_update') }} + {{ js_bundle('firefox_whatsnew_118') }} +{% endblock %} diff --git a/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-en-US.html b/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-en-US.html new file mode 100644 index 00000000000..73af3884313 --- /dev/null +++ b/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-en-US.html @@ -0,0 +1,54 @@ +{# + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at https://mozilla.org/MPL/2.0/. + #} + +{% extends "firefox/whatsnew/base.html" %} + +{% block page_title %}What’s new with Firefox{% endblock %} + +{#- This will appear as which can be used for social share -#} +{% block page_og_desc %}{{ ftl('whatsnew-page-description') }}{% endblock %} + +{% block body_id %}firefox-whatsnew{% endblock %} + +{% block page_css %} + {{ css_bundle('firefox_whatsnew_118') }} +{% endblock %} + +{% block site_header %}{% endblock %} + + +{% block wnp_content %} +
+
+ + +

Say ‘Hola’ to Firefox translations

+ +

Translate the web within Firefox, so your data stays safe.

+ +

Click the {% include 'firefox/whatsnew/includes/fx118/translate-icon.svg' %} icon in Firefox’s address bar and enjoy content across the web.

+ +

+ Try it now +

+ +
+ +
+{% endblock %} + +{% block js %} + {{ js_bundle('firefox_whatsnew_update') }} +{% endblock %} diff --git a/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-fr.html b/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-fr.html new file mode 100644 index 00000000000..2f239e5c16b --- /dev/null +++ b/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx118-fr.html @@ -0,0 +1,60 @@ +{# + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at https://mozilla.org/MPL/2.0/. + #} + +{% extends "firefox/whatsnew/base.html" %} + +{% block page_title %}What’s new with Firefox{% endblock %} + +{#- This will appear as which can be used for social share -#} +{% block page_og_desc %}{{ ftl('whatsnew-page-description') }}{% endblock %} + +{% block body_id %}firefox-whatsnew{% endblock %} + +{% block page_css %} + {{ css_bundle('firefox_whatsnew_118') }} +{% endblock %} + +{% block site_header %}{% endblock %} + + +{% block wnp_content %} +
+
+ + +

Dites ‘Hello’ à Firefox translations

+ +
+
+

Traduisez le web localement, pour que vos données restent sécurisées. Firefox est désormais doté d’un outil de traduction intégré, de sorte que vous n'aurez plus jamais besoin d'utiliser d’application tierce.

+

Cliquez sur l'icône {% include 'firefox/whatsnew/includes/fx118/translate-icon.svg' %} dans la barre d'adresse de Firefox et profitez de plus de contenu sur le Web.

+ Essayer maintenant +
+ +
+

Traduisez le web localement, pour que vos données restent sécurisées. En faisant de Firefox votre navigateur par défaut, profitez de son outil de traduction intégré sans plus avoir jamais besoin d'utiliser d’application tierce.

+ Faire de Firefox votre navigateur par défaut +
+
+ +
+ +
+{% endblock %} + +{% block js %} + {{ js_bundle('firefox_whatsnew_update') }} + {{ js_bundle('firefox_whatsnew_118') }} +{% endblock %} diff --git a/bedrock/firefox/tests/test_base.py b/bedrock/firefox/tests/test_base.py index 100c859a7dd..a5aedc8853c 100644 --- a/bedrock/firefox/tests/test_base.py +++ b/bedrock/firefox/tests/test_base.py @@ -696,6 +696,55 @@ def test_fx_117_0_0_en_us_cn(self, render_mock): # end 117.0 whatsnew tests + # begin 118.0 whatsnew tests + + @override_settings(DEV=True) + def test_fx_118_0_0_en_us(self, render_mock): + """Should use whatsnew-fx118-en template for en-US locale""" + req = self.rf.get("/firefox/whatsnew/") + req.locale = "en-US" + self.view(req, version="118.0") + template = render_mock.call_args[0][1] + assert template == ["firefox/whatsnew/whatsnew-fx118-en-US.html"] + + @override_settings(DEV=True) + def test_fx_118_0_0_en_gb(self, render_mock): + """Should use whatsnew-fx118-uk template for en-GB locale""" + req = self.rf.get("/firefox/whatsnew/") + req.locale = "en-GB" + self.view(req, version="118.0") + template = render_mock.call_args[0][1] + assert template == ["firefox/whatsnew/whatsnew-fx118-en-GB.html"] + + @override_settings(DEV=True) + def test_fx_118_0_0_en_us_gb(self, render_mock): + """Should use whatsnew-fx118-uk template for en-US locale if country is GB""" + req = self.rf.get("/firefox/whatsnew/", HTTP_CF_IPCOUNTRY="GB") + req.locale = "en-US" + self.view(req, version="118.0") + template = render_mock.call_args[0][1] + assert template == ["firefox/whatsnew/whatsnew-fx118-en-GB.html"] + + @override_settings(DEV=True) + def test_fx_118_0_0_de(self, render_mock): + """Should use whatsnew-fx118-de template for de locale""" + req = self.rf.get("/firefox/whatsnew/") + req.locale = "de" + self.view(req, version="118.0") + template = render_mock.call_args[0][1] + assert template == ["firefox/whatsnew/whatsnew-fx118-de.html"] + + @override_settings(DEV=True) + def test_fx_118_0_0_fr(self, render_mock): + """Should use whatsnew-fx118-fr template for fr locale""" + req = self.rf.get("/firefox/whatsnew/") + req.locale = "fr" + self.view(req, version="118.0") + template = render_mock.call_args[0][1] + assert template == ["firefox/whatsnew/whatsnew-fx118-fr.html"] + + # end 118.0 whatsnew tests + @patch("bedrock.firefox.views.l10n_utils.render", return_value=HttpResponse()) class TestFirstRun(TestCase): diff --git a/bedrock/firefox/views.py b/bedrock/firefox/views.py index f01a8be54a8..1d8b89e608b 100644 --- a/bedrock/firefox/views.py +++ b/bedrock/firefox/views.py @@ -414,6 +414,11 @@ class WhatsnewView(L10nTemplateView): "firefox/whatsnew/whatsnew-fx117-uk-reader-view.html": ["firefox/whatsnew/whatsnew"], "firefox/whatsnew/whatsnew-fx117-vpn.html": ["firefox/whatsnew/whatsnew"], "firefox/whatsnew/whatsnew-fx117-na-relay.html": ["firefox/whatsnew/whatsnew"], + "firefox/whatsnew/whatsnew-fx118-en-GB.html": ["firefox/whatsnew/whatsnew"], + "firefox/whatsnew/whatsnew-fx118-en-US.html": ["firefox/whatsnew/whatsnew"], + "firefox/whatsnew/whatsnew-fx118-en-CA.html": ["firefox/whatsnew/whatsnew"], + "firefox/whatsnew/whatsnew-fx118-de.html": ["firefox/whatsnew/whatsnew"], + "firefox/whatsnew/whatsnew-fx118-fr.html": ["firefox/whatsnew/whatsnew"], } # specific templates that should not be rendered in @@ -510,6 +515,20 @@ def get_template_names(self): template = "firefox/developer/whatsnew.html" else: template = "firefox/whatsnew/index.html" + elif version.startswith("118."): + if locale.startswith("en-"): + if locale == "en-GB" or country == "GB": + template = "firefox/whatsnew/whatsnew-fx118-en-GB.html" + elif locale == "en-CA" or country == "CA": + template = "firefox/whatsnew/whatsnew-fx118-en-CA.html" + else: + template = "firefox/whatsnew/whatsnew-fx118-en-US.html" + elif locale == "de": + template = "firefox/whatsnew/whatsnew-fx118-de.html" + elif locale == "fr": + template = "firefox/whatsnew/whatsnew-fx118-fr.html" + else: + template = "firefox/whatsnew/index.html" elif version.startswith("117."): if country in WNP117_VPN_EXPANSION_COUNTRIES: template = "firefox/whatsnew/whatsnew-fx117-vpn.html" diff --git a/media/css/firefox/whatsnew/whatsnew-118.scss b/media/css/firefox/whatsnew/whatsnew-118.scss new file mode 100644 index 00000000000..333ab220e8f --- /dev/null +++ b/media/css/firefox/whatsnew/whatsnew-118.scss @@ -0,0 +1,127 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +@import 'includes/base'; +@import '~@mozilla-protocol/core/protocol/css/includes/lib'; +@import '~@mozilla-protocol/core/protocol/css/components/notification-bar'; + +.wnp-content-main { + background: $color-yellow-20; + text-align: center; +} + +.wnp-swap { + margin-bottom: $layout-md; +} + +.wnp-swap-blurb-here { + text-align: right; + padding-right: calc(50% + $spacing-sm); + padding-bottom: $spacing-md; + position: relative; +} + +.wnp-swap-blurb-there { + text-align: left; + padding-left: calc(50% + $spacing-sm); + position: relative; +} + +.wnp-swap-text-here, +.wnp-swap-text-there { + @include font-firefox; + display: inline-block; + position: relative; + background-color: $color-white; + padding: $spacing-md; + border-radius: $border-radius-sm; + font-weight: bold; + + &::after { + content: ''; + display: block; + position: absolute; + top: 100%; + left: 10px; + border: 10px solid transparent; + border-top-color: $color-white; + border-left-width: 3px; + } +} + +.wnp-swap-text-there { + bottom: 0; + right: 0; + background-color: #0290EE; + color: $color-white; + + &::after { + left: auto; + right: 10px; + border-top-color: #0290EE; + border-left-width: 10px; + border-right-width: 3px; + } +} + +#arrow-here { + position: absolute; + top: 100%; + right: calc(50% + $spacing-sm); +} + +#arrow-there { + position: absolute; + bottom: calc(100% + 10px); + left: calc(50% + $spacing-sm); +} + +#translate-icon { + vertical-align: bottom; +} + +#wnp-cta { + position: relative; +} + +#cta-default { + position: absolute; + top:0; + left: 0; +} + +#cta-try, +#cta-default { + visibility: hidden; + opacity: 0; +} + +.no-js .is-firefox-default, +.is-firefox-default { + #cta-try { + visibility: visible; + animation: fade-in 150ms ease forwards; + } +} + +.fx-not-default { + #cta-default { + visibility: visible; + animation: fade-in 150ms ease forwards; + } +} + + +@keyframes fade-in { + from { opacity: 0; } + to { opacity: 1; } +} + +html[lang='de'], +html[lang='fr'], +html[lang='en-GB'] { + .c-utilities { + display: none; + } +} diff --git a/media/js/firefox/whatsnew/whatsnew-118.es6.js b/media/js/firefox/whatsnew/whatsnew-118.es6.js new file mode 100644 index 00000000000..e72d93a6fb3 --- /dev/null +++ b/media/js/firefox/whatsnew/whatsnew-118.es6.js @@ -0,0 +1,79 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +const FirefoxDefault = { + isDefaultBrowser: () => { + return new window.Promise((resolve, reject) => { + FirefoxDefault.tourTimeout = setTimeout(function () { + // UITour was too slow to reply + FirefoxDefault.showAltCTAButton(); + resolve(); + }, 1000); + Mozilla.UITour.getConfiguration('appinfo', (details) => { + if (details.defaultBrowser) { + // UITour reports Firefox is default browser + FirefoxDefault.showAltCTAButton(); + resolve(); + } else { + // UITour reports Firefox is not default browser + FirefoxDefault.showSetDefaultButton(); + reject(); + } + }); + }); + }, + + isSupported: () => { + return Mozilla.Client._isFirefoxDesktop() && 'Promise' in window; + }, + + showSetDefaultButton: () => { + clearTimeout(FirefoxDefault.tourTimeout); + document.querySelector('main').classList.add('fx-not-default'); + + window.dataLayer.push({ + event: 'non-interaction', + eAction: 'whatsnew-118', + eLabel: 'firefox-not-default' + }); + }, + + showAltCTAButton: () => { + clearTimeout(FirefoxDefault.tourTimeout); + document.querySelector('main').classList.add('is-firefox-default'); + + window.dataLayer.push({ + event: 'non-interaction', + eAction: 'whatsnew-118', + eLabel: 'firefox-default' + }); + }, + + init: () => { + if (!FirefoxDefault.isSupported()) { + // not firefox + document.querySelector('main').classList.add('fx-not-default'); + return; + } + return new window.Promise(function (resolve, reject) { + FirefoxDefault.isDefaultBrowser() + .then( + function () { + FirefoxDefault.showAltCTAButton(); + resolve(); + }, + function () { + document; + FirefoxDefault.showSetDefaultButton(); + resolve(); + } + ) + .catch(() => reject()); + }); + } +}; + +FirefoxDefault.init(); diff --git a/media/static-bundles.json b/media/static-bundles.json index ceeb5a000aa..6bd3e525948 100644 --- a/media/static-bundles.json +++ b/media/static-bundles.json @@ -460,6 +460,12 @@ ], "name": "firefox_whatsnew_117_na_relay" }, + { + "files": [ + "css/firefox/whatsnew/whatsnew-118.scss" + ], + "name": "firefox_whatsnew_118" + }, { "files": [ "css/firefox/privacy/common.scss" @@ -1651,6 +1657,12 @@ ], "name": "firefox_whatsnew_117_experiment_na_vpn_relay" }, + { + "files": [ + "js/firefox/whatsnew/whatsnew-118.es6.js" + ], + "name": "firefox_whatsnew_118" + }, { "files": [ "js/firefox/privacy/products.js" diff --git a/tests/functional/firefox/whatsnew/test_whatsnew_118.py b/tests/functional/firefox/whatsnew/test_whatsnew_118.py new file mode 100644 index 00000000000..b7d697e0f25 --- /dev/null +++ b/tests/functional/firefox/whatsnew/test_whatsnew_118.py @@ -0,0 +1,23 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +import pytest + +from pages.firefox.whatsnew.whatsnew_118 import FirefoxWhatsNew118Page + + +@pytest.mark.skip_if_not_firefox(reason="Whatsnew pages are shown to Firefox only.") +@pytest.mark.nondestructive +@pytest.mark.parametrize("locale", [("de"), ("fr"), ("en-GB")]) +def test_firefox_alt_cta_button_displayed(locale, base_url, selenium): + page = FirefoxWhatsNew118Page(selenium, base_url, locale=locale).open() + assert page.is_firefox_alt_cta_button_displayed + + +@pytest.mark.skip_if_not_firefox(reason="Whatsnew pages are shown to Firefox only.") +@pytest.mark.nondestructive +@pytest.mark.parametrize("locale", [("en-US"), ("en-CA")]) +def test_firefox_try_it_button_displayed(locale, base_url, selenium): + page = FirefoxWhatsNew118Page(selenium, base_url, locale=locale).open() + assert page.is_try_it_button_displayed diff --git a/tests/pages/firefox/whatsnew/whatsnew_118.py b/tests/pages/firefox/whatsnew/whatsnew_118.py new file mode 100644 index 00000000000..4448efe7cd1 --- /dev/null +++ b/tests/pages/firefox/whatsnew/whatsnew_118.py @@ -0,0 +1,34 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +from time import sleep + +from selenium.webdriver.common.by import By + +from pages.base import BasePage + + +class FirefoxWhatsNew118Page(BasePage): + _URL_TEMPLATE = "/{locale}/firefox/118.0/whatsnew/" + + # EU pages + _set_alt_cta_button_locator = (By.CSS_SELECTOR, "#cta-try .mzp-c-button") + # NA pages + _set_try_it_button_locator = (By.ID, "cta-now") + + def wait_for_page_to_load(self): + self.wait.until(lambda s: self.seed_url in s.current_url) + el = self.find_element(By.TAG_NAME, "html") + self.wait.until(lambda s: "loaded" in el.get_attribute("class")) + # EU pages UI Tour call will time out at 1 second, NA pages don't have UI Tour call + sleep(1.2) + return self + + @property + def is_firefox_alt_cta_button_displayed(self): + return self.is_element_displayed(*self._set_alt_cta_button_locator) + + @property + def is_try_it_button_displayed(self): + return self.is_element_displayed(*self._set_try_it_button_locator)