Skip to content

Commit

Permalink
Fixes case on assertions, on failing specs
Browse files Browse the repository at this point in the history
Selects white_label tab with trigger(click)

Scrolling down did no fix it, it still fails https://github.com/openfoodfoundation/openfoodnetwork/actions/runs/6526149195/job/17719815533?pr=11645, selecting the element with trigger(click) should work

Udates invoice tests
  • Loading branch information
filipefurtad0 committed Oct 15, 2023
1 parent ecb0aed commit c50219e
Show file tree
Hide file tree
Showing 31 changed files with 232 additions and 245 deletions.
2 changes: 1 addition & 1 deletion spec/support/features/datepicker_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Features
module DatepickerHelper
def choose_today_from_datepicker
within(".flatpickr-calendar.open") do
find("button", text: "TODAY").click
find("button", text: "Today").click
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/system/admin/authentication_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
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_content "Dashboard"
expect(page).to have_current_path spree.admin_dashboard_path
expect(page).to have_no_content "CONFIGURATION"
expect(page).to have_no_content "Configuration"
end

it "viewing my account" do
Expand Down
46 changes: 23 additions & 23 deletions spec/system/admin/bulk_order_management_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@
end

it "orders by completion date" do
find("a", text: 'COMPLETED AT').click # sets ascending ordering
find("a", text: 'Completed at').click # sets ascending ordering
expect(page).to have_content(
/#{li2.product.name}.*#{li1.product.name}.*#{li22.product.name}.*#{li21.product.name}/m
)
find("a", text: 'COMPLETED AT').click # sets descending ordering
find("a", text: 'Completed at').click # sets descending ordering
expect(page).to have_content(
/#{li21.product.name}.*#{li22.product.name}.*#{li1.product.name}.*#{li2.product.name}/m
)
Expand Down Expand Up @@ -155,9 +155,9 @@
expect(page).to have_content "Little Fish", count: 15
expect(page).not_to have_content "Big Fish"
end
find("a", text: "Clear").click # closes BOM box
expect(page).to have_content "Little Fish", count: 10
click_link "Clear" # closes BOM box
expect(page).to have_content "Big Fish", count: 5
expect(page).to have_content "Little Fish", count: 10
end
end

Expand Down Expand Up @@ -263,7 +263,7 @@
end

it "displays a column for user's full name" do
expect(page).to have_selector "th.full_name", text: "NAME"
expect(page).to have_selector "th.full_name", text: "Name"
expect(page)
.to have_selector "td.full_name",
text: "#{o1.bill_address.last_name}, #{o1.bill_address.first_name}"
Expand All @@ -272,33 +272,33 @@

it "displays a column for order date" do
expect(page).to have_selector "th.date",
text: 'Completed at'.upcase
text: 'Completed at'
expect(page).to have_selector "td.date", text: o1.completed_at.strftime('%B %d, %Y')
expect(page).to have_selector "td.date", text: o2.completed_at.strftime('%B %d, %Y')
end

it "displays a column for producer" do
expect(page).to have_selector "th.producer", text: "PRODUCER"
expect(page).to have_selector "th.producer", text: "Producer"
expect(page).to have_selector "td.producer", text: li1.product.supplier.name
expect(page).to have_selector "td.producer", text: li2.product.supplier.name
end

it "displays a column for variant description, which shows only product name " \
"when options text is blank" do
expect(page).to have_selector "th.variant", text: "PRODUCT: UNIT"
expect(page).to have_selector "th.variant", text: "Product: Unit"
expect(page).to have_selector "td.variant", text: li1.product.name
expect(page).to have_selector "td.variant",
text: "#{li2.product.name}: #{li2.variant.options_text}"
end

it "displays a field for quantity" do
expect(page).to have_selector "th.quantity", text: "QUANTITY"
expect(page).to have_selector "th.quantity", text: "Quantity"
expect(page).to have_field "quantity", with: li1.quantity.to_s
expect(page).to have_field "quantity", with: li2.quantity.to_s
end

