From 635faaaf59691d26595a3e972d734928dee3b07e Mon Sep 17 00:00:00 2001 From: Bianca Nenciu Date: Wed, 6 Nov 2024 20:01:27 +0200 Subject: [PATCH] DEV: Add system spec for categories page (#29621) Follow up to commit 948e283e0f0654a7bd1d48554623afc84beb03f4. --- spec/system/discovery_category_spec.rb | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 spec/system/discovery_category_spec.rb diff --git a/spec/system/discovery_category_spec.rb b/spec/system/discovery_category_spec.rb new file mode 100644 index 00000000000..a5b5433249f --- /dev/null +++ b/spec/system/discovery_category_spec.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +describe "Discovery Category Routes", type: :system do + fab!(:category) do + Fabricate(:category, show_subcategory_list: true, subcategory_list_style: "boxes") + end + + fab!(:subcategory1) { Fabricate(:category, parent_category: category) } + fab!(:subcategory2) { Fabricate(:category, parent_category: category) } + fab!(:subcategory3) { Fabricate(:category, parent_category: category) } + + let(:discovery) { PageObjects::Pages::Discovery.new } + + it "uses desktop_category_page style on categories and subcategories page" do + visit "/categories" + expect(page).to have_css(".category-list") + + visit "/c/#{category.slug}/subcategories" + expect(page).to have_css(".category-list") + end + + it "uses subcategory_list_style on category page" do + visit "/c/#{category.slug}" + expect(page).to have_css(".category-boxes") + + visit "/c/#{category.slug}/all" + expect(page).to have_css(".category-boxes") + + visit "/c/#{category.slug}/none" + expect(page).to have_css(".category-boxes") + end +end