Removes _visible: true_ from system specs

This commit is contained in:
filipefurtad0
2022-09-27 16:33:00 +01:00
parent 6783e7f74c
commit 538844a1fb
11 changed files with 68 additions and 72 deletions

View File

@@ -75,43 +75,41 @@ describe '
end
it "displays a column for user's full name" do
expect(page).to have_selector "th.full_name", text: "NAME", visible: true
expect(page).to have_selector "td.full_name", text: o1.bill_address.full_name, visible: true
expect(page).to have_selector "td.full_name", text: "", visible: true
expect(page).to have_selector "th.full_name", text: "NAME"
expect(page).to have_selector "td.full_name", text: o1.bill_address.full_name
expect(page).to have_selector "td.full_name", text: ""
end
it "displays a column for order date" do
expect(page).to have_selector "th.date",
text: I18n.t("admin.orders.bulk_management.order_date").upcase, visible: true
expect(page).to have_selector "td.date", text: o1.completed_at.strftime('%B %d, %Y'),
visible: true
expect(page).to have_selector "td.date", text: o2.completed_at.strftime('%B %d, %Y'),
visible: true
text: I18n.t("admin.orders.bulk_management.order_date").upcase
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", visible: true
expect(page).to have_selector "td.producer", text: li1.product.supplier.name, visible: true
expect(page).to have_selector "td.producer", text: li2.product.supplier.name, visible: true
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", visible: true
expect(page).to have_selector "td.variant", text: li1.product.name, visible: true
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}", visible: true
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", visible: true
expect(page).to have_field "quantity", with: li1.quantity.to_s, visible: true
expect(page).to have_field "quantity", with: li2.quantity.to_s, visible: true
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", visible: true
expect(page).to have_selector "td.max", text: li1.max_quantity.to_s, visible: true
expect(page).to have_selector "td.max", text: li2.max_quantity.to_s, visible: true
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
end
@@ -677,7 +675,7 @@ describe '
expect(page).to have_content "This operation will result in one or more empty orders, which will be cancelled. Do you wish to proceed?"
expect do
within(".modal", visible: true) do
within(".modal") do
check("send_cancellation_email")
click_on("OK")
end
@@ -708,7 +706,7 @@ describe '
find("div#bulk-actions-dropdown").click
find("div#bulk-actions-dropdown div.menu_item", text: "Delete Selected" ).click
within ".modal", visible: true do
within ".modal" do
click_on("OK")
end
@@ -801,7 +799,7 @@ describe '
end
it "the user can cancel : no line item is deleted" do
within(".modal", visible: true) do
within(".modal") do
click_on("Cancel")
end
expect(o2.reload.line_items.length).to eq(1)
@@ -810,7 +808,7 @@ describe '
it "the user can confirm : line item is then deleted and order is canceled" do
expect do
within(".modal", visible: true) do
within(".modal") do
uncheck("send_cancellation_email")
click_on("OK")
end
@@ -821,7 +819,7 @@ describe '
it "the user can confirm + wants to send email confirmation : line item is then deleted, order is canceled and email is sent" do
expect do
within(".modal", visible: true) do
within(".modal") do
check("send_cancellation_email")
click_on("OK")
end
@@ -868,7 +866,7 @@ describe '
end
it "displays group buy calc box" do
expect(page).to have_selector "div#group_buy_calculation", visible: true
expect(page).to have_selector "div#group_buy_calculation"
within "div#group_buy_calculation" do
expect(page).to have_text "Group Buy Unit Size"
@@ -881,7 +879,7 @@ describe '
expect(page).to have_text "0.8"
expect(page).to have_text "Max Fulfilled Units"
expect(page).to have_text "1.8"
expect(page).to have_selector "div.shared_resource", visible: true
expect(page).to have_selector "div.shared_resource"
within "div.shared_resource" do
expect(page).to have_selector "span", text: "Shared Resource?"
expect(page).to have_selector "input#shared_resource"
@@ -890,10 +888,10 @@ describe '
end
it "all line items of the same variant" do
expect(page).to have_no_selector "tr#li_#{li1.id}", visible: true
expect(page).to have_no_selector "tr#li_#{li2.id}", visible: true
expect(page).to have_selector "tr#li_#{li3.id}", visible: true
expect(page).to have_selector "tr#li_#{li4.id}", visible: true
expect(page).to have_no_selector "tr#li_#{li1.id}"
expect(page).to have_no_selector "tr#li_#{li2.id}"
expect(page).to have_selector "tr#li_#{li3.id}"
expect(page).to have_selector "tr#li_#{li4.id}"
end
context "clicking 'Clear' in group buy box" do
@@ -902,11 +900,11 @@ describe '
end
it "shows all products and clears group buy box" do
expect(page).to have_no_selector "div#group_buy_calculation", visible: true
expect(page).to have_selector "tr#li_#{li1.id}", visible: true
expect(page).to have_selector "tr#li_#{li2.id}", visible: true
expect(page).to have_selector "tr#li_#{li3.id}", visible: true
expect(page).to have_selector "tr#li_#{li4.id}", visible: true
expect(page).to have_no_selector "div#group_buy_calculation"
expect(page).to have_selector "tr#li_#{li1.id}"
expect(page).to have_selector "tr#li_#{li2.id}"
expect(page).to have_selector "tr#li_#{li3.id}"
expect(page).to have_selector "tr#li_#{li4.id}"
end
end
end
@@ -949,8 +947,8 @@ describe '
it "shows only line item from orders that I distribute, and not those that I supply" do
visit_bulk_order_management
expect(page).to have_selector "tr#li_#{line_item_distributed.id}", visible: true
expect(page).to have_no_selector "tr#li_#{line_item_not_distributed.id}", visible: true
expect(page).to have_selector "tr#li_#{line_item_distributed.id}"
expect(page).to have_no_selector "tr#li_#{line_item_not_distributed.id}"
end
end

