Class: KonquerorBrowser

Inherits:
Browser show all
Defined in:
lib/newjs/jstest.rb

Constant Summary collapse

@@configDir =
File.join((ENV['HOME'] || ''), '.kde', 'share', 'config')
@@globalConfig =
File.join(@@configDir, 'kdeglobals')
@@konquerorConfig =
File.join(@@configDir, 'konquerorrc')

Instance Method Summary collapse

Methods inherited from Browser

#applescript, #host, #initialize, #linux?, #macos?, #open, #windows?

Constructor Details

This class inherits a constructor from Browser

Instance Method Details

#setupObject

Forces KDE’s default browser to be Konqueror during the tests, and forces Konqueror to open external URL requests in new tabs instead of a new window.



111
112
113
114
115
116
117
118
119
# File 'lib/newjs/jstest.rb', line 111

def setup
  cd @@configDir, :verbose => false do
    copy @@globalConfig, "#{@@globalConfig}.bak", :preserve => true, :verbose => false
    copy @@konquerorConfig, "#{@@konquerorConfig}.bak", :preserve => true, :verbose => false
    # Too lazy to write it in Ruby...  Is sed dependency so bad?
    system "sed -ri /^BrowserApplication=/d  '#{@@globalConfig}'"
    system "sed -ri /^KonquerorTabforExternalURL=/s:false:true: '#{@@konquerorConfig}'"
  end
end

#supported?Boolean

Returns:

  • (Boolean)


104
105
106
# File 'lib/newjs/jstest.rb', line 104

def supported?
  linux?
end

#teardownObject



121
122
123
124
125
126
# File 'lib/newjs/jstest.rb', line 121

def teardown
  cd @@configDir, :verbose => false do
    copy "#{@@globalConfig}.bak", @@globalConfig, :preserve => true, :verbose => false
    copy "#{@@konquerorConfig}.bak", @@konquerorConfig, :preserve => true, :verbose => false
  end
end

#to_sObject



132
133
134
# File 'lib/newjs/jstest.rb', line 132

def to_s
  "Konqueror"
end

#visit(url) ⇒ Object



128
129
130
# File 'lib/newjs/jstest.rb', line 128

def visit(url)
  system("kfmclient openURL #{url}")
end