pg_rails 7.0.8.pre.alpha.7 → 7.0.8.pre.alpha.8
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b3571f15d522de34ce58f735dd40b7dd3b44bc2f8292233dbcc5e451dd49f7a
|
4
|
+
data.tar.gz: 315e2de0d4c61085eaf12fb48bc2298d928e1909c2546a9bfda57e8e3e9c88ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 305ac09bdf7ac2a6172f71979253e8dbf90123d5c4218d5ffda7ab7a035052271ea9c6c9f3f182a7b76064075294ba2e71e3b157b49461753b954a762f9d1de4
|
7
|
+
data.tar.gz: 7d4744860de97968cd3e67710bd859a64e4610dcca69439daba8a05422fd6b8d092fbf56ef55eddee79aacc9a43154d7545b481bde7060c492694bdefebfb843
|
@@ -0,0 +1,50 @@
|
|
1
|
+
def add_emulate_device(browser_options, emulate_device)
|
2
|
+
if emulate_device == 'notebook'
|
3
|
+
browser_options.add_emulation(device_metrics: { width: 800, height: 400, pixelRatio: 1, touch: true })
|
4
|
+
else
|
5
|
+
browser_options.add_emulation(device_name: emulate_device)
|
6
|
+
end
|
7
|
+
|
8
|
+
browser_options
|
9
|
+
end
|
10
|
+
|
11
|
+
def default_options(headless:)
|
12
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
13
|
+
options.args << '--disable-site-isolation-trials'
|
14
|
+
# options.args << '--start-maximized'
|
15
|
+
|
16
|
+
if headless
|
17
|
+
options.args << '--headless'
|
18
|
+
options.args << '--disable-gpu' if Gem.win_platform?
|
19
|
+
end
|
20
|
+
|
21
|
+
options
|
22
|
+
end
|
23
|
+
|
24
|
+
def chrome_driver_gen(headless: true, emulate_device: nil, debugger: false)
|
25
|
+
lambda do |app|
|
26
|
+
Capybara::Selenium::Driver.load_selenium
|
27
|
+
browser_options = default_options(headless:)
|
28
|
+
|
29
|
+
if debugger
|
30
|
+
port = ENV.fetch('CHROME_PORT') { '9014' }
|
31
|
+
browser_options.debugger_address = "127.0.0.1:#{port}"
|
32
|
+
end
|
33
|
+
|
34
|
+
browser_options = add_emulate_device(browser_options, emulate_device) if emulate_device
|
35
|
+
|
36
|
+
Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
Capybara.register_driver :selenium_chrome, &chrome_driver_gen(headless: false)
|
41
|
+
Capybara.register_driver :selenium_chrome_notebook, &chrome_driver_gen(headless: false, emulate_device: 'notebook')
|
42
|
+
Capybara.register_driver :selenium_chrome_iphone, &chrome_driver_gen(headless: false, emulate_device: 'iPhone 6')
|
43
|
+
Capybara.register_driver :selenium_chrome_headless, &chrome_driver_gen(headless: true)
|
44
|
+
Capybara.register_driver :selenium_chrome_headless_notebook,
|
45
|
+
&chrome_driver_gen(headless: true, emulate_device: 'notebook')
|
46
|
+
Capybara.register_driver :selenium_chrome_headless_iphone,
|
47
|
+
&chrome_driver_gen(headless: true, emulate_device: 'iPhone 6')
|
48
|
+
Capybara.register_driver :selenium_chrome_debugger, &chrome_driver_gen(headless: false, debugger: true)
|
49
|
+
|
50
|
+
Capybara.javascript_driver = ENV.fetch('WEBDRIVER') { 'selenium_chrome_notebook' }.to_sym
|
data/pg_rails/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.8.pre.alpha.
|
4
|
+
version: 7.0.8.pre.alpha.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martín Rosso
|
@@ -156,6 +156,7 @@ files:
|
|
156
156
|
- pg_layout/lib/pg_layout/engine.rb
|
157
157
|
- pg_rails/js/index.js
|
158
158
|
- pg_rails/lib/pg_rails.rb
|
159
|
+
- pg_rails/lib/pg_rails/capybara_support.rb
|
159
160
|
- pg_rails/lib/version.rb
|
160
161
|
- pg_rails/scss/pg_rails.scss
|
161
162
|
- pg_scaffold/lib/generators/pg_active_record/model/model_generator.rb
|