@@ -42,32 +42,48 @@ module Firefox
42
42
page : { width : 30 } ) ) . to include ( magic_number )
43
43
end
44
44
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 ( 'favourite-colour-examples@mozilla.org' )
49
- end
50
-
51
45
it 'should print full page' do
52
46
path = "#{ Dir . tmpdir } /test#{ SecureRandom . urlsafe_base64 } .png"
53
47
screenshot = driver . save_full_page_screenshot ( path )
54
48
expect ( IO . read ( screenshot ) [ 0x10 ..0x18 ] . unpack ( 'NN' ) . last ) . to be > 2600
55
49
ensure
56
50
File . delete ( path ) if File . exist? ( path )
57
51
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
58
75
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'
63
80
64
- driver . context = 'chrome'
65
- expect ( driver . context ) . to eq 'chrome'
81
+ driver . context = 'chrome'
82
+ expect ( driver . context ) . to eq 'chrome'
66
83
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'
71
87
end
72
88
end
73
89
end
0 commit comments