spec/features/rule_spec.rb in marty-2.6.8 vs spec/features/rule_spec.rb in marty-2.7.0

- old
+ new

@@ -7,18 +7,21 @@ @save_file = "/tmp/save_#{Process.pid}.psql" save_clean_db(@save_file) Marty::Script.load_scripts dt = DateTime.parse('2017-1-1') p = File.expand_path('../../fixtures/csv/rule', __FILE__) + [Marty::DataGrid, Gemini::XyzRule, Gemini::MyRule].each do |klass| f = '%s/%s.csv' % [p, klass.to_s.sub(/(Gemini|Marty)::/, '')] Marty::DataImporter.do_import(klass, File.read(f), dt, nil, nil, ',') end end + after(:all) do restore_clean_db(@save_file) end + def go_to_my_rules press('Pricing Config.') press('My Rules') expect(page).to have_content 'My Rules' end @@ -55,12 +58,21 @@ # or in the next two methods sleep 1.0 end def column_filter(rv, name, value) - cid = col_id(rv, name) - c = find('#' + cid) + begin + cid = col_id(rv, name) + c = find('#' + cid) + rescue Capybara::ElementNotFound + # Scroll to the element + page.execute_script <<-JS + var element = document.getElementById('#{cid}') + element.scrollIntoView(true); + JS + c = find('#' + cid) + end c.send_keys([:down, :down, :down, :down, :right, value, :return]) sleep 1.0 end def column_filter_toggle(rv, name) @@ -80,9 +92,10 @@ def time_fill_in(idx, value) tm = all(:xpath, "//input[contains(@name, 'timefield')]")[idx] tm.native.clear() tm.native.send_keys(value) end + it 'rule workflow' do log_in_as('marty') go_to_my_rules mrv = netzke_find('my_rule_view') # test required field