diff --git a/spec/system/admin/bulk_product_update_spec.rb b/spec/system/admin/bulk_product_update_spec.rb index 44263240fd..cdb45b9a16 100644 --- a/spec/system/admin/bulk_product_update_spec.rb +++ b/spec/system/admin/bulk_product_update_spec.rb @@ -10,6 +10,11 @@ RSpec.describe ' include AuthenticationHelper include WebHelper + around do |example| + Flipper.disable(:admin_style_v3) + example.run + end + describe "listing products" do before do login_as_admin @@ -18,7 +23,6 @@ RSpec.describe ' it "displays a list of products" do p1 = FactoryBot.create(:product) p2 = FactoryBot.create(:product) - visit spree.admin_products_path expect(page).to have_field "product_name", with: p1.name @@ -201,8 +205,8 @@ RSpec.describe ' login_as_admin visit spree.admin_products_path - find("a", text: "New Product").click - expect(page).to have_content 'New Product' + find("a", text: "NEW PRODUCT").click + expect(page).to have_content "NEW PRODUCT" fill_in 'product_name', with: 'Big Bag Of Apples' select supplier.name, from: 'product_supplier_id' @@ -700,14 +704,14 @@ RSpec.describe ' login_as_admin visit spree.admin_products_path - expect(page).to have_selector "th", text: "Name" - expect(page).to have_selector "th", text: "Producer" - expect(page).to have_selector "th", text: "Price" - expect(page).to have_selector "th", text: "On Hand" + expect(page).to have_selector "th", text: "NAME" + expect(page).to have_selector "th", text: "PRODUCER" + expect(page).to have_selector "th", text: "PRICE" + expect(page).to have_selector "th", text: "ON HAND" toggle_columns /^.{0,1}Producer$/i - expect(page).not_to have_selector "th", text: "Producer" + expect(page).to have_no_selector "th", text: "Producer" expect(page).to have_selector "th", text: "Name" expect(page).to have_selector "th", text: "Price" expect(page).to have_selector "th", text: "On Hand" @@ -815,8 +819,8 @@ RSpec.describe ' visit spree.admin_products_path - find("a", text: "New Product").click - expect(page).to have_content 'New Product' + find("a", text: "NEW PRODUCT").click + 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] diff --git a/spec/system/admin/product_import_spec.rb b/spec/system/admin/product_import_spec.rb index 895a4af94f..4cefc9b0e9 100644 --- a/spec/system/admin/product_import_spec.rb +++ b/spec/system/admin/product_import_spec.rb @@ -8,6 +8,11 @@ RSpec.describe "Product Import" do include AuthenticationHelper include WebHelper + around do |example| + Flipper.disable(:admin_style_v3) + example.run + end + let!(:admin) { create(:admin_user) } let!(:user) { create(:user) } let!(:user2) { create(:user) } @@ -706,7 +711,8 @@ RSpec.describe "Product Import" do save_data expect(page).to have_selector '.created-count', text: '1' - expect(page).not_to have_selector '.updated-count' + + expect(page).to have_no_selector '.updated-count' expect(page).to have_content "Go To Products Page" expect(page).to have_content "Upload Another File" diff --git a/spec/system/admin/products_spec.rb b/spec/system/admin/products_spec.rb index 2ca528c261..c2514051d3 100644 --- a/spec/system/admin/products_spec.rb +++ b/spec/system/admin/products_spec.rb @@ -280,76 +280,86 @@ 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 + describe "legacy products page" do + around do |example| + Flipper.disable(:admin_style_v3) + example.run end - context 'a shipped product' do - let!(:order) { create(:shipped_order, line_items_count: 1) } - let!(:line_item) { order.reload.line_items.first } + 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) + } - 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 + 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 - visit spree.admin_products_path - + expect(page).not_to have_selector "#p_#{product2.id}" expect(page).to have_selector "#p_#{product1.id}" - expect(page).not_to have_selector "#p_#{order.variants.first.product_id}" end + end - it 'keeps the line item on the order (admin)' do - visit spree.edit_admin_order_path(order) + context 'a shipped product' do + let!(:order) { create(:shipped_order, line_items_count: 1) } + let!(:line_item) { order.reload.line_items.first } - expect(page).to have_content(line_item.product.name.to_s) + 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 - end - describe 'cloning' do - let!(:product1) { - create(:simple_product, name: 'a weight product', supplier: @supplier, variant_unit: "weight") - } + 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 + context 'products' do + before do + login_as_admin + visit spree.admin_products_path end - visit current_path - within "#p_#{product1.id + 1}" do - expect(page).to have_input "product_name", with: 'COPY OF a weight product' + + 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 diff --git a/spec/system/admin/subscriptions/crud_spec.rb b/spec/system/admin/subscriptions/crud_spec.rb index 2d5ea672ae..e2871dc450 100644 --- a/spec/system/admin/subscriptions/crud_spec.rb +++ b/spec/system/admin/subscriptions/crud_spec.rb @@ -128,7 +128,7 @@ RSpec.describe 'Subscriptions' do accept_alert 'Are you sure?' do find("a.cancel-order").click end - expect(page).to have_content 'CANCELLED'.upcase + expect(page).to have_content 'CANCELLED' expect(proxy_order.reload.canceled_at).to be_within(5.seconds).of Time.zone.now # Resuming an order diff --git a/spec/system/admin/subscriptions/smoke_tests_spec.rb b/spec/system/admin/subscriptions/smoke_tests_spec.rb index 599a4ffe52..bf04215457 100644 --- a/spec/system/admin/subscriptions/smoke_tests_spec.rb +++ b/spec/system/admin/subscriptions/smoke_tests_spec.rb @@ -237,12 +237,14 @@ RSpec.describe 'Subscriptions' do expect(page).to have_selector "#subscription-line-items .item", count: 4 # Delete an existing product + Flipper.disable(:admin_style_v3) # disabling BUU for legacy products page login_as_admin visit spree.admin_products_path within "#p_#{shop_product2.id}" do accept_alert { page.find("[data-powertip=Remove]").click } end + Flipper.enable(:admin_style_v3) # re-enabling it for the rest of the spec visit edit_admin_subscription_path(subscription) # Remove deleted shop_variant from the subscription