Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 5th, 2012  |  syntax: None  |  size: 1.15 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. require 'selenium-webdriver'
  2.  
  3. class SVGPage
  4.         def initialize(driver, url)
  5.                 driver.get url
  6.                 @visual_hash = driver.visual_hash
  7.         end
  8.  
  9.         def to_s
  10.                 @visual_hash
  11.         end
  12. end
  13.  
  14. TEST_PAGE = 'http://t/core/bts/interactive/CORE-26624/001-1.html'
  15. REF_PAGE  = 'http://t/core/bts/interactive/CORE-26624/001-2.html'
  16.  
  17. describe 'When disabling images' do
  18.         before :each do
  19.                 @profile = Profile.new
  20.         end
  21.  
  22.         context 'using profile #1' do
  23.                 before :all do
  24.                         @profile.preferences.set('foo', 'bar', 'baz', 0)
  25.                         @driver = Selenium::WebDriver.for :opera, :profile => @profile
  26.                 end
  27.  
  28.                 before :each do
  29.                         @test = SVGPage.new(@driver, TEST_PAGE)
  30.                         @ref  = SVGPage.new(@driver, REF_PAGE)
  31.                 end
  32.  
  33.                 it 'alt texts should be displayed on SVG images' do
  34.                         @test.should match @ref
  35.                 end
  36.         end
  37.  
  38.         context 'using profile #2' do
  39.                 before :all do
  40.                         @profile.preferences.set('foo', 'bar', 'baz', 2)
  41.                         @driver = Selenium::WebDriver.for :opera, :profile => @profile
  42.                 end
  43.  
  44.                 before :each do
  45.                         @test = SVGPage.new(@driver, TEST_PAGE)
  46.                         @ref  = SVGPage.new(@driver, REF_PAGE)
  47.                 end
  48.  
  49.                 it 'alt text should match some other condition' do
  50.                         @test.should match @ref
  51.                 end
  52.         end
  53.  
  54.         after :all do
  55.                 @browser.quit
  56.         end
  57. end