todo: make specs work with admin_style_v3

This commit is contained in:
David Cook
2024-07-01 13:57:38 +10:00
parent 109432d282
commit b1721d69a2
3 changed files with 14 additions and 13 deletions

View File

@@ -8,11 +8,6 @@ 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) }
@@ -101,6 +96,8 @@ RSpec.describe "Product Import" do
wait_until { page.find("a.button.view").present? }
puts "TODO: migrate to v3"
Flipper.disable(:admin_style_v3) # disabling BUU for legacy products page
click_link 'Go To Products Page'
expect(page).to have_content 'Bulk Edit Products'
@@ -213,6 +210,8 @@ RSpec.describe "Product Import" do
potatoes = Spree::Product.find_by(name: 'Potatoes')
expect(potatoes.variants.first.import_date).to be_within(1.minute).of Time.zone.now
puts "TODO: migrate to v3"
Flipper.disable(:admin_style_v3) # disabling BUU for legacy products page
click_link 'Go To Products Page'
wait_until { page.find("#p_#{carrots.id}").present? }
@@ -677,6 +676,8 @@ RSpec.describe "Product Import" do
expect(page).to have_selector '.created-count', text: '2'
expect(page).not_to have_selector '.updated-count'
puts "TODO: migrate to v3"
Flipper.disable(:admin_style_v3) # disabling BUU for legacy products page
visit spree.admin_products_path
within "#p_#{Spree::Product.find_by(name: 'Carrots').id}" do
@@ -713,9 +714,11 @@ RSpec.describe "Product Import" do
expect(page).to have_selector '.created-count', text: '1'
expect(page).not_to have_selector '.updated-count'
expect(page).to have_content "Go To Products Page".upcase
expect(page).to have_content "Upload Another File".upcase
expect(page).to have_content "Go To Products Page"
expect(page).to have_content "Upload Another File"
puts "TODO: migrate to v3"
Flipper.disable(:admin_style_v3) # disabling BUU for legacy products page
visit spree.admin_products_path
within "#p_#{Spree::Product.find_by(name: 'Cupcake').id}" do
@@ -787,7 +790,7 @@ RSpec.describe "Product Import" do
product_headings.each do |heading|
expect(page).to have_content(
I18n.t("admin.product_import.product_headings.#{heading}").upcase
I18n.t("admin.product_import.product_headings.#{heading}")
)
end
end

View File

@@ -280,11 +280,8 @@ RSpec.describe '
end
end
describe "legacy products page" do
around do |example|
Flipper.disable(:admin_style_v3)
example.run
end
describe "legacy products page (TODO: migrate/combine specs with v3 specs)" do
before { Flipper.disable(:admin_style_v3) }
describe "deleting" do
let!(:product1) { create(:simple_product, name: 'a product to keep', supplier: @supplier) }

View File

@@ -237,6 +237,7 @@ RSpec.describe 'Subscriptions' do
expect(page).to have_selector "#subscription-line-items .item", count: 4
# Delete an existing product
puts "TODO: migrate to v3" # but first we need to make the actions menu more accessible.
Flipper.disable(:admin_style_v3) # disabling BUU for legacy products page
login_as_admin
visit spree.admin_products_path