Skip to content

Commit

Permalink
rb - marionette multiple browser tests working locally
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Oct 12, 2015
1 parent 28fc252 commit 9ac0e47
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 42 deletions.
15 changes: 2 additions & 13 deletions rb/build.desc
Original file line number Diff line number Diff line change
Expand Up @@ -113,24 +113,13 @@ ruby_test(name = "edge",
deps = [ ":edge" ]
)

ruby_library(name = "wires",
srcs = [
"lib/selenium/webdriver/firefox/**/*.rb",
"lib/selenium/webdriver/firefox.rb"
],
deps = [
":common",
":remote"
]
)

ruby_test(name = "wires",
srcs = [
"spec/integration/selenium/webdriver/*_spec.rb",
"spec/integration/selenium/webdriver/wires/**/*_spec.rb"
"spec/integration/selenium/webdriver/firefox/**/*_spec.rb"
],
include = ["rb/spec/integration", "build/rb/lib"],
deps = [ ":wires" ]
deps = [ ":firefox" ]
)

ruby_library(name = "firefox",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,61 +22,73 @@
module Selenium
module WebDriver

compliant_on :driver => :wires do
describe Firefox do
describe Firefox do
before(:each) do
unless ENV['MARIONETTE_PATH']
pending "Set ENV['MARIONETTE_PATH'] to test Marionette enabled Firefox installations"
end
end

context "when designated firefox installation includes Marionette" do
before(:each) do
unless ENV['MARIONETTE_PATH']
pending "Set ENV['MARIONETTE_PATH'] to test Marionette enabled Firefox installations"
end
end
compliant_on({:driver => :remote, :browser => :firefox}, {:driver => :firefox}) do
it "Does not use wires by default when designated binary includes Marionette" do
temp_driver = Selenium::WebDriver.for :firefox
expect(temp_driver.instance_variable_get('@bridge').instance_variable_get('@launcher')).to_not be_nil
temp_driver.quit
end

after { @driver.quit if @driver }
it "Does not use wires by default when designated binary does not use Marionette" do
marionette_path = ENV['MARIONETTE_PATH']
ENV['MARIONETTE_PATH'] = nil
Firefox::Binary.instance_variable_set(:"@path", nil)

temp_driver = Selenium::WebDriver.for :firefox
expect(temp_driver.instance_variable_get('@bridge').instance_variable_get('@launcher')).to_not be_nil
temp_driver.quit
ENV['MARIONETTE_PATH'] = marionette_path
end
end

compliant_on :driver => :wires do

context "when designated firefox installation includes Marionette" do

it "Uses Wires when initialized with W3C desired_capabilities" do
caps = Selenium::WebDriver::Remote::W3CCapabilities.firefox
expect { @driver = Selenium::WebDriver.for :firefox, :desired_capabilities => caps }.to_not raise_exception
expect do
temp_driver = Selenium::WebDriver.for :firefox, :desired_capabilities => caps
temp_driver.quit
end.to_not raise_exception
end

it "Uses Wires when initialized with wires option" do
@driver = Selenium::WebDriver.for :firefox, {wires: true}

expect(@driver.instance_variable_get('@bridge').instance_variable_get('@launcher')).to be_nil
end

it "Does not use wires by default" do
@driver = Selenium::WebDriver.for :firefox
expect(@driver.instance_variable_get('@bridge').instance_variable_get('@launcher')).to_not be_nil
temp_driver = Selenium::WebDriver.for :firefox, {wires: true}
expect(temp_driver.instance_variable_get('@bridge').instance_variable_get('@launcher')).to be_nil
temp_driver.quit
end
end
end

compliant_on :driver => :wires do

context "when designated firefox installation does not include Marionette" do
before(:all) do
before(:each) do
@marionette_path = ENV['MARIONETTE_PATH']
ENV['MARIONETTE_PATH'] = nil
Firefox::Binary.instance_variable_set(:"@path", nil)
end
after(:all) {ENV['MARIONETTE_PATH'] = @marionette_path}
after(:each) {ENV['MARIONETTE_PATH'] = @marionette_path}
let(:message) { /Firefox Version \d\d does not support W3CCapabilities/ }

it "Does not use Wires by default" do
driver = Selenium::WebDriver.for :firefox
expect(driver.instance_variable_get('@bridge').instance_variable_get('@launcher')).to_not be_nil
driver.quit
end

it "Raises Wires Exception when initialized with :desired_capabilities" do
caps = Selenium::WebDriver::Remote::W3CCapabilities.firefox
opt = {:desired_capabilities => caps}
expect { @driver = Selenium::WebDriver.for :firefox, opt }.to raise_exception ArgumentError, message
expect { Selenium::WebDriver.for :firefox, opt }.to raise_exception ArgumentError, message
end

it "Raises Wires Exception when initialized with wires option" do
expect{@driver = Selenium::WebDriver.for :firefox, {wires: true}}.to raise_exception ArgumentError, message
expect{Selenium::WebDriver.for :firefox, {wires: true}}.to raise_exception ArgumentError, message
end
end

end
end
end # WebDriver
Expand Down

0 comments on commit 9ac0e47

Please sign in to comment.