standout-capybara 1.0.2 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 138dc1572933c01e2f122bc016e718db947cd8125415dbc76daac951b8e0da6f
4
- data.tar.gz: 8b4bdcd281043c4701ff8ed94cf691ba1300156aa7499fa4039d604ae474defd
3
+ metadata.gz: d2dd6fa4216d87f0ec1e70a7c785e8dafa58949a2b968349e1cde5d7c0e04a3b
4
+ data.tar.gz: 6b23b05e1c5f486c9a4babe53ec6d57f79d29b2cdcae166b51b9ef4c8a82cfa0
5
5
  SHA512:
6
- metadata.gz: 798a31107e30270e8bf349ea42baf22093eb10ffe9a8f911e3de99730ca3a60861beb21d13245a83d66ab744d4b43be11cf0db74475e8c209fb144c91a92ede0
7
- data.tar.gz: c14fbc9855ca878d6119d42d9c9894bb38da5086112d0626899a2bdc98dc8e1b2fdbbe41ca00721f934c93482a301f5034454c3f3e815fdad6334dd56f38f5c6
6
+ metadata.gz: 83cfcef73a0ec078e4e5f6e2592f9ef6eb282e89a192b78d1cece31b7850393d792a613af563970c706c40ad842552091a6750c15f874711ca00b610de939a01
7
+ data.tar.gz: d0d6201bf7bc41f08f3e59499f2a907a5962738e6b2bb3ce7360a29d4712956de96a2f4fca35f2496545dcfd6f4897bfa4008c3cf44b6b692fae12fd42df461c
@@ -0,0 +1,39 @@
1
+ name: Gem push
2
+ on:
3
+ release:
4
+ types: [published]
5
+ jobs:
6
+ github:
7
+ name: Build + Publish to GitHub
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v2
11
+ - name: Set up Ruby 2.6
12
+ uses: actions/setup-ruby@v1
13
+ with:
14
+ version: 2.6.x
15
+ - name: Publish to GitHub
16
+ uses: jstastny/publish-gem-to-github@master
17
+ with:
18
+ token: ${{ secrets.GITHUB_TOKEN }}
19
+ owner: standout
20
+
21
+ rubygems:
22
+ name: Build + Publish to Rubygems
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby 2.6
27
+ uses: actions/setup-ruby@v1
28
+ with:
29
+ version: 2.6.x
30
+ - name: Publish to RubyGems
31
+ run: |
32
+ mkdir -p $HOME/.gem
33
+ touch $HOME/.gem/credentials
34
+ chmod 0600 $HOME/.gem/credentials
35
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
36
+ gem build *.gemspec
37
+ gem push *.gem
38
+ env:
39
+ GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
@@ -0,0 +1,21 @@
1
+ name: Tests
2
+
3
+ on: [push, pull_request, release]
4
+
5
+ jobs:
6
+ build:
7
+ name: Tests
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ - name: Set up Ruby 2.6
13
+ uses: actions/setup-ruby@v1
14
+ with:
15
+ version: 2.6.x
16
+ - name: Set up environment
17
+ run: |
18
+ gem install bundler
19
+ bundle install
20
+ - name: Test
21
+ run: rake
@@ -1,66 +1,63 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- standout-capybara (1.0.2)
4
+ standout-capybara (2.1.0)
5
5
  capybara
6
6
  capybara-screenshot
7
- chromedriver-helper
8
7
  selenium-webdriver
8
+ webdrivers
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- addressable (2.6.0)
14
- public_suffix (>= 2.0.2, < 4.0)
15
- archive-zip (0.12.0)
16
- io-like (~> 0.3.0)
17
- capybara (3.18.0)
13
+ addressable (2.7.0)
14
+ public_suffix (>= 2.0.2, < 5.0)
15
+ capybara (3.33.0)
18
16
  addressable
19
17
  mini_mime (>= 0.1.3)
20
18
  nokogiri (~> 1.8)
21
19
  rack (>= 1.6.0)
22
20
  rack-test (>= 0.6.3)
23
- regexp_parser (~> 1.2)
21
+ regexp_parser (~> 1.5)
24
22
  xpath (~> 3.2)
25
- capybara-screenshot (1.0.22)
23
+ capybara-screenshot (1.0.25)
26
24
  capybara (>= 1.0, < 4)