View File

@@ -21,8 +21,8 @@ describe '
visit spree.admin_products_path
expect(page).to have_field "product_name", with: p1.name, visible: true
expect(page).to have_field "product_name", with: p2.name, visible: true
expect(page).to have_field "product_name", with: p1.name
expect(page).to have_field "product_name", with: p2.name
end
it "displays a message when number of products is zero" do
@@ -79,9 +79,9 @@ describe '
expect(page).to have_selector "a.view-variants", count: 1
find("a.view-variants").click
expect(page).to have_no_selector "span[name='on_hand']", text: "On demand", visible: true
expect(page).to have_no_selector "span[name='on_hand']", text: "On demand"
expect(page).to have_field "variant_on_hand", with: "4"
expect(page).to have_no_field "variant_on_hand", with: "", visible: true
expect(page).to have_no_field "variant_on_hand", with: ""
expect(page).to have_selector "span[name='variant_on_hand']", text: "On demand"
end
@@ -240,8 +240,8 @@ describe '
it "handle the default behaviour" do
# When I add three variants
page.find('a.add-variant', visible: true).click
page.find('a.add-variant', visible: true).click
page.find('a.add-variant').click
page.find('a.add-variant').click
# They should be added, and should not see edit buttons for new variants
expect(page).to have_selector "tr.variant", count: 3
@@ -249,10 +249,10 @@ describe '
# When I remove two, they should be removed
accept_alert do
page.all('a.delete-variant', visible: true).first.click
page.all('a.delete-variant').first.click
end
expect(page).to have_selector "tr.variant", count: 2
page.all('a.delete-variant', visible: true).first.click
page.all('a.delete-variant').first.click
expect(page).to have_selector "tr.variant", count: 1
# When I fill out variant details and hit update
@@ -274,7 +274,7 @@ describe '
expect(updated_variant.on_hand).to eq 10
# Then I should see edit buttons for the new variant
expect(page).to have_selector "a.edit-variant", visible: true
expect(page).to have_selector "a.edit-variant"
end
context "handle the 'on_demand' variant case creation" do
@@ -912,10 +912,10 @@ describe '
attach_file 'image-upload', Rails.root.join("public/500.jpg"), visible: false
# Shows spinner whilst loading
expect(page).to have_css ".spinner", visible: true
expect(page).to have_css ".spinner"
end
expect(page).to have_no_css ".spinner", visible: true
expect(page).to have_no_css ".spinner"
expect(page).to have_no_selector "div.reveal-modal"
within "table#listing_products tr#p_#{product.id}" do

View File

@@ -35,7 +35,7 @@ describe 'Enterprises Index' do
end
context "editing enterprises in bulk" do
let!(:s){ create(:supplier_enterprise, visible: true) }
let!(:s){ create(:supplier_enterprise) }
let!(:d){ create(:distributor_enterprise, sells: 'none') }
let!(:d_manager) { create(:user, enterprise_limit: 1) }

View File

@@ -79,9 +79,8 @@ xdescribe '
open_all_exchange_product_tabs
expect(page).to have_selector "#order_cycle_incoming_exchange_1_variants_#{initial_variants.last.id}",
visible: true
page.find("#order_cycle_incoming_exchange_1_variants_#{initial_variants.last.id}", visible: true).click # uncheck (with visible:true filter)
expect(page).to have_selector "#order_cycle_incoming_exchange_1_variants_#{initial_variants.last.id}"
page.find("#order_cycle_incoming_exchange_1_variants_#{initial_variants.last.id}").click # uncheck (with visible:true filter)
check "order_cycle_incoming_exchange_2_variants_#{v1.id}"
check "order_cycle_incoming_exchange_2_variants_#{v2.id}"

View File

