|
17 | 17 | # specific language governing permissions and limitations
|
18 | 18 | # under the License.
|
19 | 19 |
|
| 20 | +require_relative '../spec_helper' |
| 21 | + |
20 | 22 | module Selenium
|
21 | 23 | module WebDriver
|
22 | 24 | module Chrome
|
23 | 25 |
|
24 |
| - describe Profile do |
25 |
| - let(:profile) { Profile.new } |
| 26 | + compliant_on :browser => :chrome do |
| 27 | + describe Profile do |
| 28 | + let(:profile) { Profile.new } |
26 | 29 |
|
27 |
| - # Won't work on ChromeDriver 2.0 |
28 |
| - # |
29 |
| - # it "launches Chrome with a custom profile" do |
30 |
| - # profile['autofill.disabled'] = true |
31 |
| - # |
32 |
| - # begin |
33 |
| - # driver = WebDriver.for :chrome, :profile => profile |
34 |
| - # ensure |
35 |
| - # driver.quit if driver |
36 |
| - # end |
37 |
| - # end |
| 30 | + # Won't work on ChromeDriver 2.0 |
| 31 | + # |
| 32 | + # it "launches Chrome with a custom profile" do |
| 33 | + # profile['autofill.disabled'] = true |
| 34 | + # |
| 35 | + # begin |
| 36 | + # driver = WebDriver.for :chrome, :profile => profile |
| 37 | + # ensure |
| 38 | + # driver.quit if driver |
| 39 | + # end |
| 40 | + # end |
38 | 41 |
|
39 |
| - it "should be serializable to JSON" do |
40 |
| - profile['foo.boolean'] = true |
| 42 | + it "should be serializable to JSON" do |
| 43 | + profile['foo.boolean'] = true |
41 | 44 |
|
42 |
| - new_profile = Profile.from_json(profile.to_json) |
43 |
| - expect(new_profile['foo.boolean']).to be true |
44 |
| - end |
| 45 | + new_profile = Profile.from_json(profile.to_json) |
| 46 | + expect(new_profile['foo.boolean']).to be true |
| 47 | + end |
45 | 48 |
|
46 |
| - it "adds an extension" do |
47 |
| - ext_path = "/some/path.crx" |
| 49 | + it "adds an extension" do |
| 50 | + ext_path = "/some/path.crx" |
48 | 51 |
|
49 |
| - expect(File).to receive(:file?).with(ext_path).and_return true |
50 |
| - expect(profile.add_extension(ext_path)).to eq([ext_path]) |
51 |
| - end |
| 52 | + expect(File).to receive(:file?).with(ext_path).and_return true |
| 53 | + expect(profile.add_extension(ext_path)).to eq([ext_path]) |
| 54 | + end |
52 | 55 |
|
53 |
| - it "reads an extension as binary data" do |
54 |
| - ext_path = "/some/path.crx" |
55 |
| - expect(File).to receive(:file?).with(ext_path).and_return true |
| 56 | + it "reads an extension as binary data" do |
| 57 | + ext_path = "/some/path.crx" |
| 58 | + expect(File).to receive(:file?).with(ext_path).and_return true |
56 | 59 |
|
57 |
| - profile.add_extension(ext_path) |
| 60 | + profile.add_extension(ext_path) |
58 | 61 |
|
59 |
| - ext_file = double('file') |
60 |
| - expect(File).to receive(:open).with(ext_path, "rb").and_yield ext_file |
61 |
| - expect(ext_file).to receive(:read).and_return "test" |
| 62 | + ext_file = double('file') |
| 63 | + expect(File).to receive(:open).with(ext_path, "rb").and_yield ext_file |
| 64 | + expect(ext_file).to receive(:read).and_return "test" |
62 | 65 |
|
63 |
| - expect(profile).to receive(:layout_on_disk).and_return "ignored" |
64 |
| - expect(Zipper).to receive(:zip).and_return "ignored" |
| 66 | + expect(profile).to receive(:layout_on_disk).and_return "ignored" |
| 67 | + expect(Zipper).to receive(:zip).and_return "ignored" |
65 | 68 |
|
66 |
| - expect(profile.as_json()).to eq({ |
67 |
| - 'zip' => "ignored", |
68 |
| - 'extensions' => [Base64.strict_encode64("test")] |
69 |
| - }) |
70 |
| - end |
| 69 | + expect(profile.as_json()).to eq({ |
| 70 | + 'zip' => "ignored", |
| 71 | + 'extensions' => [Base64.strict_encode64("test")] |
| 72 | + }) |
| 73 | + end |
71 | 74 |
|
72 |
| - it "raises an error if the extension doesn't exist" do |
73 |
| - expect { |
74 |
| - profile.add_extension("/not/likely/to/exist.crx") |
75 |
| - }.to raise_error |
| 75 | + it "raises an error if the extension doesn't exist" do |
| 76 | + expect { |
| 77 | + profile.add_extension("/not/likely/to/exist.crx") |
| 78 | + }.to raise_error |
| 79 | + end |
76 | 80 | end
|
77 | 81 | end
|
78 |
| - |
79 | 82 | end # Chrome
|
80 | 83 | end # WebDriver
|
81 | 84 | end # Selenium
|
|
0 commit comments