percy-capybara 5.0.0.pre.3 → 5.0.0.pre.4

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: cd3adc36ef52095eaaf1e602bc347163260eaf0763a31083cbdc0915dab9f741
4
- data.tar.gz: 996139e8abb4148ef33dfdf53f253c5b63b5647c43c59d7efe2d9ee7e58ab8fc
3
+ metadata.gz: ad47828506156e4e07dfc481315f03b6754e56754728dc781d7d112e4c436429
4
+ data.tar.gz: 6a44e3220c49e4feb480d91bcdd3a5f4f65564ad75231b9455b377f7a69f7b09
5
5
  SHA512:
6
- metadata.gz: 848ffc7e381ab1527e64f97f4d259d4d9f2c39c82fb549bc610b31c586e75aae0f206900bd272885e475ac74a86eb82da45fd6f4261817e448958238d4ce2945
7
- data.tar.gz: bff21021c4768cf46ba80b08ac26246013c37ec0e82c1cab7077e68ca0c44517c1455e34437e6c6b1cb8cf25b612e3eb854d4015c0ef09088894f87a017bf8f3
6
+ metadata.gz: a6b98bb4aabe555640e2ad075507e413edc94259396a6d7523531097e0678949a1190dc5e9d5bce963aa0499cfd76b88f07d8d4da359faa52b1c1a54008b0a64
7
+ data.tar.gz: e97a00541379a162dd5da3314b62a429f79d1bfeaade1b12f689cf8479152f82202c97f86a30a23e205541a33305969686dacbb994ba970690d36c8c09e7b742
data/README.md CHANGED
@@ -78,6 +78,25 @@ The name of the require has changed from `require 'percy'` to `require
78
78
  'percy/capybara'`. This is to avoid conflict with our [Ruby Selenium SDK's](https://github.com/percy/percy-selenium-ruby)
79
79
  require statement.
80
80
 
81
+ #### API change
82
+
83
+ The previous version of this SDK had the following function signature:
84
+
85
+ ``` ruby
86
+ Percy.snapshot(driver, name, options)
87
+ ```
88
+
89
+ v5.x of this SDK has a significant change to the API. There no longer is a stand
90
+ alone module to call and you no longer need to pass the page/driver. It's
91
+ available on the current Capybara session (`page`):
92
+
93
+ ``` ruby
94
+ page.percy_snapshot(name, options)
95
+ ```
96
+
97
+ If you were using this SDK outside of Capybara, you'll likely find the [Ruby
98
+ Selenium SDK a better fit](https://github.com/percy/percy-selenium-ruby)
99
+
81
100
  #### Installing `@percy/cli` & removing `@percy/agent`
82
101
 
83
102
  If you're coming from a 4.x version of this package, make sure to install `@percy/cli` after
@@ -4,8 +4,6 @@ require 'capybara/dsl'
4
4
  require_relative './version'
5
5
 
6
6
  module PercyCapybara
7
- include Capybara::DSL
8
-
9
7
  CLIENT_INFO = "percy-capybara/#{VERSION}".freeze
10
8
  ENV_INFO = "capybara/#{Capybara::VERSION} ruby/#{RUBY_VERSION}".freeze
11
9
 
@@ -20,10 +18,12 @@ module PercyCapybara
20
18
  def percy_snapshot(name, options = {})
21
19
  return unless percy_enabled?
22
20
 
21
+ page = Capybara.current_session
22
+
23
23
  begin
24
24
  page.evaluate_script(fetch_percy_dom)
25
- dom_snapshot =
26
- page.evaluate_script("(function() { return PercyDOM.serialize(#{options.to_json}) })()")
25
+ dom_snapshot = page
26
+ .evaluate_script("(function() { return PercyDOM.serialize(#{options.to_json}) })()")
27
27
 
28
28
  response = fetch('percy/snapshot',
29
29
  name: name,
data/lib/percy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module PercyCapybara
2
- VERSION = '5.0.0.pre.3'.freeze
2
+ VERSION = '5.0.0.pre.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: percy-capybara
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.pre.3
4
+ version: 5.0.0.pre.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Perceptual Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-07 00:00:00.000000000 Z
11
+ date: 2021-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara