Skip to content

Commit

Permalink
Update importing fonts.googleapis.com to use SSL
Browse files Browse the repository at this point in the history
On 23/11/2021, google started to require ssl to access
`//fonts.googleapis.com/css`, causing the import in the solidus frontend
stylesheet to fail in CI. This breaks solidus and tests that run against
the solidus_frontend. We can resolve this by explicitly using the
https protocol.

Error example:
app.circleci.com/pipelines/github/solidusio/solidus/2791/workflows/e62ff646-9ae6-4e65-b20f-e1f7a109d3a1/jobs/26572

Blocking of this URL in testing_support was updated to bring it inline
with how url's are blacklisted in future solidus versions.

Even though solidus 2.9 is at end of life, some solidus extensions
still test and maintain support against this  version of solidus, such
as SuperGoodSoft/solidus_taxjar.

Co-authored-by: Ryan Woods <[email protected]>
  • Loading branch information
Noah-Silvera and RyanofWoods committed Dec 2, 2021
1 parent 6c5f2ac commit d07f5c2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
5 changes: 2 additions & 3 deletions backend/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
require 'spree/testing_support/url_helpers'
require 'spree/testing_support/order_walkthrough'
require 'spree/testing_support/capybara_ext'
require 'spree/testing_support/blacklist_urls'

require 'capybara-screenshot/rspec'
Capybara.save_path = ENV['CIRCLE_ARTIFACTS'] if ENV['CIRCLE_ARTIFACTS']
Expand Down Expand Up @@ -89,9 +90,6 @@

config.before do
Rails.cache.clear
if RSpec.current_example.metadata[:js] && page.driver.browser.respond_to?(:url_blacklist)
page.driver.browser.url_blacklist = ['http://fonts.googleapis.com']
end
end

config.include BaseFeatureHelper, type: :feature
Expand All @@ -111,6 +109,7 @@
config.include Spree::TestingSupport::UrlHelpers
config.include Spree::TestingSupport::ControllerRequests, type: :controller
config.include Spree::TestingSupport::Flash
config.include Spree::TestingSupport::BlacklistUrls

config.extend WithModel

Expand Down
23 changes: 23 additions & 0 deletions core/lib/spree/testing_support/blacklist_urls.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

module Spree
module TestingSupport
module BlacklistUrls
def setup_url_blacklist(browser)
if browser.respond_to?(:url_blacklist)
browser.url_blacklist = ['https://fonts.googleapis.com']
end
end
end
end
end

RSpec.configure do |config|
config.before(:each, type: :feature) do
setup_url_blacklist(page.driver.browser)
end

config.before(:each, type: :system) do
setup_url_blacklist(page.driver.browser)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $cart_total_text_color: #FFFFFF !default;
/*--------------------------------------*/
/* Fonts import from remote
/*--------------------------------------*/
@import url(//fonts.googleapis.com/css?family=Ubuntu:400,700,400italic,700italic|&subset=latin,cyrillic,greek,greek-ext,latin-ext,cyrillic-ext);
@import url(https://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic,700italic|&subset=latin,cyrillic,greek,greek-ext,latin-ext,cyrillic-ext);

/*--------------------------------------*/
/* Font families
Expand Down

0 comments on commit d07f5c2

Please sign in to comment.