it "displays a column for max quantity" do
expect(page).to have_selector "th.max", text: "MAX"
expect(page).to have_selector "th.max", text: "Max"
expect(page).to have_selector "td.max", text: li1.max_quantity.to_s
expect(page).to have_selector "td.max", text: li2.max_quantity.to_s
end
Expand Down Expand Up @@ -502,13 +502,13 @@

context "using column display toggle" do
it "displays the default selected columns" do
expect(page).to have_selector "th", text: "NAME"
expect(page).to have_selector "th", text: "Name"
expect(page).to have_selector "th",
text: 'Completed at'.upcase
expect(page).to have_selector "th", text: "PRODUCER"
expect(page).to have_selector "th", text: "PRODUCT: UNIT"
expect(page).to have_selector "th", text: "QUANTITY"
expect(page).to have_selector "th", text: "MAX"
text: 'Completed at'
expect(page).to have_selector "th", text: "Producer"
expect(page).to have_selector "th", text: "Product: Unit"
expect(page).to have_selector "th", text: "Quantity"
expect(page).to have_selector "th", text: "Max"
end

context "hiding a column, by de-selecting it from the drop-down" do
Expand All @@ -517,13 +517,13 @@
end

it "shows all default columns, except the de-selected column" do
expect(page).to have_no_selector "th", text: "PRODUCER"
expect(page).to have_selector "th", text: "NAME"
expect(page).to have_no_selector "th", text: "Producer"
expect(page).to have_selector "th", text: "Name"
expect(page).to have_selector "th",
text: 'Completed at'.upcase
expect(page).to have_selector "th", text: "PRODUCT: UNIT"
expect(page).to have_selector "th", text: "QUANTITY"
expect(page).to have_selector "th", text: "MAX"
text: 'Completed at'
expect(page).to have_selector "th", text: "Product: Unit"
expect(page).to have_selector "th", text: "Quantity"
expect(page).to have_selector "th", text: "Max"
end
end
end
Expand Down Expand Up @@ -1159,7 +1159,7 @@

context "clicking 'Clear' in group buy box" do
before :each do
find("a", text: "Clear").click
click_link "Clear" # closes BOM box
end

it "shows all products and clears group buy box" do
Expand Down
28 changes: 15 additions & 13 deletions spec/system/admin/bulk_product_update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@
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'
Expand Down Expand Up @@ -311,8 +311,10 @@
end

it "creating a variant with unit value is: '120g' and 'on_demand' checked" do
scroll_to(:bottom)

within "tr#v_#{v2.id}" do
page.find(".add-variant").trigger("click")
page.find(".add-variant").click
end

within "tr#v_-1" do
Expand Down Expand Up @@ -701,17 +703,17 @@
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).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"
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"
end
end

Expand Down Expand Up @@ -816,8 +818,8 @@

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]
Expand Down
2 changes: 1 addition & 1 deletion spec/system/admin/configuration/general_settings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

context 'editing currency symbol position' do
it 'updates its position' do
expect(page).to have_content('CURRENCY SETTINGS')
expect(page).to have_content('Currency Settings')

within('.currency') do
find("[for='currency_symbol_position_after']").click
Expand Down
4 changes: 2 additions & 2 deletions spec/system/admin/customers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
end

it 'updates the existing billing address' do
expect(page).to have_content 'BILLING ADDRESS'
expect(page).to have_content 'Billing Address'
first('#bill-address-link').click
wait_for_modal_fade_in

Expand All @@ -374,7 +374,7 @@
end

it 'creates a new shipping address' do
expect(page).to have_content 'SHIPPING ADDRESS'
expect(page).to have_content 'Shipping Address'

first('#ship-address-link').click
wait_for_modal_fade_in
Expand Down
Loading

0 comments on commit c50219e

Please sign in to comment.