capybara-box 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: b4bdaec6c2c1490b88c611085694f8236508305a
4
- data.tar.gz: 9d57739d0736541aa752b0654473ea72ac9aa083
3
+ metadata.gz: 6afd97a950443869bfe4ab875fccd59c05a3fc0a
4
+ data.tar.gz: 137d4cf67eb4dd6c1a04c043ebbc07e13706a8f4
5
5
  SHA512:
6
- metadata.gz: 1b627d07d8a80b9e5de260068e1b095d0c18272b7b8acbec9c4c38ab39e56f3aa9c8c79fb0e812d65b367a996532ad50387e5cd76130583130cc6b598690ad9b
7
- data.tar.gz: 18e0e3b30f9f7462338fbd62f3af8a839cb4f3092bfdebf389c144cd4f28ad595d4c0e511d9788cf52c76b37040375ba5e995ff633e0d6bad8b9a24bb8d5dd1e
6
+ metadata.gz: 07bd47774b53cc943f1b319caba4e4114458fe618b1318465b8002710ce4b65ac9d68bfc023f052887aac2c3f192e8e9add6e050b59bca6d404772f1a141cdea
7
+ data.tar.gz: b7e8561e2fd0fbea24983141057428ca532bb281e1e6a162db43cddb800885b79b56aa8a0fe8c3f679d3242ef2da6c63b56ffb40f32a4aff676326daec850289
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## v0.2.1
2
+
3
+ - fixes
4
+ - `chrome_headless` was being registered with wrong name.
5
+
1
6
  ## v0.2.0
2
7
 
