Skip to content

Commit

Permalink
Merge pull request #158 from rubycdp/fix-build
Browse files Browse the repository at this point in the history
Fix build
  • Loading branch information
route authored Feb 18, 2021
2 parents 4857f30 + 434388d commit 8ceec3d
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 60 deletions.
50 changes: 0 additions & 50 deletions .circleci/config.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ source "https://rubygems.org"

gem "websocket-driver", "~> 0.6.5"

gemspec path: "../"
gemspec path: "../../"
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ source "https://rubygems.org"

gem "websocket-driver", "~> 0.7.1"

gemspec path: "../"
gemspec path: "../../"
38 changes: 38 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Tests
on: [push]

jobs:
tests:
name: Tests

strategy:
fail-fast: false
matrix:
gemfile: [websocket-driver-0.6.x, websocket-driver-0.7.x]
ruby: [2.5, 2.6, 2.7]

runs-on: ubuntu-latest
env:
FERRUM_PROCESS_TIMEOUT: 20
BUNDLE_GEMFILE: .github/gemfiles/${{ matrix.gemfile }}.gemfile
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- run: mkdir -p /tmp/ferrum

- name: Run tests
run: bundle exec rake

- name: Archive artifacts
uses: actions/upload-artifact@v2
if: ${{ failure() }}
with:
name: footprints
path: /tmp/ferrum/
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Ferrum - high-level API to control Chrome in Ruby

[![CircleCI](https://circleci.com/gh/rubycdp/ferrum.svg?style=shield)](https://circleci.com/gh/rubycdp/ferrum)

<img align="right"
width="320" height="241"
alt="Ferrum logo"
Expand Down
2 changes: 1 addition & 1 deletion lib/ferrum/browser/process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Browser
class Process
KILL_TIMEOUT = 2
WAIT_KILLED = 0.05
PROCESS_TIMEOUT = ENV.fetch("FERRUM_PROCESS_TIMEOUT", 2).to_i
PROCESS_TIMEOUT = ENV.fetch("FERRUM_PROCESS_TIMEOUT", 10).to_i

attr_reader :host, :port, :ws_url, :pid, :command,
:default_user_agent, :browser_version, :protocol_version,
Expand Down
2 changes: 1 addition & 1 deletion spec/browser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module Ferrum
path = "#{PROJECT_ROOT}/spec/support/no_chrome"

expect {
Browser.new(browser_path: path)
Browser.new(browser_path: path, process_timeout: 2)
}.to raise_error(
Ferrum::ProcessTimeoutError,
"Browser did not produce websocket url within 2 seconds"
Expand Down
7 changes: 3 additions & 4 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,10 @@ def save_exception_aftifacts(browser, meta)
timestamp = "#{time_now.strftime("%Y-%m-%d-%H-%M-%S.")}#{"%03d" % (time_now.usec/1000).to_i}"

screenshot_name = "screenshot-#{filename}-#{line_number}-#{timestamp}.png"
screenshot_path = "#{ENV["CIRCLE_ARTIFACTS"]}/screenshots/#{screenshot_name}"
screenshot_path = "/tmp/ferrum/#{screenshot_name}"
browser.screenshot(path: screenshot_path, full: true)

log_name = "ferrum-#{filename}-#{line_number}-#{timestamp}.txt"
log_path = "#{ENV["CIRCLE_ARTIFACTS"]}/logs/#{log_name}"
File.open(log_path, "wb") { |file| file.write(FERRUM_LOGGER.string) }
log_name = "logfile-#{filename}-#{line_number}-#{timestamp}.txt"
File.open("/tmp/ferrum/#{log_name}", "wb") { |file| file.write(FERRUM_LOGGER.string) }
end
end

0 comments on commit 8ceec3d

Please sign in to comment.