Skip to content

Commit

Permalink
Upgrade the API to use the latest Selenium Webdriver
Browse files Browse the repository at this point in the history
  • Loading branch information
hmdne committed Oct 26, 2023
1 parent 2d05d93 commit ff3d34c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ gem 'eventmachine', github: 'eventmachine/eventmachine'
gem 'thin', github: 'macournoyer/thin' unless RUBY_PLATFORM =~ /mingw/

# runner
gem 'selenium-webdriver', require: false
gem 'selenium-webdriver', '>= 4.14.0', require: false
gem 'rest-client', require: false
gem 'webdrivers', require: false
gem 'rexml', require: false
gem 'ffi'

Expand All @@ -38,3 +37,4 @@ else
gem 'opal', github: 'opal/opal', ref: ENV['OPAL_VERSION']
end

gem 'opal-sprockets'
11 changes: 2 additions & 9 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ require 'bundler'
Bundler.require
require 'bundler/gem_tasks'

require 'webdrivers'
load 'webdrivers/Rakefile'

require 'opal/rspec/rake_task'
Opal::RSpec::RakeTask.new(:broken_rspec) do |_, task|
task.default_path = 'spec'
Expand All @@ -14,12 +11,8 @@ end
task(:nil) {}

%w[chrome edge gecko safari].each do |i|
dependency = nil
if %w[chrome edge gecko].include? i
dependency = "webdrivers:#{i}driver:update"
end
desc "Run Selenium tests with #{i}"
task :"selenium_#{i}" => dependency do
task :"selenium_#{i}" do
server = Process.spawn("bundle", "exec", "rackup")
at_exit { Process.kill(9, server) rescue nil }
sleep 2
Expand Down Expand Up @@ -60,4 +53,4 @@ task :build_gh_pages do
HTML
end
end
end
end
3 changes: 1 addition & 2 deletions spec/runner.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#! /usr/bin/env ruby
require 'webdrivers'
require 'selenium/webdriver'
require 'rest_client'
require 'json'
Expand All @@ -23,7 +22,7 @@
raise "Wrong web browser provided in BROWSER. Acceptable values: chrome, gecko, safari, edge"
end

browser = Selenium::WebDriver.for(browser, capabilities: options)
browser = Selenium::WebDriver.for(browser, options: options)
browser.navigate.to('http://localhost:9292')

# if we don't quit the browser it will stall
Expand Down

0 comments on commit ff3d34c

Please sign in to comment.