Sha256: dd0c5c96717a559748882592704c2c655e43d827085af46a92fc82aefdfc3ab6

Contents?: true

Size: 1.37 KB

Versions: 84

Compression:

Stored size: 1.37 KB

Contents

module Daddy
  module Cucumber
    module Html
      
      def find_tr(table_selector, text, fail_on_missing = true)
        within table_selector do
          all('tr').each do |tr|
            if tr.text.include?(text)
              if block_given?
                within tr do
                  yield tr
                end
              end
              return tr
            end
          end
        end
        
        fail "テーブル #{table_selector} 内に #{text} を含む行が見つかりませでした。" if fail_on_missing
      end
    
      def find_option(select_selector, text, fail_on_missing = true)
        within select_selector do
          all('option').each do |option|
            if option.text.include?(text)
              if block_given?
                within option do
                  yield
                end
              end
              return option
            end
          end
        end
        
        fail "セレクトボックス #{select_selector} 内に #{text} を含むオプションが見つかりませでした。" if fail_on_missing
      end

      def confirm(ok = true)
        return unless Capybara.current_driver == :selenium

        if ok
          page.driver.browser.switch_to.alert.accept
        else
          page.driver.browser.switch_to.alert.deny
        end
      end

    end
  end
end

World(Daddy::Cucumber::Html)

Version data entries

84 entries across 84 versions & 1 rubygems

Version Path
daddy-0.9.19 lib/daddy/cucumber/helpers/html.rb
daddy-0.9.18 lib/daddy/cucumber/helpers/html.rb
daddy-0.9.17 lib/daddy/cucumber/helpers/html.rb
daddy-0.9.16 lib/daddy/cucumber/helpers/html.rb
daddy-0.9.15 lib/daddy/cucumber/helpers/html.rb
daddy-0.9.14 lib/daddy/cucumber/helpers/html.rb
daddy-0.9.13 lib/daddy/cucumber/helpers/html.rb
daddy-0.9.12 lib/daddy/cucumber/helpers/html.rb
daddy-0.9.11 lib/daddy/cucumber/helpers/html.rb
daddy-0.9.10 lib/daddy/cucumber/helpers/html.rb
daddy-0.9.9 lib/daddy/cucumber/helpers/html.rb
daddy-0.9.8 lib/daddy/cucumber/helpers/html.rb
daddy-0.9.7 lib/daddy/cucumber/helpers/html.rb
daddy-0.9.6 lib/daddy/cucumber/helpers/html.rb
daddy-0.9.5 lib/daddy/cucumber/helpers/html.rb
daddy-0.9.4 lib/daddy/cucumber/helpers/html.rb
daddy-0.9.3 lib/daddy/cucumber/helpers/html.rb
daddy-0.9.2 lib/daddy/cucumber/helpers/html.rb
daddy-0.9.1 lib/daddy/cucumber/helpers/html.rb
daddy-0.9.0 lib/daddy/cucumber/helpers/html.rb