@@ -139,7 +139,7 @@ describe '
end
it "show a modal 'Are you sure?' that the user can close and then nothing change" do
within(".modal", visible: true) do
within(".modal") do
expect do
click_on("Cancel")
expect(page).not_to have_content "Are you sure?"
@@ -149,10 +149,10 @@ describe '
it "show a modal 'Are you sure?' that the user confirm and then the item is deleted" do
expect(order.line_items.length).to eq(2)
within(".modal", visible: true) do
within(".modal") do
expect do
click_on("OK")
expect(page).not_to have_css(".modal", visible: true)
expect(page).not_to have_css(".modal")
end.to change { order.reload.line_items.length }.by(-1)
end
end
@@ -170,7 +170,7 @@ describe '
it "that the user can close and then nothing change" do
expect(page).to have_content "This will cancel the current order."
expect(page).to have_checked_field "Send a cancellation email to the customer"
within(".modal", visible: true) do
within(".modal") do
click_on("Cancel")
end
@@ -181,7 +181,7 @@ describe '
context "that the user can confirm" do
it "and then the order is cancelled and no email is sent by default" do
expect do
within(".modal", visible: true) do
within(".modal") do
uncheck("send_cancellation_email")
click_on("OK")
end
@@ -193,7 +193,7 @@ describe '
it "and check the checkbox to send an email to the customer about its order cancellation" do
expect do
within(".modal", visible: true) do
within(".modal") do
click_on("OK")
end
expect(page).to have_content "Cannot add item to canceled order"
@@ -206,7 +206,7 @@ describe '
context "that the user can choose to restock item" do
let(:shipment) { order.shipments.first }
it "uncheck the checkbox to not restock item" do
within(".modal", visible: true) do
within(".modal") do
check("restock_items")
click_on("OK")
end

View File

@@ -693,7 +693,7 @@ describe "Product Import", js: true do
expect(page).to have_selector '.create-count', text: "1"
expect(page.body).to have_content 'you do not have permission'
expect(page).to have_no_selector 'a.button.proceed', visible: true
expect(page).to have_no_selector 'a.button.proceed'
end
end
@@ -739,16 +739,16 @@ describe "Product Import", js: true do
private
def proceed_to_validation
expect(page).to have_selector 'a.button.proceed', visible: true
expect(page).to have_selector 'a.button.proceed'
within("#content") { click_link I18n.t('admin.product_import.import.import') }
expect(page).to have_selector 'form.product-import', visible: true
expect(page).to have_selector 'form.product-import'
expect(page).to have_content I18n.t('admin.product_import.import.validation_overview')
end
def save_data
expect(page).to have_selector 'a.button.proceed', visible: true
expect(page).to have_selector 'a.button.proceed'
proceed_with_save
expect(page).to have_selector 'div.save-results', visible: true
expect(page).to have_selector 'div.save-results'
expect_import_completed
end

View File

@@ -513,8 +513,7 @@ describe "
product = create(:simple_product, supplier: supplier)
InventoryItem.create!(
enterprise: supplier,
variant: product.variants.first,
visible: true
variant: product.variants.first
)
end
first_variant = inventory_items.first.variant

View File

@@ -64,7 +64,7 @@ describe "Darkswarm data caching", js: true, caching: true do
visit shops_path
# Wait for /shops page to load properly before checking for new timestamps
expect(page).to_not have_selector ".row.filter-row", visible: true
expect(page).to_not have_selector ".row.filter-row"
taxon_timestamp2 = CacheService.latest_timestamp_by_class(Spree::Taxon)
expect_cached "views/#{CacheService::FragmentCaching.ams_all_taxons[0]}"

View File

@@ -128,11 +128,11 @@ describe "Cookies", js: true do
end
def expect_visible_cookies_banner
expect(page).to have_css("button", text: accept_cookies_button_text, visible: true)
expect(page).to have_css("button", text: accept_cookies_button_text)
end
def expect_not_visible_cookies_banner
expect(page).to have_no_css("button", text: accept_cookies_button_text, visible: true)
expect(page).to have_no_css("button", text: accept_cookies_button_text)
end
def accept_cookies_button_text

View File

@@ -110,7 +110,7 @@ describe "As a consumer I want to check out my cart", js: true do
click_button 'Next'
end
expect(page).to have_selector 'div.login-modal', visible: true
expect(page).to have_selector 'div.login-modal'
expect(page).to have_content I18n.t('devise.failure.already_registered')
end
end

View File

@@ -89,7 +89,7 @@ describe "As a consumer I want to shop with a distributor", js: true do
expect(page).to have_selector "option", text: 'frogs'
expect(page).to have_selector "option", text: 'turtles'
expect(page).to have_content "choose when you want your order"
expect(page).not_to have_selector("input.button.right", visible: true)
expect(page).not_to have_selector("input.button.right")
end
it "shows products after selecting an order cycle" do