27
25
  launchy
28
- childprocess (1.0.1)
29
- rake (< 13.0)
30
- chromedriver-helper (2.1.1)
31
- archive-zip (~> 0.10)
32
- nokogiri (~> 1.8)
33
- diff-lcs (1.3)
34
- io-like (0.3.0)
35
- launchy (2.4.3)
36
- addressable (~> 2.3)
37
- mini_mime (1.0.1)
26
+ childprocess (3.0.0)
27
+ diff-lcs (1.4.4)
28
+ launchy (2.5.0)
29
+ addressable (~> 2.7)
30
+ mini_mime (1.0.2)
38
31
  mini_portile2 (2.4.0)
39
- nokogiri (1.10.3)
32
+ nokogiri (1.10.10)
40
33
  mini_portile2 (~> 2.4.0)
41
- public_suffix (3.0.3)
42
- rack (2.0.7)
34
+ public_suffix (4.0.6)
35
+ rack (2.2.3)
43
36
  rack-test (1.1.0)
44
37
  rack (>= 1.0, < 3)
45
- rake (10.5.0)
46
- regexp_parser (1.4.0)
47
- rspec (3.8.0)
48
- rspec-core (~> 3.8.0)
49
- rspec-expectations (~> 3.8.0)
50
- rspec-mocks (~> 3.8.0)
51
- rspec-core (3.8.0)
52
- rspec-support (~> 3.8.0)
53
- rspec-expectations (3.8.2)
38
+ rake (13.0.1)
39
+ regexp_parser (1.8.2)
40
+ rspec (3.10.0)
41
+ rspec-core (~> 3.10.0)
42
+ rspec-expectations (~> 3.10.0)
43
+ rspec-mocks (~> 3.10.0)
44
+ rspec-core (3.10.0)
45
+ rspec-support (~> 3.10.0)
46
+ rspec-expectations (3.10.0)
54
47
  diff-lcs (>= 1.2.0, < 2.0)
55
- rspec-support (~> 3.8.0)
56
- rspec-mocks (3.8.0)
48
+ rspec-support (~> 3.10.0)
49
+ rspec-mocks (3.10.0)
57
50
  diff-lcs (>= 1.2.0, < 2.0)
58
- rspec-support (~> 3.8.0)
59
- rspec-support (3.8.0)
60
- rubyzip (1.2.2)
61
- selenium-webdriver (3.142.0)
62
- childprocess (>= 0.5, < 2.0)
63
- rubyzip (~> 1.2, >= 1.2.2)
51
+ rspec-support (~> 3.10.0)
52
+ rspec-support (3.10.0)
53
+ rubyzip (2.3.0)
54
+ selenium-webdriver (3.142.7)
55
+ childprocess (>= 0.5, < 4.0)
56
+ rubyzip (>= 1.2.2)
57
+ webdrivers (4.4.1)
58
+ nokogiri (~> 1.6)
59
+ rubyzip (>= 1.3.0)
60
+ selenium-webdriver (>= 3.0, < 4.0)
64
61
  xpath (3.2.0)
65
62
  nokogiri (~> 1.8)
66
63
 
@@ -68,9 +65,9 @@ PLATFORMS
68
65
  ruby
69
66
 
70
67
  DEPENDENCIES
71
- rake (~> 10.0)
68
+ rake (~> 13.0)
72
69
  rspec (~> 3.0)
73
70
  standout-capybara!
74
71
 
75
72
  BUNDLED WITH
76
- 1.17.3
73
+ 2.1.4
data/README.md CHANGED
@@ -57,6 +57,16 @@ Example:
57
57
  $ nanobox run rake
