class ActiveSupport::TestCase
Public Instance Methods
css_in_page(css, flag=true)
click to toggle source
Check that a css element is on the page, set flag to check that it isn’t
# File lib/page-right.rb, line 24 def css_in_page(css, flag=true) if flag assert page.has_css?("#{css}"), "Error: #{css} not found on page !" else assert !page.has_css?("#{css}"), "Error: #{css} found on page !" end end
css_in_section(css1, css2, flag=true)
click to toggle source
Check that a css element is nested within another css element, set flag to check that it isn’t
# File lib/page-right.rb, line 33 def css_in_section(css1, css2, flag=true) within("#{css1}") do if flag assert page.has_css?("#{css2}"), "Error: #{css2} not found in #{css1} !" else assert !page.has_css?("#{css2}"), "Error: #{css2} found in #{css1} !" end end end
image_in_section(section, image, count, flag=true)
click to toggle source
Check that ‘count’ number of ‘image’s is in a ‘section’ of css, set flag to check that it/they isn’t/arn’t
# File lib/page-right.rb, line 44 def image_in_section(section, image, count, flag=true) if flag assert page.has_selector?(:css,"#{section} img[src$='/assets/#{image}']", count: count), "Error: #{count} #{image}(s) not found in #{section} !" else assert !page.has_selector?(:css,"#{section} img[src$='/assets/#{image}']", count: count), "Error: #{count} #{image}(s) found in #{section} !" end end
text_in_page(content, flag=true)
click to toggle source
Check that the text ‘content’ is on the page, set flag to check that it isn’t
# File lib/page-right.rb, line 4 def text_in_page(content, flag=true) if flag assert page.has_content?("#{content}"), "Error: #{content} not found page !" else assert !page.has_content?("#{content}"), "Error: #{content} found in page !" end end
text_in_section(section, content, flag=true)
click to toggle source
Check that the text ‘content’ is within a particular css section, set flag to check that it isn’t
# File lib/page-right.rb, line 13 def text_in_section(section, content, flag=true) within("#{section}") do if flag assert page.has_content?("#{content}"), "Error: #{content} not found in #{section} !" else assert !page.has_content?("#{content}"), "Error: #{content} found in #{section} !" end end end