Skip to content

Commit

Permalink
Fix failing specs [OFN-12666]
Browse files Browse the repository at this point in the history
  • Loading branch information
wandji20 committed Jul 23, 2024
1 parent 8d2ca2f commit fb29bb2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/admin/bulk_product_update.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ angular.module("ofn.admin").controller "AdminProductEditCtrl", ($scope, $timeout
on_hand: null
price: null
tax_category_id: null
category_id: newVariantCategoryId
category_id: null
DisplayProperties.setShowVariants product.id, true
DirtyProducts.addVariantProperty(product.id, newVariantId, 'category_id', newVariantCategoryId)

Expand Down
5 changes: 4 additions & 1 deletion spec/services/sets/product_set_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,10 @@
[
{ id: product.variants.first.id.to_s }, # default variant unchanged
# omit ID for new variant
{ sku: "new sku", price: "5.00", unit_value: "5", supplier_id: supplier.id },
{
sku: "new sku", price: "5.00", unit_value: "5",
supplier_id: supplier.id, primary_taxon_id: create(:taxon).id
},
]
}
let(:supplier) { create(:supplier_enterprise) }
Expand Down
6 changes: 4 additions & 2 deletions spec/system/admin/products_v3/actions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
login_as user
end

let(:producer_search_selector) { 'input[placeholder="Search for producers"]' }
let(:categories_search_selector) { 'input[placeholder="Search for categories"]' }
let(:producer_search_selector) { 'input[placeholder="Select producer"]' }
let(:categories_search_selector) { 'input[placeholder="Select category"]' }
let(:tax_categories_search_selector) { 'input[placeholder="Search for tax categories"]' }

describe "with no products" do
Expand Down Expand Up @@ -520,6 +520,7 @@ def expect_other_columns_visible
expect(page).to have_select(
'_products_0_variants_attributes_0_supplier_id',
options: [
'Select producer',
supplier_managed1.name, supplier_managed2.name, supplier_permitted.name
], selected: supplier_managed1.name
)
Expand All @@ -529,6 +530,7 @@ def expect_other_columns_visible
expect(page).to have_select(
'_products_1_variants_attributes_0_supplier_id',
options: [
'Select producer',
supplier_managed1.name, supplier_managed2.name, supplier_permitted.name
], selected: supplier_permitted.name
)
Expand Down
9 changes: 7 additions & 2 deletions spec/system/admin/products_v3/create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
include AuthenticationHelper
include WebHelper

let!(:supplier) { create(:supplier_enterprise) }
let!(:taxon) { create(:taxon) }

describe "creating a new product" do
let!(:stock_location) { create(:stock_location, backorderable_default: false) }
let!(:supplier) { create(:supplier_enterprise) }
let!(:distributor) { create(:distributor_enterprise) }
let!(:shipping_category) { create(:shipping_category) }
let!(:taxon) { create(:taxon) }

before { visit_products_page_as_admin }

Expand Down Expand Up @@ -81,6 +82,10 @@
find('input[id$="_display_as"]').fill_in with: "2 grams"
find('button[aria-label="On Hand"]').click
find('input[id$="_price"]').fill_in with: "11.1"

select supplier.name, from: 'Producer'
select taxon.name, from: 'Category'

if stock == "on_hand"
find('input[id$="_on_hand"]').fill_in with: "66"
elsif stock == "on_demand"
Expand Down

0 comments on commit fb29bb2

Please sign in to comment.