From 88f6723a930a1cfbf8a8590b3eaa4fe315dcb6f7 Mon Sep 17 00:00:00 2001 From: Alex Gibson Date: Thu, 14 Mar 2024 22:07:27 +0000 Subject: [PATCH] Remove sticky promo component from pages (Fixes #14120) (#14121) --- bedrock/base/templates/base-protocol.html | 2 - .../base/templates/includes/sticky-promo.html | 43 ------ .../firefox/browsers/best-browser.html | 10 +- .../firefox/browsers/browser-history.html | 10 +- .../firefox/browsers/compare/brave.html | 6 - .../firefox/browsers/compare/chrome.html | 6 - .../firefox/browsers/compare/edge.html | 6 - .../firefox/browsers/compare/index.html | 10 +- .../firefox/browsers/compare/opera.html | 6 - .../firefox/browsers/compare/safari.html | 6 - .../firefox/browsers/incognito-browser.html | 10 +- .../templates/firefox/browsers/index.html | 4 - .../firefox/browsers/mobile/index.html | 4 - .../templates/firefox/browsers/quantum.html | 10 +- .../firefox/browsers/what-is-a-browser.html | 10 -- .../templates/firefox/home/index-master.html | 4 - .../firefox/new/desktop/download.html | 4 - .../templates/firefox/releases/notes.html | 11 -- bedrock/settings/base.py | 1 - docs/attribution/0001-analytics.rst | 2 +- l10n/en/firefox/sticky-promo.ftl | 21 --- media/css/firefox/browsers-products.scss | 1 - media/css/firefox/home/master.scss | 1 - media/css/firefox/new/desktop/download.scss | 1 - media/css/firefox/sticky-promo.scss | 79 ---------- media/js/firefox/sticky-promo.es6.js | 141 ------------------ media/static-bundles.json | 24 --- .../firefox/new/test_sticky_promo.py | 16 -- tests/functional/firefox/test_home.py | 9 -- tests/pages/firefox/home.py | 24 +-- tests/pages/firefox/new/sticky_promo.py | 31 ---- tests/pages/regions/sticky_promo.py | 23 --- 32 files changed, 7 insertions(+), 529 deletions(-) delete mode 100644 bedrock/base/templates/includes/sticky-promo.html delete mode 100644 l10n/en/firefox/sticky-promo.ftl delete mode 100644 media/css/firefox/sticky-promo.scss delete mode 100644 media/js/firefox/sticky-promo.es6.js delete mode 100644 tests/functional/firefox/new/test_sticky_promo.py delete mode 100644 tests/pages/firefox/new/sticky_promo.py delete mode 100644 tests/pages/regions/sticky_promo.py diff --git a/bedrock/base/templates/base-protocol.html b/bedrock/base/templates/base-protocol.html index c2c76a343f..3a31d411cd 100644 --- a/bedrock/base/templates/base-protocol.html +++ b/bedrock/base/templates/base-protocol.html @@ -107,8 +107,6 @@ {% endwith %} {% endblock %} - {% block sticky_promo %}{% endblock %} - {# Banner is last in HTML as it's low priority for search engines and uses `data-nosnippet` (issue #8739) #} {% block page_banner %}{% endblock %} diff --git a/bedrock/base/templates/includes/sticky-promo.html b/bedrock/base/templates/includes/sticky-promo.html deleted file mode 100644 index 1f058cfe55..0000000000 --- a/bedrock/base/templates/includes/sticky-promo.html +++ /dev/null @@ -1,43 +0,0 @@ -{# - 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/. -#} - -{% set promo_referrals = '?utm_source=www.mozilla.org&utm_medium=referral&utm_campaign=sticky-promo' %} -{% if ftl_has_messages('firefox-sticky-promo-get-the-latest-firefox', 'firefox-sticky-promo-meet-our-family-of') %} - -{% endif %} diff --git a/bedrock/firefox/templates/firefox/browsers/best-browser.html b/bedrock/firefox/templates/firefox/browsers/best-browser.html index 281173a49d..ad053b0fe4 100644 --- a/bedrock/firefox/templates/firefox/browsers/best-browser.html +++ b/bedrock/firefox/templates/firefox/browsers/best-browser.html @@ -133,12 +133,4 @@ {% endblock %} -{% block sticky_promo %} - {% with non_fx_only=True %} - {% include '/includes/sticky-promo.html' %} - {% endwith %} -{% endblock %} - -{% block js %} - {{ js_bundle('sticky_promo') }} -{% endblock %} +{% block js %}{% endblock %} diff --git a/bedrock/firefox/templates/firefox/browsers/browser-history.html b/bedrock/firefox/templates/firefox/browsers/browser-history.html index 25d3925765..08e4900b62 100644 --- a/bedrock/firefox/templates/firefox/browsers/browser-history.html +++ b/bedrock/firefox/templates/firefox/browsers/browser-history.html @@ -121,12 +121,4 @@ {% endblock %} -{% block sticky_promo %} - {% with non_fx_only=True %} - {% include '/includes/sticky-promo.html' %} - {% endwith %} -{% endblock %} - -{% block js %} - {{ js_bundle('sticky_promo') }} -{% endblock %} +{% block js %}{% endblock %} diff --git a/bedrock/firefox/templates/firefox/browsers/compare/brave.html b/bedrock/firefox/templates/firefox/browsers/compare/brave.html index a5aa185fb4..010da1d9a2 100644 --- a/bedrock/firefox/templates/firefox/browsers/compare/brave.html +++ b/bedrock/firefox/templates/firefox/browsers/compare/brave.html @@ -294,12 +294,6 @@ {% endblock %} -{% block sticky_promo %} - {% with non_fx_only=True %} - {% include '/includes/sticky-promo.html' %} - {% endwith %} -{% endblock %} - {% block js %} {{ js_bundle('firefox_compare_details') }} {% endblock %} diff --git a/bedrock/firefox/templates/firefox/browsers/compare/chrome.html b/bedrock/firefox/templates/firefox/browsers/compare/chrome.html index 147f0ddd5d..f9da22e246 100644 --- a/bedrock/firefox/templates/firefox/browsers/compare/chrome.html +++ b/bedrock/firefox/templates/firefox/browsers/compare/chrome.html @@ -286,12 +286,6 @@ {% endblock %} -{% block sticky_promo %} - {% with non_fx_only=True %} - {% include '/includes/sticky-promo.html' %} - {% endwith %} -{% endblock %} - {% block js %} {{ js_bundle('firefox_compare_details') }} {% endblock %} diff --git a/bedrock/firefox/templates/firefox/browsers/compare/edge.html b/bedrock/firefox/templates/firefox/browsers/compare/edge.html index be18a2da8b..e1c303c433 100644 --- a/bedrock/firefox/templates/firefox/browsers/compare/edge.html +++ b/bedrock/firefox/templates/firefox/browsers/compare/edge.html @@ -273,12 +273,6 @@ {% endblock %} -{% block sticky_promo %} - {% with non_fx_only=True %} - {% include '/includes/sticky-promo.html' %} - {% endwith %} -{% endblock %} - {% block js %} {{ js_bundle('firefox_compare_details') }} {% endblock %} diff --git a/bedrock/firefox/templates/firefox/browsers/compare/index.html b/bedrock/firefox/templates/firefox/browsers/compare/index.html index c7a8593ad0..a4f5bed5a6 100644 --- a/bedrock/firefox/templates/firefox/browsers/compare/index.html +++ b/bedrock/firefox/templates/firefox/browsers/compare/index.html @@ -381,12 +381,4 @@ {% endblock %} -{% block sticky_promo %} - {% with non_fx_only=True %} - {% include '/includes/sticky-promo.html' %} - {% endwith %} -{% endblock %} - -{% block js %} - {{ js_bundle('sticky_promo') }} -{% endblock %} +{% block js %}{% endblock %} diff --git a/bedrock/firefox/templates/firefox/browsers/compare/opera.html b/bedrock/firefox/templates/firefox/browsers/compare/opera.html index 7c6c3dd178..e21dee505f 100644 --- a/bedrock/firefox/templates/firefox/browsers/compare/opera.html +++ b/bedrock/firefox/templates/firefox/browsers/compare/opera.html @@ -270,12 +270,6 @@ {% endblock %} -{% block sticky_promo %} - {% with non_fx_only=True %} - {% include '/includes/sticky-promo.html' %} - {% endwith %} -{% endblock %} - {% block js %} {{ js_bundle('firefox_compare_details') }} {% endblock %} diff --git a/bedrock/firefox/templates/firefox/browsers/compare/safari.html b/bedrock/firefox/templates/firefox/browsers/compare/safari.html index ab9e6c27ca..9ba1828f30 100644 --- a/bedrock/firefox/templates/firefox/browsers/compare/safari.html +++ b/bedrock/firefox/templates/firefox/browsers/compare/safari.html @@ -278,12 +278,6 @@ {% endblock %} -{% block sticky_promo %} - {% with non_fx_only=True %} - {% include '/includes/sticky-promo.html' %} - {% endwith %} -{% endblock %} - {% block js %} {{ js_bundle('firefox_compare_details') }} {% endblock %} diff --git a/bedrock/firefox/templates/firefox/browsers/incognito-browser.html b/bedrock/firefox/templates/firefox/browsers/incognito-browser.html index 6dc7c8e000..5f1a2fae96 100644 --- a/bedrock/firefox/templates/firefox/browsers/incognito-browser.html +++ b/bedrock/firefox/templates/firefox/browsers/incognito-browser.html @@ -202,12 +202,4 @@ {% endblock %} -{% block sticky_promo %} - {% with non_fx_only=True %} - {% include '/includes/sticky-promo.html' %} - {% endwith %} -{% endblock %} - -{% block js %} - {{ js_bundle('sticky_promo') }} -{% endblock %} +{% block js %}{% endblock %} diff --git a/bedrock/firefox/templates/firefox/browsers/index.html b/bedrock/firefox/templates/firefox/browsers/index.html index 4000aeb1e7..92970d44e2 100644 --- a/bedrock/firefox/templates/firefox/browsers/index.html +++ b/bedrock/firefox/templates/firefox/browsers/index.html @@ -180,10 +180,6 @@ {% endblock %} -{% block sticky_promo %} - {% include '/includes/sticky-promo.html' %} -{% endblock %} - {% block js %} {{ js_bundle('fxa_form') }} {{ js_bundle('firefox-browsers-products') }} diff --git a/bedrock/firefox/templates/firefox/browsers/mobile/index.html b/bedrock/firefox/templates/firefox/browsers/mobile/index.html index 5c1461f7c1..a2bda63c8d 100644 --- a/bedrock/firefox/templates/firefox/browsers/mobile/index.html +++ b/bedrock/firefox/templates/firefox/browsers/mobile/index.html @@ -161,10 +161,6 @@ {% endblock %} -{% block sticky_promo %} - {% include '/includes/sticky-promo.html' %} -{% endblock %} - {% block js %} {{ js_bundle('fxa_form') }} {{ js_bundle('firefox-browsers-products') }} diff --git a/bedrock/firefox/templates/firefox/browsers/quantum.html b/bedrock/firefox/templates/firefox/browsers/quantum.html index eeaacec13e..519c9967c5 100644 --- a/bedrock/firefox/templates/firefox/browsers/quantum.html +++ b/bedrock/firefox/templates/firefox/browsers/quantum.html @@ -90,12 +90,4 @@ {% endblock %} -{% block sticky_promo %} - {% with non_fx_only=True %} - {% include '/includes/sticky-promo.html' %} - {% endwith %} -{% endblock %} - -{% block js %} - {{ js_bundle('sticky_promo') }} -{% endblock %} +{% block js %}{% endblock %} diff --git a/bedrock/firefox/templates/firefox/browsers/what-is-a-browser.html b/bedrock/firefox/templates/firefox/browsers/what-is-a-browser.html index 6503213eb4..d7ef5dd7af 100644 --- a/bedrock/firefox/templates/firefox/browsers/what-is-a-browser.html +++ b/bedrock/firefox/templates/firefox/browsers/what-is-a-browser.html @@ -98,13 +98,3 @@ {% endblock %} - -{% block sticky_promo %} - {% with non_fx_only=True %} - {% include '/includes/sticky-promo.html' %} - {% endwith %} -{% endblock %} - -{% block js %} - {{ js_bundle('sticky_promo') }} -{% endblock %} diff --git a/bedrock/firefox/templates/firefox/home/index-master.html b/bedrock/firefox/templates/firefox/home/index-master.html index 6aeaeb9328..c6289e203b 100644 --- a/bedrock/firefox/templates/firefox/home/index-master.html +++ b/bedrock/firefox/templates/firefox/home/index-master.html @@ -231,10 +231,6 @@ {% endblock %} -{% block sticky_promo %} - {% include '/includes/sticky-promo.html' %} -{% endblock %} - {% block js %} {{ js_bundle('fxa_product_button') }} {{ js_bundle('firefox-master') }} diff --git a/bedrock/firefox/templates/firefox/new/desktop/download.html b/bedrock/firefox/templates/firefox/new/desktop/download.html index 2646806860..023c5161ea 100644 --- a/bedrock/firefox/templates/firefox/new/desktop/download.html +++ b/bedrock/firefox/templates/firefox/new/desktop/download.html @@ -655,10 +655,6 @@ {% endblock %} -{% block sticky_promo %} - {% include '/includes/sticky-promo.html' %} -{% endblock %} - {% block js %} {{ js_bundle('firefox_desktop_download') }} {% endblock %} diff --git a/bedrock/firefox/templates/firefox/releases/notes.html b/bedrock/firefox/templates/firefox/releases/notes.html index 94bfdfbc57..99b781c61e 100644 --- a/bedrock/firefox/templates/firefox/releases/notes.html +++ b/bedrock/firefox/templates/firefox/releases/notes.html @@ -395,17 +395,6 @@ {% endblock %} -{% block sticky_promo %} - {% with non_fx_only=True %} - {% include '/includes/sticky-promo.html' %} - {% endwith %} -{% endblock %} - -{% block js %} - {{ js_bundle('sticky_promo') }} -{% endblock %} - - {% block email_form %}{% endblock %} {% macro note_entry(note) %} diff --git a/bedrock/settings/base.py b/bedrock/settings/base.py index 07dda184ba..35d4a2af3f 100644 --- a/bedrock/settings/base.py +++ b/bedrock/settings/base.py @@ -236,7 +236,6 @@ FLUENT_DEFAULT_FILES = [ "banners/firefox-app-store", "brands", "download_button", - "firefox/sticky-promo", "footer", "fxa_form", "mozorg/about/shared", diff --git a/docs/attribution/0001-analytics.rst b/docs/attribution/0001-analytics.rst index cafbd42cff..486caf1bdb 100644 --- a/docs/attribution/0001-analytics.rst +++ b/docs/attribution/0001-analytics.rst @@ -376,7 +376,7 @@ link element. `data-link-text` must be present to trigger the event: - data-link-text (examples: “Monitor”, “Features”, “Instagram (mozilla)”, “Mozilla VPN”) -- data-link-position (examples: topnav, subnav, sticky-promo, topnav - firefox, footer - company) +- data-link-position (examples: topnav, subnav, topnav - firefox, footer - company) ``` diff --git a/l10n/en/firefox/sticky-promo.ftl b/l10n/en/firefox/sticky-promo.ftl deleted file mode 100644 index d6f29ff56b..0000000000 --- a/l10n/en/firefox/sticky-promo.ftl +++ /dev/null @@ -1,21 +0,0 @@ -# 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/. - -### URL: https://www-dev.allizom.org/firefox/new -### Appears on /firefox/browsers, /firefox/new and /firefox/browsers - -# Obsolete string -# Meet our family of products -firefox-sticky-promo-meet-our-family-of = Meet our family of products - -firefox-sticky-promo-meet-mozillas-family = Meet { -brand-name-mozilla}’s family of products -firefox-sticky-promo-get-the-latest-firefox = Get the latest { -brand-name-firefox } browser. - -# Products List -firefox-sticky-promo-browsers = Browsers -firefox-sticky-promo-monitor = { -brand-name-monitor } -firefox-sticky-promo-lockwise = { -brand-name-lockwise } -firefox-sticky-promo-pocket = { -brand-name-pocket } -firefox-sticky-promo-mozilla-vpn = { -brand-name-mozilla-vpn } -firefox-sticky-promo-relay = { -brand-name-relay } diff --git a/media/css/firefox/browsers-products.scss b/media/css/firefox/browsers-products.scss index af356a05e5..6ed7fdb8ef 100644 --- a/media/css/firefox/browsers-products.scss +++ b/media/css/firefox/browsers-products.scss @@ -8,7 +8,6 @@ $brand-theme: 'firefox'; @import '../protocol/components/custom-menu-list'; @import '../protocol/components/fxa-form'; -@import './sticky-promo'; @import '~@mozilla-protocol/core/protocol/css/components/logos/logo-product-firefox'; @import '~@mozilla-protocol/core/protocol/css/components/zap'; @import '~@mozilla-protocol/core/protocol/css/includes/lib'; diff --git a/media/css/firefox/home/master.scss b/media/css/firefox/home/master.scss index 79ceb85f7f..a1675280d1 100644 --- a/media/css/firefox/home/master.scss +++ b/media/css/firefox/home/master.scss @@ -15,7 +15,6 @@ $brand-theme: 'firefox'; @import '~@mozilla-protocol/core/protocol/css/components/logos/wordmark-product-relay'; @import '~@mozilla-protocol/core/protocol/css/components/zap'; @import '../../protocol/components/custom-menu-list'; -@import '../sticky-promo'; // conditional content .js-fx-only { diff --git a/media/css/firefox/new/desktop/download.scss b/media/css/firefox/new/desktop/download.scss index 4eb3d63f66..743d518332 100644 --- a/media/css/firefox/new/desktop/download.scss +++ b/media/css/firefox/new/desktop/download.scss @@ -14,7 +14,6 @@ $image-path: '/media/protocol/img'; @import '~@mozilla-protocol/core/protocol/css/components/section-heading'; @import '~@mozilla-protocol/core/protocol/css/components/zap'; @import '../../../protocol/components/sub-navigation'; -@import '../../sticky-promo'; // -------------------------------------------------------------------------- // Protocol over-rides diff --git a/media/css/firefox/sticky-promo.scss b/media/css/firefox/sticky-promo.scss deleted file mode 100644 index 523c055a02..0000000000 --- a/media/css/firefox/sticky-promo.scss +++ /dev/null @@ -1,79 +0,0 @@ -// 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/. - -$brand-theme: 'firefox'; -$font-path: '/media/protocol/fonts'; -$image-path: '/media/protocol/img'; - -@import '~@mozilla-protocol/core/protocol/css/includes/lib'; -@import '~@mozilla-protocol/core/protocol/css/components/sticky-promo'; - -// Hide promo by default for mobile devices (<$mq-md) -.mzp-c-sticky-promo { - display: none; -} - -// Show non-Fx users a promo to download Fx -.promo-firefox { - .is-firefox & { - display: none; - } -} - -// Show Fx users a promo to try other products -.promo-products { - display: none; - - .is-firefox & { - display: block; - - .mzp-c-sticky-promo-title { - background: none; - margin-bottom: 0; - padding: 0; - text-align: center; - } - } -} - -.mzp-c-sticky-promo .mzp-c-button-download-container { - width: 100%; -} - -// * -------------------------------------------------------------------------- */ -// Promo Products List Styles - -.promo-products-list { - @include white-links; - align-items: center; - border-top: $border-radius-xs solid rgba(255, 255, 255, 0.5); - display: flex; - flex-direction: column; - list-style: none; - margin: $spacing-xl 0 0; - padding-top: $spacing-xl; - - .promo-products-link { - align-items: center; - color: $color-white; - display: flex; - font-weight: bold; - margin-bottom: $spacing-md; - text-decoration: none !important; /* stylelint-disable-line declaration-no-important */ - - img { - display: block; - height: 100%; - margin-inline-end: $spacing-md; - width: $spacing-xl; - } - } -} - -@media #{$mq-md} { - .mzp-c-sticky-promo.mzp-a-slide-in, - .mzp-c-sticky-promo.is-displayed { - display: block; - } -} diff --git a/media/js/firefox/sticky-promo.es6.js b/media/js/firefox/sticky-promo.es6.js deleted file mode 100644 index d3a1ed461c..0000000000 --- a/media/js/firefox/sticky-promo.es6.js +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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 MzpStickyPromo from '@mozilla-protocol/core/protocol/js/sticky-promo'; - -// https://davidwalsh.name/javascript-debounce-function -function debounce(func, wait, immediate) { - let timeout; - return function () { - const context = this; - const args = arguments; - const later = () => { - timeout = null; - if (!immediate) { - func.apply(context, args); - } - }; - const callNow = immediate && !timeout; - clearTimeout(timeout); - timeout = setTimeout(later, wait); - if (callNow) { - func.apply(context, args); - } - }; -} - -function isInViewport(element) { - // Calculate on each scroll if the footer is in the view port. - const elementTop = element.offsetTop; - const elementBottom = elementTop + element.offsetHeight; - const viewportTop = window.scrollY || window.pageYOffset; - const viewportBottom = viewportTop + window.screen.height; - - return elementBottom > viewportTop && elementTop < viewportBottom; -} - -function onLoad() { - // Check if promo exists on the page, or if smaller than tablet, or if user prefers reduced motion. - const matchMediaNoMotion = window.matchMedia( - '(prefers-reduced-motion: reduce)' - ).matches; - const matchMediaDesktop = window.matchMedia('(min-width: 768px)').matches; - const promo = document.querySelector('.mzp-c-sticky-promo'); - - if (!promo || !matchMediaDesktop || matchMediaNoMotion) { - return; - } - - // If the user is on Firefox and is NOT supposed to see sticky promo. - const fxUser = document.documentElement.classList.contains('is-firefox'); - const hideFromFxUser = promo.classList.contains('hide-from-fx-user'); - - if (fxUser && hideFromFxUser) { - return; - } - - const StickyPromo = {}; - const STICKY_PROMO_COOKIE_ID = 'firefox-sticky-promo'; - - StickyPromo.bindEvents = function () { - promo.addEventListener( - 'animationend', - function () { - promo.classList.add('is-displayed'); - }, - false - ); - }; - - StickyPromo.hasCookie = function () { - return Mozilla.Cookies.hasItem(STICKY_PROMO_COOKIE_ID); - }; - - StickyPromo.setCookie = function () { - const date = new Date(); - const cookieDuration = 1 * 24 * 60 * 60 * 1000; // 1 day expiration - date.setTime(date.getTime() + cookieDuration); // 1 day expiration - Mozilla.Cookies.setItem( - STICKY_PROMO_COOKIE_ID, - true, - date.toUTCString(), - '/', - undefined, - false, - 'lax' - ); - }; - - StickyPromo.show = function () { - function openOnScroll() { - // Open promo - MzpStickyPromo.open(); - document.removeEventListener('scroll', openOnScroll, false); - } - - document.addEventListener('scroll', openOnScroll, false); - - const checkForFooterOnScroll = debounce(function () { - // If the footer is in the viewport, fade out the promo. - // Animate it back in when the footer leaves the viewport - // if the user did not dismiss it. - if (isInViewport(footer)) { - promo.classList.remove('mzp-a-slide-in'); - promo.classList.add('mzp-a-fade-out'); - } else if (!promo.classList.contains('user-dismiss')) { - promo.classList.remove('mzp-a-fade-out'); - promo.classList.add('mzp-a-slide-in'); - } - }, 100); - - // Add modifier class to the footer to make sure the language selection drop-down is not obscured by the sticky promo - const footer = document.querySelector('.mzp-c-footer'); - if (footer) { - document.addEventListener('scroll', checkForFooterOnScroll, false); - } - - // Set Close Button event - const stickyBtnClose = document.querySelector( - '.mzp-c-sticky-promo-close' - ); - - stickyBtnClose.addEventListener('click', function () { - StickyPromo.setCookie(STICKY_PROMO_COOKIE_ID); - promo.classList.add('user-dismiss'); - }); - }; - - // Check on page load - const cookiesEnabled = - typeof Mozilla.Cookies !== 'undefined' && Mozilla.Cookies.enabled(); - - if (cookiesEnabled && !StickyPromo.hasCookie()) { - StickyPromo.bindEvents(); - StickyPromo.show(); - } -} - -window.Mozilla.run(onLoad); diff --git a/media/static-bundles.json b/media/static-bundles.json index 39077aec5d..a1282e7a22 100644 --- a/media/static-bundles.json +++ b/media/static-bundles.json @@ -96,12 +96,6 @@ ], "name": "firefox_developer_whatsnew_mdnplus" }, - { - "files": [ - "css/firefox/sticky-promo.scss" - ], - "name": "sticky_promo" - }, { "files": [ "css/firefox/new/basic/download.scss" @@ -653,7 +647,6 @@ }, { "files": [ - "css/firefox/sticky-promo.scss", "css/firefox/releasenotes.scss" ], "name": "firefox_releasenotes" @@ -759,7 +752,6 @@ }, { "files": [ - "css/firefox/sticky-promo.scss", "css/firefox/browsers/what-is-a-browser.scss" ], "name": "what-is-a-browser" @@ -778,14 +770,12 @@ }, { "files": [ - "css/firefox/sticky-promo.scss", "css/firefox/browsers/incognito-browser.scss" ], "name": "incognito-browser" }, { "files": [ - "css/firefox/sticky-promo.scss", "css/firefox/browsers/browser-history.scss" ], "name": "browser-history" @@ -810,7 +800,6 @@ }, { "files": [ - "css/firefox/sticky-promo.scss", "css/firefox/browsers/best-browser.scss" ], "name": "best-browser" @@ -818,14 +807,12 @@ { "files": [ "css/protocol/components/send-to-device.scss", - "css/firefox/sticky-promo.scss", "css/firefox/compare/compare.scss" ], "name": "compare" }, { "files": [ - "css/firefox/sticky-promo.scss", "css/firefox/compare/compare.scss", "css/firefox/compare/compare-details.scss" ], @@ -942,7 +929,6 @@ }, { "files": [ - "css/firefox/sticky-promo.scss", "css/firefox/browsers/quantum.scss" ], "name": "quantum" @@ -1389,7 +1375,6 @@ }, { "files": [ - "js/firefox/sticky-promo.es6.js", "js/firefox/new/desktop/download.js" ], "name": "firefox_desktop_download" @@ -1408,12 +1393,6 @@ ], "name": "firefox_new_thanks_direct" }, - { - "files": [ - "js/firefox/sticky-promo.es6.js" - ], - "name": "sticky_promo" - }, { "files": [ "js/base/stub-attribution.js", @@ -1497,7 +1476,6 @@ }, { "files": [ - "js/firefox/sticky-promo.es6.js", "js/firefox/home/master.js" ], "name": "firefox-master" @@ -1513,7 +1491,6 @@ "files": [ "js/base/mozilla-fxa.js", "js/base/mozilla-fxa-init.js", - "js/firefox/sticky-promo.es6.js", "js/firefox/browsers-products.js" ], "name": "firefox-browsers-products" @@ -1831,7 +1808,6 @@ }, { "files": [ - "js/firefox/sticky-promo.es6.js", "js/firefox/compare-details.js" ], "name": "firefox_compare_details" diff --git a/tests/functional/firefox/new/test_sticky_promo.py b/tests/functional/firefox/new/test_sticky_promo.py deleted file mode 100644 index 03c71581da..0000000000 --- a/tests/functional/firefox/new/test_sticky_promo.py +++ /dev/null @@ -1,16 +0,0 @@ -# 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.new.sticky_promo import StickyPromoPage - - -@pytest.mark.nondestructive -def test_sticky_promo(base_url, selenium): - page = StickyPromoPage(selenium, base_url).open() - page.init_promo() - assert page.promo.is_displayed - page.promo.close() - assert not page.promo.is_displayed diff --git a/tests/functional/firefox/test_home.py b/tests/functional/firefox/test_home.py index 39e24374ed..f23217d678 100644 --- a/tests/functional/firefox/test_home.py +++ b/tests/functional/firefox/test_home.py @@ -13,12 +13,3 @@ def test_download_menu_list_displays(base_url, selenium): page = FirefoxHomePage(selenium, base_url).open() page.browser_menu_list.click() assert page.browser_menu_list.list_is_open - - -@pytest.mark.nondestructive -def test_sticky_promo(base_url, selenium): - page = FirefoxHomePage(selenium, base_url).open() - page.init_promo() - assert page.promo.is_displayed - page.promo.close() - assert not page.promo.is_displayed diff --git a/tests/pages/firefox/home.py b/tests/pages/firefox/home.py index 13093a4b12..df23648592 100644 --- a/tests/pages/firefox/home.py +++ b/tests/pages/firefox/home.py @@ -6,7 +6,6 @@ from selenium.webdriver.common.by import By from pages.base import BasePage from pages.regions.menu_list import MenuList -from pages.regions.sticky_promo import StickyPromo class FirefoxHomePage(BasePage): @@ -15,15 +14,9 @@ class FirefoxHomePage(BasePage): # browser download menu list _browser_menu_list_locator = (By.ID, "test-menu-browsers-wrapper") - # facebook container extention link visiability + # facebook container extension link visibility _facebook_container_link_locator = (By.ID, "test-fbc") - # floating/sticky box - download link - _sticky_promo_modal_content_locator = (By.CSS_SELECTOR, ".mzp-c-sticky-promo") - - # Used as a scroll target to move down the page, to trigger the sticky promo element - _page_promise_content_locator = (By.CSS_SELECTOR, ".t-promise") - @property def fb_container_is_displayed(self): return self.is_element_displayed(*self._facebook_container_link_locator) @@ -32,18 +25,3 @@ class FirefoxHomePage(BasePage): def browser_menu_list(self): el = self.find_element(*self._browser_menu_list_locator) return MenuList(self, root=el) - - def init_promo(self): - assert not self.is_promo_displayed, "Promo detail is not displayed" - # scroll down page to trigger promo to display - self.scroll_element_into_view(*self._page_promise_content_locator) - promo = self.find_element(*self._sticky_promo_modal_content_locator) - self.wait.until(lambda s: "is-displayed" in promo.get_attribute("class")) - - @property - def is_promo_displayed(self): - return self.is_element_displayed(*self._sticky_promo_modal_content_locator) - - @property - def promo(self): - return StickyPromo(self) diff --git a/tests/pages/firefox/new/sticky_promo.py b/tests/pages/firefox/new/sticky_promo.py deleted file mode 100644 index a06fe17fe3..0000000000 --- a/tests/pages/firefox/new/sticky_promo.py +++ /dev/null @@ -1,31 +0,0 @@ -# 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 selenium.webdriver.common.by import By - -from pages.base import BasePage -from pages.regions.sticky_promo import StickyPromo - - -class StickyPromoPage(BasePage): - URL_TEMPLATE = "/{locale}/firefox/new/" - - # Used as a scroll target to move down the page, to trigger the sticky promo element - _page_highlights_content_locator = (By.CSS_SELECTOR, ".t-highlights") - _sticky_promo_modal_content_locator = (By.CSS_SELECTOR, ".mzp-c-sticky-promo") - - def init_promo(self): - assert not self.is_promo_displayed, "Promo detail is not displayed" - # scroll down page to trigger promo to display - self.scroll_element_into_view(*self._page_highlights_content_locator) - promo = self.find_element(*self._sticky_promo_modal_content_locator) - self.wait.until(lambda s: "is-displayed" in promo.get_attribute("class")) - - @property - def is_promo_displayed(self): - return self.is_element_displayed(*self._sticky_promo_modal_content_locator) - - @property - def promo(self): - return StickyPromo(self) diff --git a/tests/pages/regions/sticky_promo.py b/tests/pages/regions/sticky_promo.py deleted file mode 100644 index 17d02ed0ca..0000000000 --- a/tests/pages/regions/sticky_promo.py +++ /dev/null @@ -1,23 +0,0 @@ -# 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 selenium.webdriver.common.by import By - -from pages.base import BaseRegion - - -class StickyPromo(BaseRegion): - _root_locator = (By.CLASS_NAME, "mzp-c-sticky-promo") - _close_locator = (By.CLASS_NAME, "mzp-c-sticky-promo-close") - - def close(self): - self.find_element(*self._close_locator).click() - self.wait.until(lambda s: not self.is_displayed) - - @property - def is_displayed(self): - return self.page.is_element_displayed(*self._root_locator) - - def displays(self, selector): - return self.is_element_displayed(*selector)