3
8
  - features
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Build Status](https://travis-ci.org/wbotelhos/capybara-box.svg)](https://travis-ci.org/wbotelhos/capybara-box)
4
4
  [![Gem Version](https://badge.fury.io/rb/capybara-box.svg)](https://badge.fury.io/rb/capybara-box)
5
5
 
6
- Configure Capybara with **Chrome**, **Headless Chrome** or **Firefox** with *Screenshot* feature and *Session* without lost your mind with just one line.
6
+ Configure Capybara with **Chrome**, **Chrome Headless** or **Firefox** with *Screenshot* feature and *Session* without lost your mind with just one line.
7
7
 
8
8
  ## install
9
9
 
@@ -26,7 +26,7 @@ require 'capybara-box'
26
26
  CapybaraBox::Base.configure
27
27
  ```
28
28
 
29
- By default, `chrome` is de driver, but you can use `chrome`, `chrome_headless` or `firefox`.
29
+ By default, `chrome` is the driver, but you can use `chrome_headless` and `firefox` too.
30
30
 
31
31
  ## Version
32
32
 
@@ -36,7 +36,7 @@ If you do not want install the Chrome Driver on your CI, you can specify the ver
36
36
  CapybaraBox::Base.configure version: '2.32'
37
37
  ```
38
38
 
39
- * This works just for Chrome, for now
39
+ * This works just for `chrome` and `chrome_headless`, for now
40
40
 
41
41
  ## Screenshot
42
42
 
@@ -89,6 +89,7 @@ By default some Switches are enabled for a better performance, you can add yours
89
89
 
90
90
  ```ruby
91
91
  capybara_box = CapybaraBox.configure
92
+
92
93
  capybara_box.add_argument '--incognito'
93
94
  ```
94
95
 
@@ -108,6 +109,7 @@ By default some Preferences are enabled for a better performance, you can add yo
108
109
 
109
110
  ```ruby
110
111
  capybara_box = CapybaraBox.configure
112
+
111
113
  capybara_box.add_preference :credentials_enable_service, false
112
114
  ```
113
115
 
@@ -60,10 +60,6 @@ module CapybaraBox
60
60
  ]
61
61
  end
62
62
 
63
- def browser
64
- @browser ||= chrome_family? ? :chrome : @browser
65
- end
66
-
67
63
  def chrome?
68
64
  @browser == :chrome
69
65
  end
@@ -77,7 +73,7 @@ module CapybaraBox
77
73
  end
78
74
 
79
75
  def configure
80
- Capybara.javascript_driver = browser
76
+ Capybara.javascript_driver = @browser
81
77
  Capybara.default_max_wait_time = @max_wait_time if @max_wait_time
82
78
  end
83
79
 
@@ -106,7 +102,7 @@ module CapybaraBox
106
102
  Capybara::Screenshot.s3_configuration = screenshot_s3_config
107
103
  end
108
104
 
109
- Capybara::Screenshot.register_driver(browser) do |driver, path|
105
+ Capybara::Screenshot.register_driver(@browser) do |driver, path|
110
106
  driver.browser.save_screenshot path
111
107
  end
112
108
  end
@@ -119,7 +115,7 @@ module CapybaraBox
119
115
  apply_version @parameters[:version] if version?
120
116
  configure_screenshot if @parameters[:screenshot]
121
117
 
122
- register browser
118
+ register @browser
123
119
 
124
120
  configure
125
121
  end
@@ -136,7 +132,7 @@ module CapybaraBox
136
132
  return @parameters[:driver_options] if @parameters[:driver_options]
137
133
 
138
134
  opts = {
139
- browser: browser,
135
+ browser: chrome_family? ? :chrome : @browser,
140
136
  clear_local_storage: true,
141
137
  clear_session_storage: true
142
138
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CapybaraBox
4
- VERSION = '0.2.0'.freeze
4
+ VERSION = '0.2.1'.freeze
5
5
  end
@@ -66,12 +66,24 @@ RSpec.describe CapybaraBox::Base, '#create' do
66
66
  context 'when :browser is given' do
67
67
  subject { described_class.new parameters }
68
68
 
69
- let!(:parameters) { { browser: :firefox } }
69
+ context 'as firefox' do
70
+ let!(:parameters) { { browser: :firefox } }
70
71
 
71
- it 'registers the given browser' do
72
- expect(subject).to receive(:register).with :firefox
72
+ it 'registers the given browser' do
73
+ expect(subject).to receive(:register).with :firefox
73
74
 
74
- subject.create
75
+ subject.create
76
+ end
77
+ end
78
+
79
+ context 'as chrome_headless' do
80
+ let!(:parameters) { { browser: :chrome_headless } }
81
+
82
+ it 'registers the given browser' do
83
+ expect(subject).to receive(:register).with :chrome_headless
84
+
85
+ subject.create
86
+ end
75
87
  end
76
88
  end
77
89
  end
@@ -29,7 +29,7 @@ RSpec.describe CapybaraBox::Base, '.register' do
29
29
 
30
30
  it 'uses the default driver options' do
31
31
  expect(subject.driver_options).to eq(
32
- browser: :chrome_headless,
32
+ browser: :chrome,
33
33
  clear_local_storage: true,
34
34
  clear_session_storage: true,
35
35
  driver_opts: { log_path: 'log/capybara-box.log' }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-box
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Washington Botelho
@@ -155,7 +155,6 @@ files:
155
155
  - spec/lib/capybara_box/base/apply_preferences_spec.rb
156
156
  - spec/lib/capybara_box/base/apply_version_spec.rb
157
157
  - spec/lib/capybara_box/base/arguments_spec.rb
158
- - spec/lib/capybara_box/base/browser_spec.rb
159
158
  - spec/lib/capybara_box/base/chrome_family_spec.rb
160
159
  - spec/lib/capybara_box/base/chrome_headless_spec.rb
161
160
  - spec/lib/capybara_box/base/chrome_spec.rb
@@ -207,7 +206,6 @@ test_files:
207
206
  - spec/lib/capybara_box/base/apply_preferences_spec.rb
208
207
  - spec/lib/capybara_box/base/apply_version_spec.rb
209
208
  - spec/lib/capybara_box/base/arguments_spec.rb
210
- - spec/lib/capybara_box/base/browser_spec.rb
211
209
  - spec/lib/capybara_box/base/chrome_family_spec.rb
212
210
  - spec/lib/capybara_box/base/chrome_headless_spec.rb
213
211
  - spec/lib/capybara_box/base/chrome_spec.rb
@@ -1,27 +0,0 @@
1
- require 'rails_helper'
2
-
3
- RSpec.describe CapybaraBox::Base, '.browser' do
4
- context 'when :browser is chrome family' do
5
- before do
6
- allow(subject).to receive(:chrome_family?) { true }
7
- end
8
-
9
- it 'is considered chrome' do
10
- expect(subject.browser).to eq :chrome
11
- end
12
- end
13
-
14
- context 'when :browser is not chrome family' do
15
- subject { described_class.new parameters }
16
-
17
- let!(:parameters) { { browser: :original_name } }
18
-
19
- before do
20
- allow(subject).to receive(:chrome_family?) { false }
21
- end
22
-
23
- it 'returns the original name' do
24
- expect(subject.browser).to eq :original_name
25
- end
26
- end
27
- end