Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Fix tests from updates.
Matthew Kennedyd734ea75bfd3
diff --git a/backend/spec/features/admin/cms_pages/edit_feature_page_spec.rb b/backend/spec/features/admin/cms_pages/edit_feature_page_spec.rbindex 2b17764f48..a41b069779 100644--- a/backend/spec/features/admin/cms_pages/edit_feature_page_spec.rb+++ b/backend/spec/features/admin/cms_pages/edit_feature_page_spec.rb@@ -4,7 +4,7 @@ describe 'Edit Feature Page', type: :feature dostub_authorization!context 'when a user creates a Feature Page' do- let!(:store_fp) { create(:store, name: 'Super Store', supported_locales: 'en,fr') }+ let!(:store_fp) { create(:store, default: true, name: 'Super Store', supported_locales: 'en,fr') }before doI18n.backend.store_translations(:fr,diff --git a/backend/spec/features/admin/cms_pages/edit_homepage_spec.rb b/backend/spec/features/admin/cms_pages/edit_homepage_spec.rbindex cd2845b33b..0320292e1a 100644--- a/backend/spec/features/admin/cms_pages/edit_homepage_spec.rb+++ b/backend/spec/features/admin/cms_pages/edit_homepage_spec.rb@@ -4,7 +4,7 @@ describe 'Edit Homepage', type: :feature dostub_authorization!context 'when a user creates a Homepage' do- let!(:store_hp) { create(:store, name: 'Super Store', supported_locales: 'en,fr') }+ let!(:store_hp) { create(:store, default: true, name: 'Super Store', supported_locales: 'en,fr') }before doI18n.backend.store_translations(:fr,diff --git a/backend/spec/features/admin/cms_pages/edit_standard_page_spec.rb b/backend/spec/features/admin/cms_pages/edit_standard_page_spec.rbindex ee820c9d43..c6dab71f78 100644--- a/backend/spec/features/admin/cms_pages/edit_standard_page_spec.rb+++ b/backend/spec/features/admin/cms_pages/edit_standard_page_spec.rb@@ -4,7 +4,7 @@ describe 'Edit Standard Page', type: :feature dostub_authorization!context 'when a user creates a Standard Page' do- let!(:store_sp) { create(:store, name: 'Super Store', supported_locales: 'en,fr') }+ let!(:store_sp) { create(:store, default: true, name: 'Super Store', supported_locales: 'en,fr') }before dovisit spree.new_admin_cms_page_pathdiff --git a/backend/spec/features/admin/cms_pages/new_page_spec.rb b/backend/spec/features/admin/cms_pages/new_page_spec.rbindex 9c6b619c94..c0f687fbeb 100644--- a/backend/spec/features/admin/cms_pages/new_page_spec.rb+++ b/backend/spec/features/admin/cms_pages/new_page_spec.rb@@ -35,15 +35,16 @@ describe 'New Page', type: :feature doendcontext 'when a user tries to create a page with a duplicate slug' do- let!(:store_1) { create(:store) }+ let!(:store_1) { create(:store, default: true) }let!(:cms_page) { create(:cms_standard_page, title: 'About Us', store: store_1) }before dovisit spree.new_admin_cms_page_pathend- it 'warns the user that the slug has already been taken' do+ it 'warns the user that the slug has already been taken', js: true dofill_in 'Title *', with: 'About Us'+ select2 store_1.unique_name, from: 'Stores'click_on 'Create'expect(page).to have_text ('Slug has already been taken')diff --git a/frontend/app/views/spree/shared/cms/sections/_product_carousel.html.erb b/frontend/app/views/spree/shared/cms/sections/_product_carousel.html.erbindex c27d3bdd5e..c4f55572fd 100644--- a/frontend/app/views/spree/shared/cms/sections/_product_carousel.html.erb+++ b/frontend/app/views/spree/shared/cms/sections/_product_carousel.html.erb@@ -1,5 +1,5 @@<div class="col-12"><% if section.linked_resource %>- <div data-product-carousel-taxon-id='<%= section.linked_resource.permalink %>' class="my-3"></div>+ <div data-product-carousel-taxon-id='<%= section.linked_resource.id %>' class="my-3"></div><% end %></div>diff --git a/frontend/spec/features/cms_sections/product_carousel_spec.rb b/frontend/spec/features/cms_sections/product_carousel_spec.rbnew file mode 100644index 0000000000..ec662b7af8--- /dev/null+++ b/frontend/spec/features/cms_sections/product_carousel_spec.rb@@ -0,0 +1,50 @@+require 'spec_helper'++describe 'Visiting the homepage', type: :feature, js: true do+ let!(:store) { Spree::Store.default }++ let!(:taxonomy_a) { create(:taxonomy, name: 'Bestsellers') }+ let!(:bestsellers) { taxonomy_a.root.children.create(name: 'Bestsellers') }++ let!(:product_a) { create(:product, name: 'Superman T-Shirt', taxons: [bestsellers]) }+ let!(:product_b) { create(:product, name: 'Batman Socks', taxons: [bestsellers]) }++ let!(:homepage) { create(:cms_homepage, store: store) }+ let!(:hp_section) { create(:cms_product_carousel_section, cms_page: homepage, linked_resource: bestsellers) }++ context 'when taxon bestsellers exists and has products available in current store currency' do+ before do+ visit spree.root_path+ end++ it 'loads the carousel with the products displayed' do+ within "div[data-product-carousel-taxon-id='#{hp_section.linked_resource.id}']" do+ expect(page).to have_content('Superman T-Shirt')+ expect(page).to have_content('Batman Socks')+ end+ end++ it 'loads carousel items in order of position' do+ within '.carouselItem:nth-child(1)' do+ expect(page).to have_content('Superman T-Shirt')+ end++ within '.carouselItem:nth-child(2)' do+ expect(page).to have_content('Batman Socks')+ end+ end+ end++ context 'when products exist but not available in the current store currency' do+ before do+ store.update(default_currency: 'GBP')+ visit spree.root_path+ end++ it 'the carousel is not loaded' do+ expect(page).not_to have_content('BESTSELLERS')+ expect(page).not_to have_content('Superman T-Shirt')+ expect(page).not_to have_content('Batman Socks')+ end+ end+enddiff --git a/frontend/spec/features/home_spec.rb b/frontend/spec/features/home_spec.rbindex cde8911e26..adff607e8b 100644--- a/frontend/spec/features/home_spec.rb+++ b/frontend/spec/features/home_spec.rb@@ -2,32 +2,35 @@ require 'spec_helper'describe 'Visiting the homepage', type: :feature, js: true dolet!(:store) { Spree::Store.default }+let!(:taxonomy_a) { create(:taxonomy, name: 'Bestsellers') }let!(:bestsellers) { taxonomy_a.root.children.create(name: 'Bestsellers') }- let!(:taxonomy_b) { create(:taxonomy, name: 'Trending') }- let!(:trending) { taxonomy_b.root.children.create(name: 'Trending') }+let!(:product_a) { create(:product, name: 'Superman T-Shirt', taxons: [bestsellers]) }let!(:product_b) { create(:product, name: 'Batman Socks', taxons: [bestsellers]) }+ let!(:homepage) { create(:cms_homepage, store: store) }+ let!(:hp_section) { create(:cms_product_carousel_section, cms_page: homepage, linked_resource: bestsellers) }+context 'when taxon bestsellers exists and has products available in current store currency' dobefore do- visit spree.root_path + '#BestSellersTaxonProductCarousel'+ visit spree.root_pathendit 'loads the carousel with the products displayed' do- within '#BestSellersTaxonProductCarousel' do- expect(page).to have_content('BESTSELLERS')+ within "div[data-product-carousel-taxon-id='#{hp_section.linked_resource.id}']" do+ expect(page).not_to have_content('BESTSELLERS')expect(page).to have_content('Superman T-Shirt')expect(page).to have_content('Batman Socks')endendit 'loads carousel items in order of position' do- within ".carouselItem:nth-child(1)" do+ within '.carouselItem:nth-child(1)' doexpect(page).to have_content('Superman T-Shirt')end- within ".carouselItem:nth-child(2)" do+ within '.carouselItem:nth-child(2)' doexpect(page).to have_content('Batman Socks')endend@@ -36,13 +39,13 @@ describe 'Visiting the homepage', type: :feature, js: true docontext 'when products exist but not available in the current store currency' dobefore dostore.update(default_currency: 'GBP')- visit spree.root_path + '#BestSellersTaxonProductCarousel'+ visit spree.root_pathendit 'the carousel is not loaded' do- expect(page).not_to have_content('BESTSELLERS')- expect(page).not_to have_content('Superman T-Shirt')- expect(page).not_to have_content('Batman Socks')+ expect(page).not_to have_content('BESTSELLERS')+ expect(page).not_to have_content('Superman T-Shirt')+ expect(page).not_to have_content('Batman Socks')endendend