From 95092b3b06a7452bd8fa6011870341889563863e Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Fri, 7 Jun 2024 15:51:09 -0600 Subject: [PATCH 01/14] Adds test case around shipped product Removes test case around shipped product for legacy products page --- spec/system/admin/products_spec.rb | 29 ----------------- .../system/admin/products_v3/products_spec.rb | 32 +++++++++++++++++++ 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/spec/system/admin/products_spec.rb b/spec/system/admin/products_spec.rb index 50340bcea0..c9823e8f03 100644 --- a/spec/system/admin/products_spec.rb +++ b/spec/system/admin/products_spec.rb @@ -283,35 +283,6 @@ RSpec.describe ' expect(page).to have_selector "#p_#{product1.id}" end end - - context 'a shipped product' do - let!(:order) { create(:shipped_order, line_items_count: 1) } - let!(:line_item) { order.reload.line_items.first } - - context "a deleted line item from a shipped order" do - before do - login_as_admin - visit spree.admin_products_path - - within "#p_#{order.variants.first.product_id}" do - accept_alert { page.find("[data-powertip=Remove]").click } - end - end - - it 'removes it from the product list' do - visit spree.admin_products_path - - expect(page).to have_selector "#p_#{product1.id}" - expect(page).not_to have_selector "#p_#{order.variants.first.product_id}" - end - - it 'keeps the line item on the order (admin)' do - visit spree.edit_admin_order_path(order) - - expect(page).to have_content(line_item.product.name.to_s) - end - end - end end describe 'cloning' do diff --git a/spec/system/admin/products_v3/products_spec.rb b/spec/system/admin/products_v3/products_spec.rb index 7cd4a9e8c5..c861dc933b 100644 --- a/spec/system/admin/products_v3/products_spec.rb +++ b/spec/system/admin/products_v3/products_spec.rb @@ -1336,6 +1336,38 @@ RSpec.describe 'As an enterprise user, I can manage my products', feature: :admi end end end + + context 'a shipped product' do + let!(:order) { create(:shipped_order, line_items_count: 1) } + let!(:line_item) { order.reload.line_items.first } + + context "a deleted line item from a shipped order" do + before do + login_as_admin + visit admin_products_url + + # Delete Variant + within variant_selector do + page.find(".vertical-ellipsis-menu").click + page.find(delete_option_selector).click + end + + delete_button_selector = "input[type=button][value='Delete variant']" + within modal_selector do + page.find(delete_button_selector).click + end + + expect(page).not_to have_selector(modal_selector) + expect(page).not_to have_selector(variant_selector) + end + + it 'keeps the line item on the order (admin)' do + visit spree.edit_admin_order_path(order) + + expect(page).to have_content(line_item.product.name.to_s) + end + end + end end end end From ae600d4bd63c8b6e2ff9d3622355c2647f5e8058 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 10 Jun 2024 10:20:05 -0600 Subject: [PATCH 02/14] Removes test case on access rights to the products page Moves test on access rights to authentication_spec The test on accessing the products page as an anonymous does not seem specific to the products page (IMO); as we're testing access rights and the Devise gem (right?) we're probably better off having this test in a more suitable and general context, such as as a spec dealing with authentications and redirects --- spec/system/admin/authentication_spec.rb | 32 ++++++++++++++---------- spec/system/admin/products_spec.rb | 6 ----- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/spec/system/admin/authentication_spec.rb b/spec/system/admin/authentication_spec.rb index 74a7d71412..80bedbd3c9 100644 --- a/spec/system/admin/authentication_spec.rb +++ b/spec/system/admin/authentication_spec.rb @@ -10,21 +10,27 @@ RSpec.describe "Authentication" do let(:user) { create(:user, password: "password", password_confirmation: "password") } let!(:enterprise) { create(:enterprise, owner: user) } # Required for access to admin - it "logging into admin redirects home, then back to admin" do - visit spree.admin_dashboard_path + context "as anonymous user" do + it "logging into admin redirects home, then back to admin" do + visit spree.admin_dashboard_path - fill_in "Email", with: user.email - fill_in "Password", with: user.password - click_login_button - expect(page).to have_content "DASHBOARD" - expect(page).to have_current_path spree.admin_dashboard_path - expect(page).not_to have_content "CONFIGURATION" - end + fill_in "Email", with: user.email + fill_in "Password", with: user.password + click_login_button + expect(page).to have_content "DASHBOARD" + expect(page).to have_current_path spree.admin_dashboard_path + expect(page).not_to have_content "CONFIGURATION" + end - it "viewing my account" do - login_to_admin_section - click_link "Account" - expect(page).to have_current_path spree.account_path + it "viewing my account" do + login_to_admin_section + click_link "Account" + expect(page).to have_current_path spree.account_path + end + + it "is redirected to login page when attempting to access product listing" do + expect { visit spree.admin_products_path }.not_to raise_error + end end context "logged in" do diff --git a/spec/system/admin/products_spec.rb b/spec/system/admin/products_spec.rb index c9823e8f03..c979f34b49 100644 --- a/spec/system/admin/products_spec.rb +++ b/spec/system/admin/products_spec.rb @@ -20,12 +20,6 @@ RSpec.describe ' @enterprise_fees = (0..2).map { |i| create(:enterprise_fee, enterprise: @distributors[i]) } end - context "as anonymous user" do - it "is redirected to login page when attempting to access product listing" do - expect { visit spree.admin_products_path }.not_to raise_error - end - end - describe "creating a product" do let!(:tax_category) { create(:tax_category, name: 'Test Tax Category') } From a8ff6967926fb746828229b3c8d2d0b70b39ef37 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 10 Jun 2024 10:36:30 -0600 Subject: [PATCH 03/14] Removes deleting and cloning test from the legacy bulk product edit page These are covered in the new BUU products page --- spec/system/admin/products_spec.rb | 46 ------------------------------ 1 file changed, 46 deletions(-) diff --git a/spec/system/admin/products_spec.rb b/spec/system/admin/products_spec.rb index c979f34b49..987da7443e 100644 --- a/spec/system/admin/products_spec.rb +++ b/spec/system/admin/products_spec.rb @@ -256,52 +256,6 @@ RSpec.describe ' end end - describe "deleting" do - let!(:product1) { create(:simple_product, name: 'a product to keep', supplier: @supplier) } - - context 'a simple product' do - let!(:product2) { create(:simple_product, name: 'a product to delete', supplier: @supplier) } - - before do - login_as_admin - visit spree.admin_products_path - - within "#p_#{product2.id}" do - accept_alert { page.find("[data-powertip=Remove]").click } - end - visit current_path - end - - it 'removes it from the product list' do - expect(page).not_to have_selector "#p_#{product2.id}" - expect(page).to have_selector "#p_#{product1.id}" - end - end - end - - describe 'cloning' do - let!(:product1) { - create(:simple_product, name: 'a weight product', supplier: @supplier, variant_unit: "weight") - } - - context 'products' do - before do - login_as_admin - visit spree.admin_products_path - end - - it 'creates a copy of the product' do - within "#p_#{product1.id}" do - page.find("[data-powertip=Clone]").click - end - visit current_path - within "#p_#{product1.id + 1}" do - expect(page).to have_input "product_name", with: 'COPY OF a weight product' - end - end - end - end - context "as an enterprise user" do let!(:tax_category) { create(:tax_category) } let(:filter) { { producerFilter: 2 } } From 50359695b533f6f0fc5afa81a29e719e3ce1d4e3 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 10 Jun 2024 10:53:41 -0600 Subject: [PATCH 04/14] Removes comment on issue #7180, now closed --- spec/system/admin/products_spec.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/spec/system/admin/products_spec.rb b/spec/system/admin/products_spec.rb index 987da7443e..65faf9c4d9 100644 --- a/spec/system/admin/products_spec.rb +++ b/spec/system/admin/products_spec.rb @@ -662,9 +662,6 @@ RSpec.describe ' context "editing a product's variant unit scale" do let(:product) { create(:simple_product, name: 'a product', supplier: @supplier2) } - # TODO below -> assertions commented out refer to bug: - # https://github.com/openfoodfoundation/openfoodnetwork/issues/7180 - before do allow(Spree::Config).to receive(:available_units).and_return("g,lb,oz,kg,T,mL,L,kL") visit spree.edit_admin_product_path product From d5ae9b5bccc2ddb1dd8ad8a1afa8760d49e38124 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 10 Jun 2024 16:41:47 -0600 Subject: [PATCH 05/14] Adds a test to assure that the new product path works as expected The funcitonaliy itself should not be affected by BUU, so the tests remain at ./spec/system/admin/products_spec.rb --- spec/system/admin/products_v3/products_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/system/admin/products_v3/products_spec.rb b/spec/system/admin/products_v3/products_spec.rb index c861dc933b..67a404abdb 100644 --- a/spec/system/admin/products_v3/products_spec.rb +++ b/spec/system/admin/products_v3/products_spec.rb @@ -623,6 +623,15 @@ RSpec.describe 'As an enterprise user, I can manage my products', feature: :admi end end + describe "creating a new product" do + it "redirects to the New Product page" do + visit admin_products_url + expect { + click_link("New Product") + }.to change { current_path }.to(spree.new_admin_product_path) + end + end + describe "adding variants" do it "creates a new variant" do click_on "New variant" From 2725232902b19ac1184448d073ce4e57de67af09 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 10 Jun 2024 17:23:14 -0600 Subject: [PATCH 06/14] Adds tests around managing rights -> 'as an enterprise manager' --- .../system/admin/products_v3/products_spec.rb | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/spec/system/admin/products_v3/products_spec.rb b/spec/system/admin/products_v3/products_spec.rb index 67a404abdb..4a24515e1f 100644 --- a/spec/system/admin/products_v3/products_spec.rb +++ b/spec/system/admin/products_v3/products_spec.rb @@ -1381,6 +1381,46 @@ RSpec.describe 'As an enterprise user, I can manage my products', feature: :admi end end + context "as an enterprise manager" do + let(:supplier_managed1) { create(:supplier_enterprise, name: 'Supplier Managed 1') } + let(:supplier_managed2) { create(:supplier_enterprise, name: 'Supplier Managed 2') } + let(:supplier_unmanaged) { create(:supplier_enterprise, name: 'Supplier Unmanaged') } + let(:supplier_permitted) { create(:supplier_enterprise, name: 'Supplier Permitted') } + let(:distributor_managed) { create(:distributor_enterprise, name: 'Distributor Managed') } + let(:distributor_unmanaged) { create(:distributor_enterprise, name: 'Distributor Unmanaged') } + let!(:product_supplied) { create(:product, supplier: supplier_managed1, price: 10.0) } + let!(:product_not_supplied) { create(:product, supplier: supplier_unmanaged) } + let!(:product_supplied_permitted) { + create(:product, name: 'Product Permitted', supplier: supplier_permitted, price: 10.0) + } + let(:product_supplied_inactive) { + create(:product, supplier: supplier_managed1, price: 10.0) + } + + let!(:supplier_permitted_relationship) do + create(:enterprise_relationship, parent: supplier_permitted, child: supplier_managed1, + permissions_list: [:manage_products]) + end + + before do + @enterprise_user = create(:user) + @enterprise_user.enterprise_roles.build(enterprise: supplier_managed1).save + @enterprise_user.enterprise_roles.build(enterprise: supplier_managed2).save + @enterprise_user.enterprise_roles.build(enterprise: distributor_managed).save + + login_as @enterprise_user + end + + it "shows only products that I supply" do + visit spree.admin_products_path + + # displays permitted product list only + expect(page).to have_selector row_containing_name(product_supplied.name) + expect(page).to have_selector row_containing_name(product_supplied_permitted.name) + expect(page).not_to have_selector row_containing_name(product_not_supplied.name) + end + end + def create_products(amount) amount.times do |i| create(:simple_product, name: "product #{i}", supplier: producer) From 3b0779d3a73a5a4d2417e9c8bbb6b1c3eee9bf09 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Mon, 10 Jun 2024 18:34:48 -0600 Subject: [PATCH 07/14] reverts changes on products_spec --- spec/system/admin/products_spec.rb | 75 ++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/spec/system/admin/products_spec.rb b/spec/system/admin/products_spec.rb index 65faf9c4d9..6749306522 100644 --- a/spec/system/admin/products_spec.rb +++ b/spec/system/admin/products_spec.rb @@ -256,6 +256,81 @@ RSpec.describe ' end end + describe "deleting" do + let!(:product1) { create(:simple_product, name: 'a product to keep', supplier: @supplier) } + + context 'a simple product' do + let!(:product2) { create(:simple_product, name: 'a product to delete', supplier: @supplier) } + + before do + login_as_admin + visit spree.admin_products_path + + within "#p_#{product2.id}" do + accept_alert { page.find("[data-powertip=Remove]").click } + end + visit current_path + end + + it 'removes it from the product list' do + expect(page).not_to have_selector "#p_#{product2.id}" + expect(page).to have_selector "#p_#{product1.id}" + end + end + + context 'a shipped product' do + let!(:order) { create(:shipped_order, line_items_count: 1) } + let!(:line_item) { order.reload.line_items.first } + + context "a deleted line item from a shipped order" do + before do + login_as_admin + visit spree.admin_products_path + + within "#p_#{order.variants.first.product_id}" do + accept_alert { page.find("[data-powertip=Remove]").click } + end + end + + it 'removes it from the product list' do + visit spree.admin_products_path + + expect(page).to have_selector "#p_#{product1.id}" + expect(page).not_to have_selector "#p_#{order.variants.first.product_id}" + end + + it 'keeps the line item on the order (admin)' do + visit spree.edit_admin_order_path(order) + + expect(page).to have_content(line_item.product.name.to_s) + end + end + end + end + + describe 'cloning' do + let!(:product1) { + create(:simple_product, name: 'a weight product', supplier: @supplier, variant_unit: "weight") + } + + context 'products' do + before do + login_as_admin + visit spree.admin_products_path + end + + it 'creates a copy of the product' do + within "#p_#{product1.id}" do + page.find("[data-powertip=Clone]").click + end + visit current_path + within "#p_#{product1.id + 1}" do + expect(page).to have_input "product_name", with: 'COPY OF a weight product' + end + end + end + end + context "as an enterprise user" do let!(:tax_category) { create(:tax_category) } let(:filter) { { producerFilter: 2 } } From c4c7f03b6bdd8132f606c56ceaff71eacfb8a610 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Tue, 11 Jun 2024 13:32:26 -0600 Subject: [PATCH 08/14] Addresses Gaetans review Removes assertions from before block, as Delete case is tested elsewhere Declares enterprise_user variable as a non-instance variable --- spec/system/admin/products_v3/products_spec.rb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/spec/system/admin/products_v3/products_spec.rb b/spec/system/admin/products_v3/products_spec.rb index 4a24515e1f..9b4aa04b4d 100644 --- a/spec/system/admin/products_v3/products_spec.rb +++ b/spec/system/admin/products_v3/products_spec.rb @@ -1365,9 +1365,6 @@ RSpec.describe 'As an enterprise user, I can manage my products', feature: :admi within modal_selector do page.find(delete_button_selector).click end - - expect(page).not_to have_selector(modal_selector) - expect(page).not_to have_selector(variant_selector) end it 'keeps the line item on the order (admin)' do @@ -1403,12 +1400,12 @@ RSpec.describe 'As an enterprise user, I can manage my products', feature: :admi end before do - @enterprise_user = create(:user) - @enterprise_user.enterprise_roles.build(enterprise: supplier_managed1).save - @enterprise_user.enterprise_roles.build(enterprise: supplier_managed2).save - @enterprise_user.enterprise_roles.build(enterprise: distributor_managed).save + enterprise_user = create(:user) + enterprise_user.enterprise_roles.build(enterprise: supplier_managed1).save + enterprise_user.enterprise_roles.build(enterprise: supplier_managed2).save + enterprise_user.enterprise_roles.build(enterprise: distributor_managed).save - login_as @enterprise_user + login_as enterprise_user end it "shows only products that I supply" do From 039203485058d5292a14b21f5531ed289b5b8c48 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Tue, 11 Jun 2024 14:15:22 -0600 Subject: [PATCH 09/14] Adds test case on enterprise permissions --- .../system/admin/products_v3/products_spec.rb | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/spec/system/admin/products_v3/products_spec.rb b/spec/system/admin/products_v3/products_spec.rb index 9b4aa04b4d..18e30aa0bc 100644 --- a/spec/system/admin/products_v3/products_spec.rb +++ b/spec/system/admin/products_v3/products_spec.rb @@ -1416,6 +1416,28 @@ RSpec.describe 'As an enterprise user, I can manage my products', feature: :admi expect(page).to have_selector row_containing_name(product_supplied_permitted.name) expect(page).not_to have_selector row_containing_name(product_not_supplied.name) end + + it "shows only suppliers that I manage or have permission to" do + visit spree.admin_products_path + + within row_containing_name(product_supplied.name) do + page.has_select?( + '_products_0_supplier_id', + options: [ + supplier_managed1.name, supplier_managed2.name, supplier_permitted.name + ], selected: supplier_managed1.name + ) + end + + within row_containing_name(product_supplied_permitted.name) do + page.has_select?( + '_products_0_supplier_id', + options: [ + supplier_managed1.name, supplier_managed2.name, supplier_permitted.name + ], selected: supplier_managed1.name + ) + end + end end def create_products(amount) From 8e2419040e9740678175ea69999924c504a456e0 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Tue, 11 Jun 2024 14:22:50 -0600 Subject: [PATCH 10/14] Adds test around inactive product --- spec/system/admin/products_v3/products_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/system/admin/products_v3/products_spec.rb b/spec/system/admin/products_v3/products_spec.rb index 18e30aa0bc..3f85a7e64f 100644 --- a/spec/system/admin/products_v3/products_spec.rb +++ b/spec/system/admin/products_v3/products_spec.rb @@ -1438,6 +1438,14 @@ RSpec.describe 'As an enterprise user, I can manage my products', feature: :admi ) end end + + it "shows inactive products that I supply" do + product_supplied_inactive + + visit spree.admin_products_path + + expect(page).to have_selector row_containing_name(product_supplied_inactive.name) + end end def create_products(amount) From 417fd21470ec96df4e1025c815d52f037341e652 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Tue, 11 Jun 2024 14:28:14 -0600 Subject: [PATCH 11/14] Adds test to check permissions when creating a new product --- .../system/admin/products_v3/products_spec.rb | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/spec/system/admin/products_v3/products_spec.rb b/spec/system/admin/products_v3/products_spec.rb index 3f85a7e64f..1c08741ad0 100644 --- a/spec/system/admin/products_v3/products_spec.rb +++ b/spec/system/admin/products_v3/products_spec.rb @@ -1446,6 +1446,34 @@ RSpec.describe 'As an enterprise user, I can manage my products', feature: :admi expect(page).to have_selector row_containing_name(product_supplied_inactive.name) end + + it "allows me to create a product" do + taxon = create(:taxon, name: 'Fruit') + shipping_category = create(:shipping_category) + + visit spree.admin_products_path + + click_link "New Product" + expect(page).to have_content "New Product" + expect(page).to have_select 'product_supplier_id', + with_options: [supplier_managed1.name, supplier_managed2.name, + supplier_permitted.name] + + within 'fieldset#new_product' do + fill_in 'product_name', with: 'Big Bag Of Apples' + select supplier_permitted.name, from: 'product_supplier_id' + select 'Weight (g)', from: 'product_variant_unit_with_scale' + fill_in 'product_unit_value', with: '100' + fill_in 'product_price', with: '10.00' + select taxon.name, from: 'product_primary_taxon_id' + select shipping_category.name, from: 'product_shipping_category_id' + end + click_button 'Create' + + expect(URI.parse(current_url).path).to eq spree.admin_products_path + expect(flash_message).to eq 'Product "Big Bag Of Apples" has been successfully created!' + expect(page).to have_selector row_containing_name('Big Bag Of Apples') + end end def create_products(amount) From 10dbe77f718b83215d97ae462707ce7c74b074e0 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Tue, 11 Jun 2024 14:37:40 -0600 Subject: [PATCH 12/14] Adds test to check permissions when updating a product --- spec/system/admin/products_v3/products_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/system/admin/products_v3/products_spec.rb b/spec/system/admin/products_v3/products_spec.rb index 1c08741ad0..f9606491e1 100644 --- a/spec/system/admin/products_v3/products_spec.rb +++ b/spec/system/admin/products_v3/products_spec.rb @@ -1474,6 +1474,18 @@ RSpec.describe 'As an enterprise user, I can manage my products', feature: :admi expect(flash_message).to eq 'Product "Big Bag Of Apples" has been successfully created!' expect(page).to have_selector row_containing_name('Big Bag Of Apples') end + + it "allows me to update a product" do + visit spree.admin_products_path + + within row_containing_name(product_supplied.name) do + fill_in "Name", with: "Pommes" + end + click_button "Save changes" + + expect(page).to have_content "Changes saved" + expect(page).to have_selector row_containing_name("Pommes") + end end def create_products(amount) From 9e5c21f7cdae649c8284e1f6052d877f5bb1c9da Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Wed, 12 Jun 2024 18:53:29 -0600 Subject: [PATCH 13/14] Corrects test case by adding expect has_select? only returns true or false, it requires an assertion to assure the test is evaluated Improves syntax --- spec/system/admin/products_v3/products_spec.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/spec/system/admin/products_v3/products_spec.rb b/spec/system/admin/products_v3/products_spec.rb index f9606491e1..c60e11d698 100644 --- a/spec/system/admin/products_v3/products_spec.rb +++ b/spec/system/admin/products_v3/products_spec.rb @@ -1419,9 +1419,8 @@ RSpec.describe 'As an enterprise user, I can manage my products', feature: :admi it "shows only suppliers that I manage or have permission to" do visit spree.admin_products_path - within row_containing_name(product_supplied.name) do - page.has_select?( + expect(page).to have_select( '_products_0_supplier_id', options: [ supplier_managed1.name, supplier_managed2.name, supplier_permitted.name @@ -1430,11 +1429,11 @@ RSpec.describe 'As an enterprise user, I can manage my products', feature: :admi end within row_containing_name(product_supplied_permitted.name) do - page.has_select?( - '_products_0_supplier_id', + expect(page).to have_select( + '_products_1_supplier_id', options: [ supplier_managed1.name, supplier_managed2.name, supplier_permitted.name - ], selected: supplier_managed1.name + ], selected: supplier_permitted.name ) end end From 9cd1977cf8e8fd8c8d383337a65182f5f5109fe7 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Thu, 13 Jun 2024 12:15:24 -0600 Subject: [PATCH 14/14] Removes product creation test This is already covered some lines above and on https://github.com/openfoodfoundation/openfoodnetwork/blob/e22bec014bd0318131dba17461b18a46bde0ab0b/spec/system/admin/products_spec.rb#L29 --- .../system/admin/products_v3/products_spec.rb | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/spec/system/admin/products_v3/products_spec.rb b/spec/system/admin/products_v3/products_spec.rb index c60e11d698..4221418a46 100644 --- a/spec/system/admin/products_v3/products_spec.rb +++ b/spec/system/admin/products_v3/products_spec.rb @@ -1446,34 +1446,6 @@ RSpec.describe 'As an enterprise user, I can manage my products', feature: :admi expect(page).to have_selector row_containing_name(product_supplied_inactive.name) end - it "allows me to create a product" do - taxon = create(:taxon, name: 'Fruit') - shipping_category = create(:shipping_category) - - visit spree.admin_products_path - - click_link "New Product" - expect(page).to have_content "New Product" - expect(page).to have_select 'product_supplier_id', - with_options: [supplier_managed1.name, supplier_managed2.name, - supplier_permitted.name] - - within 'fieldset#new_product' do - fill_in 'product_name', with: 'Big Bag Of Apples' - select supplier_permitted.name, from: 'product_supplier_id' - select 'Weight (g)', from: 'product_variant_unit_with_scale' - fill_in 'product_unit_value', with: '100' - fill_in 'product_price', with: '10.00' - select taxon.name, from: 'product_primary_taxon_id' - select shipping_category.name, from: 'product_shipping_category_id' - end - click_button 'Create' - - expect(URI.parse(current_url).path).to eq spree.admin_products_path - expect(flash_message).to eq 'Product "Big Bag Of Apples" has been successfully created!' - expect(page).to have_selector row_containing_name('Big Bag Of Apples') - end - it "allows me to update a product" do visit spree.admin_products_path