|
| 1 | +# encoding: utf-8 |
| 2 | +# |
| 3 | +# Licensed to the Software Freedom Conservancy (SFC) under one |
| 4 | +# or more contributor license agreements. See the NOTICE file |
| 5 | +# distributed with this work for additional information |
| 6 | +# regarding copyright ownership. The SFC licenses this file |
| 7 | +# to you under the Apache License, Version 2.0 (the |
| 8 | +# "License"); you may not use this file except in compliance |
| 9 | +# with the License. You may obtain a copy of the License at |
| 10 | +# |
| 11 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +# |
| 13 | +# Unless required by applicable law or agreed to in writing, |
| 14 | +# software distributed under the License is distributed on an |
| 15 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 | +# KIND, either express or implied. See the License for the |
| 17 | +# specific language governing permissions and limitations |
| 18 | +# under the License. |
| 19 | + |
| 20 | +require 'selenium-webdriver' |
| 21 | + |
| 22 | +module Selenium |
| 23 | + module WebDriver |
| 24 | + |
| 25 | + describe Firefox do |
| 26 | + |
| 27 | + context "when designated firefox installation includes Marionette" do |
| 28 | + before(:all) { Firefox::Binary.path = "/Applications/FirefoxDeveloperEdition.app/Contents/MacOS/firefox-bin" } |
| 29 | + after { @driver.quit } |
| 30 | + |
| 31 | + # Currently versions that support Wires do not support Legacy Firefox Extension |
| 32 | + xit "Does not use wires by default" do |
| 33 | + @driver = Selenium::WebDriver.for :firefox |
| 34 | + expect(@driver.instance_variable_get('@bridge').instance_variable_get('@launcher')).to_not be_nil |
| 35 | + end |
| 36 | + |
| 37 | + it "Uses Wires when initialized with :desired_capabilities" do |
| 38 | + caps = Selenium::WebDriver::Remote::W3CCapabilities.firefox |
| 39 | + expect { @driver = Selenium::WebDriver.for :firefox, :desired_capabilities => caps }.to_not raise_exception |
| 40 | + end |
| 41 | + |
| 42 | + it "Uses Wires when initialized with wires option" do |
| 43 | + @driver = Selenium::WebDriver.for :firefox, {wires: true} |
| 44 | + expect(@driver.instance_variable_get('@bridge').instance_variable_get('@launcher')).to be_nil |
| 45 | + end |
| 46 | + end |
| 47 | + |
| 48 | + context "when designated firefox installation does not include Marionette" do |
| 49 | + before(:all) { Firefox::Binary.path = "/Applications/Firefox.app/Contents/MacOS/firefox-bin" } |
| 50 | + let(:message) { /Firefox Version \d\d does not support W3CCapabilities/ } |
| 51 | + |
| 52 | + it "Does not use Wires by default" do |
| 53 | + driver = Selenium::WebDriver.for :firefox |
| 54 | + expect(driver.instance_variable_get('@bridge').instance_variable_get('@launcher')).to_not be_nil |
| 55 | + driver.quit |
| 56 | + end |
| 57 | + |
| 58 | + it "Raises Wires Exception when initialized with :desired_capabilities" do |
| 59 | + caps = Selenium::WebDriver::Remote::W3CCapabilities.firefox |
| 60 | + opt = {:desired_capabilities => caps} |
| 61 | + expect { @driver = Selenium::WebDriver.for :firefox, opt }.to raise_exception ArgumentError, message |
| 62 | + end |
| 63 | + |
| 64 | + it "Raises Wires Exception when initialized with wires option" do |
| 65 | + expect{@driver = Selenium::WebDriver.for :firefox, {wires: true}}.to raise_exception ArgumentError, message |
| 66 | + end |
| 67 | + end |
| 68 | + |
| 69 | + |
| 70 | + end # Driver |
| 71 | + end # WebDriver |
| 72 | +end # Selenium |
0 commit comments