Skip to content

Commit

Permalink
Merge pull request #106 from opal/staging
Browse files Browse the repository at this point in the history
Update the API to use the latest Selenium webdriver
  • Loading branch information
hmdne authored Nov 24, 2023
2 parents 412ffe8 + 1cd3dec commit 857f88d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 32 deletions.
36 changes: 18 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,29 @@ jobs:
combo:
- name: Chromium/Linux/Opal-master
opal: master
opal-rspec: '1.0'
- name: Chromium/Linux/Opal-1.6
opal: 1.6
opal-rspec: '1.1'
- name: Chromium/Linux/Opal-1.8
opal: 1.8
opal-rspec: '1.1'
- name: Chromium/Linux/Opal-1.7
opal: 1.7
opal-rspec: '1.0'
- name: Chromium/Linux/Opal-1.5
opal: 1.5
- name: Chromium/Linux/Opal-1.5/PromiseV2
opal: 1.5
promise: v2
- name: Chromium/Linux/Opal-1.4
opal: 1.4
- name: Chromium/Linux/Opal-1.3
opal: 1.3
- name: Chromium/Linux/Opal-1.0
opal: '1.0'
- name: Chromium/Linux/Opal-1.0/Ruby-3.1
opal: 1.1
ruby: 3.1
- name: Chromium/Linux/Ruby-head
ruby: head
- name: Chromium/Linux/Ruby-3.1
ruby: '3.1'
- name: Chromium/Linux/Ruby-3.0
ruby: '3.0'
- name: Chromium/Linux/Ruby-2.7
ruby: 2.7
- name: Chromium/Linux/Ruby-2.6
ruby: 2.6
- name: Firefox/Linux
browser: gecko
- name: Chromium/Windows
Expand All @@ -65,22 +65,22 @@ jobs:
- uses: actions/checkout@v2
- name: set environment variables
run: |
echo "OPAL_VERSION=${{ matrix.combo.opal || '1.5' }}" >> $GITHUB_ENV
echo "OPAL_VERSION=${{ matrix.combo.opal || '1.8' }}" >> $GITHUB_ENV
echo "OPAL_RSPEC_VERSION=${{ matrix.combo.opal-rspec || '' }}" >> $GITHUB_ENV
echo "OPAL_BROWSER_PROMISE=${{ matrix.combo.promise || 'v1' }}" >> $GITHUB_ENV
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.combo.ruby || '3.1' }}
ruby-version: ${{ matrix.combo.ruby || '3.2' }}
- run: bundle lock
- uses: actions/cache@v2
with:
path: ./vendor/bundle
key: ${{ runner.os }}-${{ matrix.combo.ruby || '3.1' }}-gems-${{ matrix.combo.opal || '1.5' }}-${{ github.ref }}-${{ hashFiles('**/Gemfile.lock') }}
key: ${{ runner.os }}-${{ matrix.combo.ruby || '3.2' }}-gems-${{ matrix.combo.opal || '1.8' }}-${{ github.ref }}-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.combo.ruby || '3.1' }}-gems-${{ matrix.combo.opal || '1.5' }}-${{ github.ref }}
${{ runner.os }}-${{ matrix.combo.ruby || '3.1' }}-gems-${{ matrix.combo.opal || '1.5' }}-master
${{ runner.os }}-${{ matrix.combo.ruby || '3.1' }}-gems-${{ matrix.combo.opal || '1.5' }}-
${{ runner.os }}-${{ matrix.combo.ruby || '3.1' }}-gems-
${{ runner.os }}-${{ matrix.combo.ruby || '3.2' }}-gems-${{ matrix.combo.opal || '1.8' }}-${{ github.ref }}
${{ runner.os }}-${{ matrix.combo.ruby || '3.2' }}-gems-${{ matrix.combo.opal || '1.8' }}-master
${{ runner.os }}-${{ matrix.combo.ruby || '3.2' }}-gems-${{ matrix.combo.opal || '1.8' }}-
${{ runner.os }}-${{ matrix.combo.ruby || '3.2' }}-gems-
- name: bundle install
run: |
bundle config path $PWD/vendor/bundle
Expand Down
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@ when nil, ''
when /\./
gem 'opal-rspec', "~> #{ENV['OPAL_RSPEC_VERSION']}.0a"
else
gem 'opal', github: 'opal/opal', ref: ENV['OPAL_VERSION']
gem 'opal-rspec', github: 'opal/opal-rspec', ref: ENV['OPAL_RSPEC_VERSION'], submodules: true
end
# Force build of eventmachine... I wish we could find a way to not use
# this unmaintained library anymore.
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 857f88d

Please sign in to comment.