@@ -42,32 +42,48 @@ module Firefox
4242 page : { width : 30 } ) ) . to include ( magic_number )
4343 end
4444
45- it 'can add and remove addons' do
46- ext = File . expand_path ( '../../../../../../third_party/firebug/favourite_colour-1.1-an+fx.xpi' , __dir__ )
47- driver . install_addon ( ext )
48- driver . uninstall_addon ( '[email protected] ' ) 49- end
50-
5145 it 'should print full page' do
5246 path = "#{ Dir . tmpdir } /test#{ SecureRandom . urlsafe_base64 } .png"
5347 screenshot = driver . save_full_page_screenshot ( path )
5448 expect ( IO . read ( screenshot ) [ 0x10 ..0x18 ] . unpack ( 'NN' ) . last ) . to be > 2600
5549 ensure
5650 File . delete ( path ) if File . exist? ( path )
5751 end
52+ end
53+
54+ describe '#install_addon' do
55+ let ( :extension ) { '../../../../../../third_party/firebug/favourite_colour-1.1-an+fx.xpi' }
56+
57+ it 'with path as parameter' do
58+ ext = File . expand_path ( extension , __dir__ )
59+ driver . install_addon ( ext )
60+ end
61+
62+ it 'with temporary as parameter' do
63+ ext = File . expand_path ( extension , __dir__ )
64+ driver . install_addon ( ext , true )
65+ end
66+ end
67+
68+ describe '#uninstall_addon' do
69+ it 'uninstalls based on id' do
70+ ext = File . expand_path ( '../../../../../../third_party/firebug/favourite_colour-1.1-an+fx.xpi' , __dir__ )
71+ id = driver . install_addon ( path : ext )
72+ driver . uninstall_addon ( id )
73+ end
74+ end
5875
59- it 'can get and set context' do
60- options = Options . new ( prefs : { 'browser.download.dir' : 'foo/bar' } )
61- create_driver! ( capabilities : options ) do |driver |
62- expect ( driver . context ) . to eq 'content'
76+ it 'can get and set context' do
77+ options = Options . new ( prefs : { 'browser.download.dir' : 'foo/bar' } )
78+ create_driver! ( capabilities : options ) do |driver |
79+ expect ( driver . context ) . to eq 'content'
6380
64- driver . context = 'chrome'
65- expect ( driver . context ) . to eq 'chrome'
81+ driver . context = 'chrome'
82+ expect ( driver . context ) . to eq 'chrome'
6683
67- # This call can not be made when context is set to 'content'
68- dir = driver . execute_script ( "return Services.prefs.getStringPref('browser.download.dir')" )
69- expect ( dir ) . to eq 'foo/bar'
70- end
84+ # This call can not be made when context is set to 'content'
85+ dir = driver . execute_script ( "return Services.prefs.getStringPref('browser.download.dir')" )
86+ expect ( dir ) . to eq 'foo/bar'
7187 end
7288 end
7389 end
0 commit comments