58
58
  ```
59
59
 
60
+ ### Options
61
+
62
+ Options that you can override using environment variables.
63
+
64
+ | Environment variable | Description |
65
+ |:-----------------|:------------|
66
+ | `CAPYBARA` | Override the driver |
67
+ | `CAPYBARA_WAIT_TIME` | Override default wait time of capybara |
68
+
69
+
60
70
  ### Available drivers
61
71
 
62
72
  Override the driver using the environment variable `CAPYBARA`.
@@ -71,16 +81,28 @@ CAPYBARA=[driver name] test-command
71
81
  |:-----------------|:------------|
72
82
  | chrome | Regular chrome driver that will use a visual browser window. |
73
83
  | headless_chrome | Headless chrome driver. The default driver. |
74
- | nanobox_chrome | Default driver when inside Nanobox. |
84
+ | nanobox_chrome | Default driver when inside Nanobox. |
85
+ | remote_chrome | Default driver when `ENV['HUB_URL']` is defined. |
86
+
75
87
  ## Development
76
88
 
77
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
89
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run
90
+ `rake spec` to run the tests. You can also run `bin/console` for an interactive
91
+ prompt that will allow you to experiment.
78
92
 
79
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
93
+ To install this gem onto your local machine, run `bundle exec rake install`. To
94
+ release a new version, update the version number in `version.rb`, and then run
95
+ `bundle exec rake release`, which will create a git tag for the version, push
96
+ git commits and tags, and push the `.gem` file to
97
+ [rubygems.org](https://rubygems.org).
80
98
 
81
99
  ## Contributing
82
100
 
83
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/standout-capybara. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
101
+ Bug reports and pull requests are welcome on GitHub at
102
+ https://github.com/[USERNAME]/standout-capybara. This project is intended to be
103
+ a safe, welcoming space for collaboration, and contributors are expected to
104
+ adhere to the [Contributor Covenant](http://contributor-covenant.org) code of
105
+ conduct.
84
106
 
85
107
  ## License
86
108
 
@@ -88,4 +110,13 @@ The gem is available as open source under the terms of the [MIT License](https:/
88
110
 
89
111
  ## Code of Conduct
90
112
 
91
- Everyone interacting in the Standout::Capybara project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/standout-capybara/blob/master/CODE_OF_CONDUCT.md).
113
+ Everyone interacting in the Standout::Capybara project’s codebases, issue
114
+ trackers, chat rooms and mailing lists is expected to follow the [code of
115
+ conduct](https://github.com/[USERNAME]/standout-capybara/blob/master/CODE_OF_CONDUCT.md).
116
+
117
+ ## Release
118
+
119
+ To release a new version you should bump the version in the file
120
+ `lib/standout/capybara/version.rb`, commit the change and push it to GitHub.
121
+ Then you should create a release in GitHub and it will automatically be built
122
+ and uploaded to RubyGems and as a GitHub Package.
@@ -1,41 +1,56 @@
1
- require "standout/capybara/version"
2
- require "capybara"
3
- require "capybara-screenshot"
4
- require "selenium-webdriver"
5
- require "chromedriver-helper"
6
- require "standout/capybara/drivers/base"
7
- require "standout/capybara/drivers/chrome"
8
- require "standout/capybara/drivers/nanobox_chrome"
9
- require "standout/capybara/drivers/headless_chrome"
1
+ # frozen_string_literal: true
2
+
3
+ require 'standout/capybara/version'
4
+ require 'capybara'
5
+ require 'capybara-screenshot'
6
+ require 'selenium-webdriver'
7
+ require 'webdrivers'
8
+ require 'standout/capybara/drivers/base'
9
+ require 'standout/capybara/drivers/chrome'
10
+ require 'standout/capybara/drivers/nanobox_chrome'
11
+ require 'standout/capybara/drivers/headless_chrome'
12
+ require 'standout/capybara/drivers/remote_chrome'
10
13
 
11
14
  module Standout
12
15
  module Capybara
13
- def self.setup_driver
14
- driver_name = ENV["CAPYBARA"]
15
- is_using_nanobox = `whoami`.chomp == "gonano"
16
- fallback_driver = is_using_nanobox ? :nanobox_chrome : :headless_chrome
17
- driver_name ||= fallback_driver
18
- driver_name = driver_name.to_sym
16
+ class Error < StandardError; end
19
17
 
20
- case driver_name
18
+ def self.setup_driver
19
+ case (ENV['CAPYBARA'] || fallback_driver).to_sym
21
20
  when :chrome
22
21
  Standout::Capybara::Drivers::Chrome.register
23
22
  Standout::Capybara::Drivers::Chrome.use!
24
23
  when :nanobox_chrome
25
24
  Standout::Capybara::Drivers::NanoboxChrome.register
26
25
  Standout::Capybara::Drivers::NanoboxChrome.use!
26
+ when :remote_chrome
27
+ Standout::Capybara::Drivers::RemoteChrome.register
28
+ Standout::Capybara::Drivers::RemoteChrome.use!
27
29
  else
28
30
  Standout::Capybara::Drivers::HeadlessChrome.register
29
31
  Standout::Capybara::Drivers::HeadlessChrome.use!
30
32
  end
31
33
 
32
34
  if ::Capybara.respond_to? :default_max_wait_time
33
- ::Capybara.default_max_wait_time = 30
35
+ ::Capybara.default_max_wait_time = ENV.fetch('CAPYBARA_WAIT_TIME') { 30 }.to_i
34
36
  else
35
- ::Capybara.default_wait_time = 30
37
+ ::Capybara.default_wait_time = ENV.fetch('CAPYBARA_WAIT_TIME') { 30 }.to_i
36
38
  end
37
39
  end
38
40
 
39
- class Error < StandardError; end
41
+ def self.fallback_driver
42
+ return :nanobox_chrome if nanobox?
43
+ return :remote_chrome if hub_url?
44
+
45
+ :headless_chrome
46
+ end
47
+
48
+ def self.nanobox?
49
+ `whoami`.chomp == 'gonano'
50
+ end
51
+
52
+ def self.hub_url?
53
+ !ENV['HUB_URL'].nil?
54
+ end
40
55
  end
41
56
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Standout
4
+ module Capybara
5
+ module Drivers
6
+ class RemoteChrome < Standout::Capybara::Drivers::Base
7
+ self.driver_name = :remote_chrome
8
+
9
+ def self.register
10
+ ::Capybara.register_driver driver_name do |driver|
11
+ chrome_capabilities = ::Selenium::WebDriver::Remote::Capabilities
12
+ .chrome('goog:chromeOptions' => {
13
+ args: %w[no-sandbox headless disable-gpu window-size=1400,1400] })
14
+
15
+ ::Capybara::Selenium::Driver.new(driver,
16
+ browser: :remote,
17
+ url: ENV['HUB_URL'],
18
+ desired_capabilities: chrome_capabilities)
19
+ end
20
+ super
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Standout
2
4
  module Capybara
3
- VERSION = "1.0.2"
5
+ VERSION = '2.1.2'
4
6
  end
5
7
  end
@@ -25,8 +25,8 @@ Gem::Specification.new do |spec|
25
25
  spec.add_dependency "capybara"
26
26
  spec.add_dependency "capybara-screenshot"
27
27
  spec.add_dependency "selenium-webdriver"
28
- spec.add_dependency "chromedriver-helper"
28
+ spec.add_dependency "webdrivers"
29
29
 
30
- spec.add_development_dependency "rake", "~> 10.0"
30
+ spec.add_development_dependency "rake", "~> 13.0"
31
31
  spec.add_development_dependency "rspec", "~> 3.0"
32
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standout-capybara
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Standout AB
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-14 00:00:00.000000000 Z
11
+ date: 2020-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: chromedriver-helper
56
+ name: webdrivers
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '10.0'
75
+ version: '13.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '10.0'
82
+ version: '13.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -101,9 +101,10 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
+ - ".github/workflows/gempush.yml"
105
+ - ".github/workflows/tests.yml"
104
106
  - ".gitignore"
105
107
  - ".rspec"
106
- - ".travis.yml"
107
108
  - CODE_OF_CONDUCT.md
108
109
  - Gemfile
109
110
  - Gemfile.lock
@@ -117,6 +118,7 @@ files:
117
118
  - lib/standout/capybara/drivers/chrome.rb
118
119
  - lib/standout/capybara/drivers/headless_chrome.rb
119
120
  - lib/standout/capybara/drivers/nanobox_chrome.rb
121
+ - lib/standout/capybara/drivers/remote_chrome.rb
120
122
  - lib/standout/capybara/setup.rb
121
123
  - lib/standout/capybara/version.rb
122
124
  - standout-capybara.gemspec
@@ -139,8 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
141
  - !ruby/object:Gem::Version
140
142
  version: '0'
141
143
  requirements: []
142
- rubyforge_project:
143
- rubygems_version: 2.7.6
144
+ rubygems_version: 3.1.4
144
145
  signing_key:
145
146
  specification_version: 4
146
147
  summary: Sane defaults for capybara
@@ -1,7 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.5.1
7
- before_install: gem install bundler -v 1.17.1