Module: Nuklear::TestCase
- Defined in:
- lib/nuklear/test_case.rb
Instance Method Summary collapse
Instance Method Details
#assert_text(txt) ⇒ Object
25 26 27 28 |
# File 'lib/nuklear/test_case.rb', line 25 def assert_text(txt) refute_empty nuklear.find { |el| el.respond_to?(:text) && el.text[txt] }, "Expected to find at least one element with text: #{txt.inspect}" end |
#click_button(text) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/nuklear/test_case.rb', line 11 def (text) els = nuklear.find do |item| item.kind_of?(Nuklear::UI::Button) && item.respond_to?(:text) && item.text[text] end if els.count > 1 raise "Ambiguous text: #{text} (found #{els.inspect})" elsif els.empty? raise "Cannot find an element with text: #{text.inspect}" else els.first.trigger(:clicked) end tick end |
#nuklear ⇒ Object
3 4 5 |
# File 'lib/nuklear/test_case.rb', line 3 def nuklear @nuklear || raise("Nuklear::TestCase requires you to assign a Nuklear::Context to @nuklear during your test setup.") end |
#tick ⇒ Object
7 8 9 |
# File 'lib/nuklear/test_case.rb', line 7 def tick raise "Nuklear::TestCase requires you to override #tick to process window events and to call your Nuklear::Context#tick method." end |