File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
lib/selenium/webdriver/chrome
spec/unit/selenium/webdriver/chrome Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -27,12 +27,11 @@ module Chrome
27
27
class Profile
28
28
include ProfileHelper
29
29
30
- attr_reader :directory
31
-
32
30
def initialize ( model = nil )
33
31
@model = verify_model ( model )
34
32
@extensions = [ ]
35
33
@encoded_extensions = [ ]
34
+ @directory = nil
36
35
end
37
36
38
37
def add_extension ( path )
@@ -45,6 +44,10 @@ def add_encoded_extension(encoded)
45
44
@encoded_extensions << encoded
46
45
end
47
46
47
+ def directory
48
+ @directory || layout_on_disk
49
+ end
50
+
48
51
#
49
52
# Set a preference in the profile.
50
53
#
Original file line number Diff line number Diff line change @@ -217,6 +217,16 @@ module Chrome
217
217
expect ( options . as_json ) . to eq ( "browserName" => "chrome" , "goog:chromeOptions" => { "foo" => "bar" } )
218
218
end
219
219
220
+ it 'converts profile' do
221
+ profile = Profile . new
222
+ directory = profile . directory
223
+
224
+ opts = Options . new ( profile : profile )
225
+ expect ( opts . as_json ) . to eq ( 'browserName' => 'chrome' ,
226
+ 'goog:chromeOptions' =>
227
+ { 'args' => [ "--user-data-dir=#{ directory } " ] } )
228
+ end
229
+
220
230
it 'returns a JSON hash' do
221
231
allow ( File ) . to receive ( :file? ) . and_return ( true )
222
232
allow_any_instance_of ( Options ) . to receive ( :encode_extension ) . with ( 'foo.crx' ) . and_return ( "encoded_foo" )
You can’t perform that action at this time.
0 commit comments