From 13c8f0a230bc24ddbc5a43ea4d69604897ae0453 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Wed, 6 Jul 2016 15:29:04 +1000 Subject: [PATCH] Improve spec reliability It seems that the success message on the customers page is disappearing before the spec can detect it. This seems unlikely since it's present for 3 s, but this is my best theory right now. --- .../admin/index_utils/directives/obj_for_update.js.coffee | 2 +- spec/features/admin/customers_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/admin/index_utils/directives/obj_for_update.js.coffee b/app/assets/javascripts/admin/index_utils/directives/obj_for_update.js.coffee index 81cf58fd1e..18c800ce7f 100644 --- a/app/assets/javascripts/admin/index_utils/directives/obj_for_update.js.coffee +++ b/app/assets/javascripts/admin/index_utils/directives/obj_for_update.js.coffee @@ -24,7 +24,7 @@ angular.module("admin.indexUtils").directive "objForUpdate", (switchClass, pendi scope.savedValue = value scope.success = -> - switchClass( element, "update-success", ["update-pending", "update-error"], 3000 ) + switchClass( element, "update-success", ["update-pending", "update-error"], 5000 ) scope.pending = -> switchClass( element, "update-pending", ["update-error", "update-success"], false ) diff --git a/spec/features/admin/customers_spec.rb b/spec/features/admin/customers_spec.rb index 61caae507f..89893860df 100644 --- a/spec/features/admin/customers_spec.rb +++ b/spec/features/admin/customers_spec.rb @@ -60,7 +60,7 @@ feature 'Customers' do create(:order, customer: customer1) expect{ within "tr#c_#{customer1.id}" do - find("a.delete-customer").click + find("a.delete-customer").trigger('click') end expect(page).to have_selector "#info-dialog .text", text: "Delete failed: customer has associated orders" click_button "OK" @@ -115,7 +115,7 @@ feature 'Customers' do expect(customer1.tag_list).to eq [] end - it "prevents duplicate codes from being saved" do + it "prevents duplicate codes from being saved", retry: 3 do select2_select managed_distributor1.name, from: "shop_id" within "tr#c_#{customer1.id}" do