From ca74ae5a5e9e1761f485412b201a4be9e37653b4 Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Wed, 1 Jul 2020 22:11:53 +0200 Subject: [PATCH] =?UTF-8?q?ajout=20d'une=20banni=C3=A8re=20de=20d=C3=A9pr?= =?UTF-8?q?=C3=A9ciation=20pour=20IE11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .browserslistrc | 2 +- .../_outdated_browser_banner.html.haml | 18 ++++++++--- spec/features/outdated_browser_spec.rb | 32 +++++++++++++++---- 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/.browserslistrc b/.browserslistrc index 6ade378c9..aef27355f 100644 --- a/.browserslistrc +++ b/.browserslistrc @@ -6,5 +6,5 @@ Opera >= 40 Safari >= 8 iOS >= 8 # Although IE 11 shows a deprecation banner, we still support the transpilation option. -# IE 11 support may be removed starting from 01 / 06 / 2020. +# IE 11 support will be removed on Jan. 31st, 2021. IE >= 11 diff --git a/app/views/layouts/_outdated_browser_banner.html.haml b/app/views/layouts/_outdated_browser_banner.html.haml index 25a8bcbd8..78b92fa0e 100644 --- a/app/views/layouts/_outdated_browser_banner.html.haml +++ b/app/views/layouts/_outdated_browser_banner.html.haml @@ -2,11 +2,19 @@ #outdated-browser-banner.site-banner .container .site-banner-icon ⚠️ - .site-banner-text - %strong - #{browser.name} #{browser.version} est trop ancien pour utiliser demarches-simplifiees.fr. - %br - Certaines parties du site ne fonctionneront pas correctement. + - if browser.ie?(11) + .site-banner-text + Internet Explorer 11 est un navigateur trop ancien. Nous cesserons de gérer son fonctionnement à partir du + %strong + 31 janvier 2021. + %br + Merci de changer pour un navigateur plus récent avant cette date ; il peut être nécessaire de prendre contact avec un responsable informatique. + - else + .site-banner-text + %strong + #{browser.name} #{browser.version} est trop ancien pour utiliser demarches-simplifiees.fr. + %br + Certaines parties du site ne fonctionneront pas correctement. .site-banner-actions = button_to 'Ignorer', dismiss_outdated_browser_path, method: :post, remote: true, class: 'button btn', title: 'Ne plus afficher cet avertissement pendant une semaine' %a.btn.button.primary{ href: "https://browser-update.org/fr/update.html", target: "_blank", rel: "noopener" } diff --git a/spec/features/outdated_browser_spec.rb b/spec/features/outdated_browser_spec.rb index 8ca379658..0d8b5d104 100644 --- a/spec/features/outdated_browser_spec.rb +++ b/spec/features/outdated_browser_spec.rb @@ -1,29 +1,49 @@ feature 'Outdated browsers support:' do context 'when the user browser is outdated' do before(:each) do - ie_11_user_agent = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko' - Capybara.page.driver.header('user-agent', ie_11_user_agent) + ie_10_user_agent = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0; .NET4.0E; .NET4.0C; InfoPath.3)' + Capybara.page.driver.header('user-agent', ie_10_user_agent) end scenario 'a banner is displayed' do visit new_user_session_path - expect(page).to have_content('Internet Explorer 11 est trop ancien') + expect(page).to have_content('Internet Explorer 10 est trop ancien') end scenario 'the banner can be dismissed' do visit new_user_session_path - expect(page).to have_content('Internet Explorer 11 est trop ancien') + expect(page).to have_content('Internet Explorer 10 est trop ancien') # The banner is hidden immediately within '#outdated-browser-banner' do click_on 'Ignorer' end - expect(page).not_to have_content('Internet Explorer 11 est trop ancien') + expect(page).not_to have_content('Internet Explorer 10 est trop ancien') expect(page).to have_current_path(new_user_session_path) # The banner is hidden after a refresh page.refresh - expect(page).not_to have_content('Internet Explorer 11 est trop ancien') + expect(page).not_to have_content('Internet Explorer 10 est trop ancien') + end + end + + context 'when the user browser is about to be outdated' do + before(:each) do + ie_11_user_agent = 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko' + Capybara.page.driver.header('user-agent', ie_11_user_agent) + end + + scenario 'IE11 gets a dedicated depreciation banner for update before jan 31st 2021' do + visit new_user_session_path + expect(page).to have_content('31 janvier 2021') + expect(page).to have_content('Internet Explorer 11 est un navigateur trop ancien') + + within '#outdated-browser-banner' do + click_on 'Ignorer' + end + + page.refresh + expect(page).not_to have_content('Internet Explorer 11 est un navigateur trop ancien') end end end