From d5b77a4f80689a11989dced007c1bb75c4644f75 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Wed, 19 Jun 2024 11:45:28 +1000 Subject: [PATCH] Ensure all assets are compiled on test page visit --- spec/system/consumer/caching/shops_caching_spec.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spec/system/consumer/caching/shops_caching_spec.rb b/spec/system/consumer/caching/shops_caching_spec.rb index baaf3302e3..d9cda44d54 100644 --- a/spec/system/consumer/caching/shops_caching_spec.rb +++ b/spec/system/consumer/caching/shops_caching_spec.rb @@ -14,12 +14,13 @@ RSpec.describe "Shops caching", caching: true do } describe "caching enterprises AMS data" do - it "caches data for all enterprises, with the provided options" do + before do # Trigger lengthy tasks like JS compilation before testing caching: visit shops_path Rails.cache.clear + end - # Now run the test, hopefully in a timely manner: + it "caches data for all enterprises, with the provided options" do visit shops_path key, options = CacheService::FragmentCaching.ams_shops @@ -73,6 +74,10 @@ RSpec.describe "Shops caching", caching: true do before do exchange.variants << product.variants.first + + # Trigger lengthy tasks like JS compilation before testing caching: + visit enterprise_shop_path(distributor) + Rails.cache.clear end it "caches rendered response for taxons and properties, with the provided options" do