Skip to content

Commit

Permalink
rb - marionette works on remote driver
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner committed Oct 13, 2015
1 parent af83fc9 commit 0c26592
Show file tree
Hide file tree
Showing 14 changed files with 251 additions and 236 deletions.
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ task :test_rb => [
"//rb:remote-chrome-test",
"//rb:remote-firefox-test",
"//rb:remote-phantomjs-test",
("//rb:wires-test" if ENV['MARIONETTE_PATH']),
("//rb:remote-wires-test" if ENV['MARIONETTE_PATH']),
("//rb:marionette-test" if ENV['MARIONETTE_PATH']),
("//rb:remote-marionette-test" if ENV['MARIONETTE_PATH']),
("//rb:safari-test" if mac?),
("//rb:remote-safari-test" if mac?),
("//rb:ie-test" if windows?),
Expand Down
6 changes: 3 additions & 3 deletions rb/build.desc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ rubygem(
"//rb:remote",
"//rb:rc-client",
"//rb:safari",
"//rb:wires"
"//rb:marionette"
]
)

Expand Down Expand Up @@ -113,7 +113,7 @@ ruby_test(name = "edge",
deps = [ ":edge" ]
)

ruby_test(name = "wires",
ruby_test(name = "marionette",
srcs = [
"spec/integration/selenium/webdriver/*_spec.rb",
"spec/integration/selenium/webdriver/firefox/**/*_spec.rb"
Expand Down Expand Up @@ -300,7 +300,7 @@ ruby_test(name = "remote-edge",
]
)

ruby_test(name = "remote-wires",
ruby_test(name = "remote-marionette",
srcs = [
"spec/integration/selenium/webdriver/*_spec.rb",
"spec/integration/selenium/webdriver/remote/**/*_spec.rb"
Expand Down
8 changes: 4 additions & 4 deletions rb/lib/selenium/webdriver/remote/w3c_capabilities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ class W3CCapabilities

DEFAULTS = {
:browser_name => '',
:browser_version => '',
:browser_version => :any,
:platform_name => :any,
:platform_version => false,
:platform_version => :any,
:accept_ssl_certs => false,
:takes_screenshot => false,
:takes_element_screenshot => false,
:page_load_strategy => false,
:page_load_strategy => 'normal',
:proxy => nil
}

Expand Down Expand Up @@ -72,7 +72,7 @@ def firefox(opts = {})
alias_method :ff, :firefox

def w3c?(opts = {})
return false unless opts[:desired_capabilities].is_a?(W3CCapabilities) || opts.delete(:wires)
return false unless opts[:desired_capabilities].is_a?(W3CCapabilities) || opts.delete(:marionette)
Firefox::Binary.path = ENV['MARIONETTE_PATH'] if ENV['MARIONETTE_PATH']
firefox_version = Firefox::Binary.version
raise ArgumentError, "Firefox Version #{firefox_version} does not support W3CCapabilities" if firefox_version < 43
Expand Down
6 changes: 3 additions & 3 deletions rb/spec/integration/selenium/webdriver/driver_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
end

# Marionette BUG - AutomatedTester: "I need to add pagesource back and add it to the spec"
not_compliant_on :driver => :wires do
not_compliant_on :driver => :marionette do
it "should get the page source" do
driver.navigate.to url_for("xhtmlTest.html")
expect(driver.page_source).to match(%r[<title>XHTML Test Page</title>]i)
Expand Down Expand Up @@ -215,7 +215,7 @@
end

# Marionette BUG - Not finding local javascript for execution
not_compliant_on :driver => :wires do
not_compliant_on({:driver => :marionette}, {:browser => :marionette}) do
it "should be able to call functions on the page" do
driver.navigate.to url_for("javascriptPage.html")
driver.execute_script("displayMessage('I like cheese');")
Expand Down Expand Up @@ -278,7 +278,7 @@
end

# Edge BUG - https://connect.microsoft.com/IE/feedback/details/1849991/
not_compliant_on :browser => :edge do
not_compliant_on({:browser => :edge}, {:driver => :remote, :browser => :marionette}) do
it "times out if the callback is not invoked" do
expect {
# Script is expected to be async and explicitly callback, so this should timeout.
Expand Down
12 changes: 6 additions & 6 deletions rb/spec/integration/selenium/webdriver/element_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
end

# Marionette BUG - AutomatedTester: "known bug with execute script"
not_compliant_on :driver => :wires do
not_compliant_on :driver => :marionette do
it "should submit" do
driver.navigate.to url_for("formPage.html")
wait(5).until {driver.find_elements(:id, "submitButton").size > 0}
Expand All @@ -53,9 +53,9 @@
# FIXME - Find alternate implementation for File Uploads
# TODO - Figure out if/how this works on Firefox/Chrome without Remote server
# PhantomJS on windows issue: https://github.com/ariya/phantomjs/issues/10993
not_compliant_on({:browser => [:android, :iphone, :safari, :edge]},
{:browser => :phantomjs, :platform => :windows},
{:driver => :wires}) do
not_compliant_on({:browser => [:android, :iphone, :safari, :edge, :marionette]},
{:browser => :phantomjs, :platform => [:windows, :linux]},
{:driver => :marionette}) do
it "should handle file uploads" do
driver.navigate.to url_for("formPage.html")

Expand Down Expand Up @@ -133,7 +133,7 @@
end

# Location not currently supported in Spec, but should be?
not_compliant_on :driver => :wires do
not_compliant_on :driver => :marionette do
it "should get location" do
driver.navigate.to url_for("xhtmlTest.html")
loc = driver.find_element(:class, "header").location
Expand All @@ -156,7 +156,7 @@
# Marionette BUG:
# GET /session/f7082a32-e685-2843-ad2c-5bb6f376dac5/element/b6ff4468-ed6f-7c44-be4b-ca5a3ea8bf26/size
# did not match a known command"
not_compliant_on :driver => :wires do
not_compliant_on :driver => :marionette do
it "should get size" do
driver.navigate.to url_for("xhtmlTest.html")
size = driver.find_element(:class, "header").size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module WebDriver
end
end

compliant_on :driver => :wires do
compliant_on({:driver => :remote, :browser => :marionette}, {:driver => :marionette}) do

context "when designated firefox installation includes Marionette" do

Expand All @@ -60,15 +60,15 @@ module WebDriver
end.to_not raise_exception
end

it "Uses Wires when initialized with wires option" do
temp_driver = Selenium::WebDriver.for :firefox, {wires: true}
it "Uses Wires when initialized with marionette option" do
temp_driver = Selenium::WebDriver.for :firefox, {marionette: 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
compliant_on({:driver => :remote, :browser => :marionette}, {:driver => :marionette}) do

context "when designated firefox installation does not include Marionette" do
before(:each) do
Expand All @@ -85,8 +85,8 @@ module WebDriver
expect { Selenium::WebDriver.for :firefox, opt }.to raise_exception ArgumentError, message
end

it "Raises Wires Exception when initialized with wires option" do
expect{Selenium::WebDriver.for :firefox, {wires: true}}.to raise_exception ArgumentError, message
it "Raises Wires Exception when initialized with marionette option" do
expect{Selenium::WebDriver.for :firefox, {marionette: true}}.to raise_exception ArgumentError, message
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions rb/spec/integration/selenium/webdriver/keyboard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ module Selenium
module WebDriver

# Marionette BUG - Interactions Not Supported
not_compliant_on({:browser => [:chrome, :android, :iphone, :safari]},
{:driver => :wires}) do
not_compliant_on({:browser => [:chrome, :android, :iphone, :safari, :marionette]},
{:driver => :marionette}) do
describe Keyboard do
it "sends keys to the active element" do
driver.navigate.to url_for("bodyTypingTest.html")
Expand Down
4 changes: 2 additions & 2 deletions rb/spec/integration/selenium/webdriver/mouse_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ module WebDriver
describe Mouse do

# Marionette BUG - Interactions Not Supported
not_compliant_on({:browser => [:android, :iphone, :safari]},
{:driver => :wires}) do
not_compliant_on({:browser => [:android, :iphone, :safari, :marionette]},
{:driver => :marionette}) do
it "clicks an element" do
driver.navigate.to url_for("formPage.html")
driver.mouse.click driver.find_element(:id, "imageButton")
Expand Down
8 changes: 4 additions & 4 deletions rb/spec/integration/selenium/webdriver/options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module WebDriver
describe Options do

# Not supported in W3C Spec
not_compliant_on :driver => :wires do
not_compliant_on :driver => :marionette do
describe 'logs' do
compliant_on :driver => [:firefox] do
it 'can fetch available log types' do
Expand All @@ -50,7 +50,7 @@ module WebDriver
end
end

not_compliant_on :browser => :ie do
not_compliant_on({:browser => :ie}) do
describe "cookie management" do
it "should get all" do
driver.navigate.to url_for("xhtmlTest.html")
Expand Down Expand Up @@ -85,8 +85,8 @@ module WebDriver
end

# Marionette BUG - Failed to convert expiry to Date
not_compliant_on({:browser => [:ie, :android, :iphone, :safari]},
{:driver => :wires}) do
not_compliant_on({:browser => [:ie, :android, :iphone, :safari, :marionette]},
{:driver => :marionette}) do
it "should use DateTime for expires" do
driver.navigate.to url_for("xhtmlTest.html")

Expand Down
8 changes: 6 additions & 2 deletions rb/spec/integration/selenium/webdriver/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ class Object
c.include(WebDriver::SpecSupport::Helpers)
c.before(:suite) do
if GlobalTestEnv.driver == :remote
GlobalTestEnv.remote_server.start
server = GlobalTestEnv.remote_server
if GlobalTestEnv.browser == :marionette
server << "-Dwebdriver.firefox.bin=#{ENV['MARIONETTE_PATH']}"
end
server.start
end
end

Expand All @@ -52,4 +56,4 @@ class Object

$stdout.sync = true
GlobalTestEnv.unguarded = !!ENV['noguards']
WebDriver::SpecSupport::Guards.print_env
WebDriver::SpecSupport::Guards.print_env
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def initialize
def browser
if driver == :remote
(ENV['WD_REMOTE_BROWSER'] || :firefox).to_sym
elsif driver == :wires
elsif driver == :marionette
:firefox
else
driver
Expand Down Expand Up @@ -127,8 +127,8 @@ def create_driver
create_remote_driver
when :firefox
create_firefox_driver
when :wires
create_wires_driver
when :marionette
create_marionette_driver
when :chrome
create_chrome_driver
when :iphone
Expand All @@ -150,10 +150,15 @@ def create_driver
end

def remote_capabilities
caps = WebDriver::Remote::Capabilities.send(ENV['WD_REMOTE_BROWSER'] || 'firefox')
if ENV['WD_REMOTE_BROWSER'] == 'marionette'
caps = WebDriver::Remote::W3CCapabilities.firefox
caps[:marionette] = true
else
caps = WebDriver::Remote::Capabilities.send(ENV['WD_REMOTE_BROWSER'] || 'firefox')

caps.javascript_enabled = true
caps.css_selectors_enabled = true
caps.javascript_enabled = true
caps.css_selectors_enabled = true
end

caps
end
Expand Down Expand Up @@ -191,8 +196,9 @@ def create_firefox_driver
end
end

def create_wires_driver
WebDriver::Driver.for :firefox, {wires: true}
def create_marionette_driver
caps = WebDriver::Remote::W3CCapabilities.firefox
WebDriver.for :firefox, :desired_capabilities => caps
end

def create_chrome_driver
Expand Down
Loading

0 comments on commit 0c26592

Please sign in to comment.