Sha256: bc1c17f1b365539089068afb434b6c8f4f4f9b3aa51719ee9e9189fe832ea5d1
Contents?: true
Size: 1.76 KB
Versions: 1
Compression:
Stored size: 1.76 KB
Contents
# # Then I can see: # | Account Number | 5002 | # | body | 2009-11-01 | # | .note | Nice guy | # Then(/^I can(not)? see:$/) do |is_not, table| if is_not check = -> within, content { within = within.strip.present? ? find_node(within) : page expect(within).not_to have_content(content) } else check = -> within, content { within = within.strip.present? ? find_node(within) : page expect(within).to have_content(content) } end case table.headers.length when 1 check = check.curry[''] table.raw.flatten.each(&check) when 2 table.rows_hash.each(&check) else raise ArgumentError, "Unsupported table format" end end And(/^I can(not)? see video (".*?")( within (?:.*))?$/) do |is_not, video_src, within| within ||= page if is_not expect(within).not_to have_selector("iframe[src=#{video_src}]") else expect(within).to have_selector("iframe[src=#{video_src}]") end end And(/^I can(not)? see image (".*?")( within (?:.*))?$/) do |is_not, image_src, within| within ||= page if is_not expect(within).not_to have_selector("img[src=#{image_src}]") else expect(within).to have_selector("img[src=#{image_src}]") end end Then /^focus is on (.*) ?"(.*?)"$/ do |identifier, locator| node = if identifier Pickles.detect_node(identifier, locator) else Pickles.find_node(locator, within: page) end block_scroll = page.evaluate_script("arguments[0].offsetTop", node) window_height = page.evaluate_script('window.innerHeight') / 2 Waiter.wait do scrolled = page.evaluate_script('document.body.scrollTop') (scrolled <= block_scroll && block_scroll <= scrolled + window_height) || raise(Capybara::ElementNotFound) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pickles-0.1.12 | lib/cucumber/pickles/steps/can_see.rb |