percy-capybara 5.0.0.pre.2 → 5.0.0.pre.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/percy/capybara.rb +1 -0
- data/lib/percy/version.rb +1 -1
- metadata +3 -24
- data/.github/dependabot.yml +0 -8
- data/.github/release-drafter.yml +0 -31
- data/.github/workflows/changelog.yml +0 -11
- data/.github/workflows/lint.yml +0 -22
- data/.github/workflows/release.yml +0 -22
- data/.github/workflows/test.yml +0 -26
- data/.gitignore +0 -17
- data/.rspec +0 -4
- data/.rubocop.yml +0 -13
- data/.yardopts +0 -2
- data/Gemfile +0 -16
- data/Guardfile +0 -14
- data/Makefile +0 -3
- data/Rakefile +0 -1
- data/percy-capybara.gemspec +0 -32
- data/spec/fixture/index.html +0 -1
- data/spec/lib/percy/percy_capybara_spec.rb +0 -103
- data/spec/spec_helper.rb +0 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd3adc36ef52095eaaf1e602bc347163260eaf0763a31083cbdc0915dab9f741
|
4
|
+
data.tar.gz: 996139e8abb4148ef33dfdf53f253c5b63b5647c43c59d7efe2d9ee7e58ab8fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 848ffc7e381ab1527e64f97f4d259d4d9f2c39c82fb549bc610b31c586e75aae0f206900bd272885e475ac74a86eb82da45fd6f4261817e448958238d4ce2945
|
7
|
+
data.tar.gz: bff21021c4768cf46ba80b08ac26246013c37ec0e82c1cab7077e68ca0c44517c1455e34437e6c6b1cb8cf25b612e3eb854d4015c0ef09088894f87a017bf8f3
|
data/lib/percy/capybara.rb
CHANGED
data/lib/percy/version.rb
CHANGED
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.
|
4
|
+
version: 5.0.0.pre.3
|
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-
|
11
|
+
date: 2021-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -115,28 +115,10 @@ executables: []
|
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
-
- ".github/dependabot.yml"
|
119
|
-
- ".github/release-drafter.yml"
|
120
|
-
- ".github/workflows/changelog.yml"
|
121
|
-
- ".github/workflows/lint.yml"
|
122
|
-
- ".github/workflows/release.yml"
|
123
|
-
- ".github/workflows/test.yml"
|
124
|
-
- ".gitignore"
|
125
|
-
- ".rspec"
|
126
|
-
- ".rubocop.yml"
|
127
|
-
- ".yardopts"
|
128
|
-
- Gemfile
|
129
|
-
- Guardfile
|
130
118
|
- LICENSE
|
131
|
-
- Makefile
|
132
119
|
- README.md
|
133
|
-
- Rakefile
|
134
120
|
- lib/percy/capybara.rb
|
135
121
|
- lib/percy/version.rb
|
136
|
-
- percy-capybara.gemspec
|
137
|
-
- spec/fixture/index.html
|
138
|
-
- spec/lib/percy/percy_capybara_spec.rb
|
139
|
-
- spec/spec_helper.rb
|
140
122
|
homepage: ''
|
141
123
|
licenses:
|
142
124
|
- MIT
|
@@ -162,7 +144,4 @@ rubygems_version: 3.0.3
|
|
162
144
|
signing_key:
|
163
145
|
specification_version: 4
|
164
146
|
summary: Percy visual testing for Capybara
|
165
|
-
test_files:
|
166
|
-
- spec/fixture/index.html
|
167
|
-
- spec/lib/percy/percy_capybara_spec.rb
|
168
|
-
- spec/spec_helper.rb
|
147
|
+
test_files: []
|
data/.github/dependabot.yml
DELETED
data/.github/release-drafter.yml
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
name-template: 'v$RESOLVED_VERSION'
|
2
|
-
tag-template: 'v$RESOLVED_VERSION'
|
3
|
-
categories:
|
4
|
-
- title: '💥 Breaking Changes'
|
5
|
-
labels:
|
6
|
-
- breaking
|
7
|
-
- title: '✨ Enhancements'
|
8
|
-
labels:
|
9
|
-
- feature
|
10
|
-
- enhancement
|
11
|
-
- title: '🐛 Bug Fixes'
|
12
|
-
labels:
|
13
|
-
- fix
|
14
|
-
- bugfix
|
15
|
-
- bug
|
16
|
-
- title: '🏗 Maintenance'
|
17
|
-
labels:
|
18
|
-
- chore
|
19
|
-
- dependencies
|
20
|
-
change-title-escapes: '\<*_&#@'
|
21
|
-
version-resolver:
|
22
|
-
major:
|
23
|
-
labels:
|
24
|
-
- breaking
|
25
|
-
minor:
|
26
|
-
labels:
|
27
|
-
- feature
|
28
|
-
- enhancement
|
29
|
-
default: patch
|
30
|
-
template: '$CHANGES'
|
31
|
-
prerelease: true
|
data/.github/workflows/lint.yml
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
name: Lint
|
2
|
-
on:
|
3
|
-
push:
|
4
|
-
branches: [master]
|
5
|
-
pull_request:
|
6
|
-
workflow_dispatch:
|
7
|
-
jobs:
|
8
|
-
lint:
|
9
|
-
name: Lint
|
10
|
-
runs-on: ubuntu-latest
|
11
|
-
steps:
|
12
|
-
- uses: actions/checkout@v2
|
13
|
-
- uses: ruby/setup-ruby@v1
|
14
|
-
with:
|
15
|
-
ruby-version: 2.6
|
16
|
-
bundler-cache: true
|
17
|
-
- uses: actions/cache@v2
|
18
|
-
with:
|
19
|
-
path: "./vendor/bundle"
|
20
|
-
key: v1/${{ runner.os }}/ruby-2.6/${{ hashFiles('**/Gemfile.lock') }}
|
21
|
-
restore-keys: v1/${{ runner.os }}/ruby-2.6/
|
22
|
-
- run: bundle exec rubocop
|
@@ -1,22 +0,0 @@
|
|
1
|
-
name: Release
|
2
|
-
on:
|
3
|
-
release:
|
4
|
-
types: [published]
|
5
|
-
jobs:
|
6
|
-
publish:
|
7
|
-
runs-on: ubuntu-latest
|
8
|
-
steps:
|
9
|
-
- uses: actions/checkout@v2
|
10
|
-
- uses: ruby/setup-ruby@v1
|
11
|
-
with:
|
12
|
-
ruby-version: 2.6
|
13
|
-
bundler-cache: true
|
14
|
-
- uses: actions/cache@v2
|
15
|
-
with:
|
16
|
-
path: "./vendor/bundle"
|
17
|
-
key: v1/${{ runner.os }}/ruby-2.6/${{ hashFiles('**/Gemfile.lock') }}
|
18
|
-
restore-keys: v1/${{ runner.os }}/ruby-2.6/
|
19
|
-
- uses: cadwallion/publish-rubygems-action@master
|
20
|
-
env:
|
21
|
-
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
|
22
|
-
RELEASE_COMMAND: make release
|
data/.github/workflows/test.yml
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
name: Test
|
2
|
-
on:
|
3
|
-
push:
|
4
|
-
branches: [master]
|
5
|
-
pull_request:
|
6
|
-
workflow_dispatch:
|
7
|
-
jobs:
|
8
|
-
test:
|
9
|
-
name: Test
|
10
|
-
strategy:
|
11
|
-
matrix:
|
12
|
-
os: [ubuntu-latest]
|
13
|
-
ruby: ['2.6', '2.7']
|
14
|
-
runs-on: ${{ matrix.os }}
|
15
|
-
steps:
|
16
|
-
- uses: actions/checkout@v2
|
17
|
-
- uses: ruby/setup-ruby@v1
|
18
|
-
with:
|
19
|
-
ruby-version: ${{matrix.ruby}}
|
20
|
-
bundler-cache: true
|
21
|
-
- uses: actions/cache@v2
|
22
|
-
with:
|
23
|
-
path: "./vendor/bundle"
|
24
|
-
key: v1/${{ runner.os }}/ruby-${{ matrix.ruby }}/${{ hashFiles('**/Gemfile.lock') }}
|
25
|
-
restore-keys: v1/${{ runner.os }}/ruby-${{ matrix.ruby }}/
|
26
|
-
- run: bundle exec rspec
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
data/.yardopts
DELETED
data/Gemfile
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in percy-capybara.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
gem 'guard-rspec', require: false
|
7
|
-
|
8
|
-
# (for development)
|
9
|
-
# gem 'percy-client', path: '~/src/percy-client'
|
10
|
-
|
11
|
-
group :test, :development do
|
12
|
-
gem 'pry'
|
13
|
-
gem 'puma'
|
14
|
-
gem 'webmock'
|
15
|
-
gem 'simplecov', require: false
|
16
|
-
end
|
data/Guardfile
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
guard :rspec, cmd: 'bundle exec rspec' do
|
2
|
-
require 'guard/rspec/dsl'
|
3
|
-
dsl = Guard::RSpec::Dsl.new(self)
|
4
|
-
|
5
|
-
# RSpec files
|
6
|
-
rspec = dsl.rspec
|
7
|
-
watch(rspec.spec_helper) { rspec.spec_dir }
|
8
|
-
watch(rspec.spec_support) { rspec.spec_dir }
|
9
|
-
watch(rspec.spec_files)
|
10
|
-
|
11
|
-
# Ruby files
|
12
|
-
ruby = dsl.ruby
|
13
|
-
dsl.watch_spec_files_for(ruby.lib_files)
|
14
|
-
end
|
data/Makefile
DELETED
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
data/percy-capybara.gemspec
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require_relative './lib/percy/version'
|
2
|
-
|
3
|
-
Gem::Specification.new do |spec|
|
4
|
-
spec.name = 'percy-capybara'
|
5
|
-
spec.version = PercyCapybara::VERSION
|
6
|
-
spec.authors = ['Perceptual Inc.']
|
7
|
-
spec.email = ['team@percy.io']
|
8
|
-
spec.summary = %q{Percy visual testing for Capybara}
|
9
|
-
spec.description = %q{}
|
10
|
-
spec.homepage = ''
|
11
|
-
spec.license = 'MIT'
|
12
|
-
spec.required_ruby_version = '>= 2.3.0'
|
13
|
-
|
14
|
-
spec.metadata = {
|
15
|
-
'bug_tracker_uri' => 'https://github.com/percy/percy-capybara/issues',
|
16
|
-
'source_code_uri' => 'https://github.com/percy/percy-capybara',
|
17
|
-
}
|
18
|
-
|
19
|
-
spec.files = `git ls-files -z`.split("\x0")
|
20
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
22
|
-
spec.require_paths = ['lib']
|
23
|
-
|
24
|
-
spec.add_runtime_dependency 'capybara', '>= 3'
|
25
|
-
|
26
|
-
spec.add_development_dependency 'selenium-webdriver', '>= 4.0.0.beta1'
|
27
|
-
spec.add_development_dependency 'bundler', '>= 2.0'
|
28
|
-
spec.add_development_dependency 'rake', '~> 13.0'
|
29
|
-
spec.add_development_dependency 'rspec', '~> 3.5'
|
30
|
-
spec.add_development_dependency 'capybara', '~> 3.31'
|
31
|
-
spec.add_development_dependency 'percy-style', '~> 0.7.0'
|
32
|
-
end
|
data/spec/fixture/index.html
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
<html><head><title>I am a page</title></head><body>Snapshot me</body></html>
|
@@ -1,103 +0,0 @@
|
|
1
|
-
LABEL = PercyCapybara::PERCY_LABEL
|
2
|
-
|
3
|
-
RSpec.describe PercyCapybara, type: :feature do
|
4
|
-
before(:each) do
|
5
|
-
WebMock.disable_net_connect!(allow: '127.0.0.1', disallow: 'localhost')
|
6
|
-
page.__percy_clear_cache!
|
7
|
-
end
|
8
|
-
|
9
|
-
describe 'snapshot', type: :feature do
|
10
|
-
it 'disables when healthcheck version is incorrect' do
|
11
|
-
stub_request(:get, "#{PercyCapybara::PERCY_SERVER_ADDRESS}/percy/healthcheck")
|
12
|
-
.to_return(status: 200, body: '', headers: {'x-percy-core-version': '0.1.0'})
|
13
|
-
|
14
|
-
expect { page.percy_snapshot('Name') }
|
15
|
-
.to output("#{LABEL} Unsupported Percy CLI version, 0.1.0\n").to_stdout
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'disables when healthcheck version is missing' do
|
19
|
-
stub_request(:get, "#{PercyCapybara::PERCY_SERVER_ADDRESS}/percy/healthcheck")
|
20
|
-
.to_return(status: 200, body: '', headers: {})
|
21
|
-
|
22
|
-
expect { page.percy_snapshot('Name') }
|
23
|
-
.to output(
|
24
|
-
"#{LABEL} You may be using @percy/agent which" \
|
25
|
-
' is no longer supported by this SDK. Please uninstall' \
|
26
|
-
' @percy/agent and install @percy/cli instead.' \
|
27
|
-
" https://docs.percy.io/docs/migrating-to-percy-cli\n",
|
28
|
-
).to_stdout
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'disables when healthcheck fails' do
|
32
|
-
stub_request(:get, "#{PercyCapybara::PERCY_SERVER_ADDRESS}/percy/healthcheck")
|
33
|
-
.to_return(status: 500, body: '', headers: {})
|
34
|
-
|
35
|
-
expect { page.percy_snapshot('Name') }
|
36
|
-
.to output("#{LABEL} Percy is not running, disabling snapshots\n").to_stdout
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'disables when healthcheck fails to connect' do
|
40
|
-
stub_request(:get, "#{PercyCapybara::PERCY_SERVER_ADDRESS}/percy/healthcheck")
|
41
|
-
.to_raise(StandardError)
|
42
|
-
|
43
|
-
expect { page.percy_snapshot('Name') }
|
44
|
-
.to output("#{LABEL} Percy is not running, disabling snapshots\n").to_stdout
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'throws an error when name is not provided' do
|
48
|
-
stub_request(:get, "#{PercyCapybara::PERCY_SERVER_ADDRESS}/percy/healthcheck")
|
49
|
-
.to_return(status: 500, body: '', headers: {})
|
50
|
-
|
51
|
-
expect { page.percy_snapshot }.to raise_error(ArgumentError)
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'logs an error when sending a snapshot fails' do
|
55
|
-
stub_request(:get, "#{PercyCapybara::PERCY_SERVER_ADDRESS}/percy/healthcheck")
|
56
|
-
.to_return(status: 200, body: '', headers: {'x-percy-core-version': '1.0.0'})
|
57
|
-
|
58
|
-
stub_request(:get, "#{PercyCapybara::PERCY_SERVER_ADDRESS}/percy/dom.js")
|
59
|
-
.to_return(
|
60
|
-
status: 200,
|
61
|
-
body: 'window.PercyDOM = { serialize: () => document.documentElement.outerHTML };',
|
62
|
-
headers: {},
|
63
|
-
)
|
64
|
-
|
65
|
-
stub_request(:post, 'http://localhost:5338/percy/snapshot')
|
66
|
-
.to_return(status: 200, body: '', headers: {})
|
67
|
-
|
68
|
-
expect { page.percy_snapshot('Name') }
|
69
|
-
.to output("#{LABEL} Could not take DOM snapshot 'Name'\n").to_stdout
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'sends snapshots to the local server' do
|
73
|
-
stub_request(:get, "#{PercyCapybara::PERCY_SERVER_ADDRESS}/percy/healthcheck")
|
74
|
-
.to_return(status: 200, body: '', headers: {'x-percy-core-version': '1.0.0'})
|
75
|
-
|
76
|
-
stub_request(:get, "#{PercyCapybara::PERCY_SERVER_ADDRESS}/percy/dom.js")
|
77
|
-
.to_return(
|
78
|
-
status: 200,
|
79
|
-
body: 'window.PercyDOM = { serialize: () => document.documentElement.outerHTML };',
|
80
|
-
headers: {},
|
81
|
-
)
|
82
|
-
|
83
|
-
stub_request(:post, 'http://localhost:5338/percy/snapshot')
|
84
|
-
.to_return(status: 200, body: '{"success": "true" }', headers: {})
|
85
|
-
|
86
|
-
visit 'index.html'
|
87
|
-
page.percy_snapshot('Name')
|
88
|
-
|
89
|
-
expect(WebMock)
|
90
|
-
.to have_requested(:post, "#{PercyCapybara::PERCY_SERVER_ADDRESS}/percy/snapshot")
|
91
|
-
.with(
|
92
|
-
body: {
|
93
|
-
name: 'Name',
|
94
|
-
url: 'http://127.0.0.1:3003/index.html',
|
95
|
-
dom_snapshot:
|
96
|
-
"<html><head><title>I am a page</title></head><body>Snapshot me\n</body></html>",
|
97
|
-
client_info: "percy-capybara/#{PercyCapybara::VERSION}",
|
98
|
-
environment_info: "capybara/#{Capybara::VERSION} ruby/#{RUBY_VERSION}",
|
99
|
-
}.to_json,
|
100
|
-
).once
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
# This must be required & started before any app code (for proper coverage)
|
2
|
-
require 'simplecov'
|
3
|
-
SimpleCov.start
|
4
|
-
SimpleCov.minimum_coverage 100
|
5
|
-
|
6
|
-
require 'capybara/rspec'
|
7
|
-
require 'webmock/rspec'
|
8
|
-
require 'percy/capybara'
|
9
|
-
|
10
|
-
RSpec.configure do |config|
|
11
|
-
config.expect_with :rspec do |expectations|
|
12
|
-
# This option will default to `true` in RSpec 4.
|
13
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
14
|
-
end
|
15
|
-
|
16
|
-
config.mock_with :rspec do |mocks|
|
17
|
-
mocks.verify_partial_doubles = true
|
18
|
-
end
|
19
|
-
|
20
|
-
config.disable_monkey_patching!
|
21
|
-
# config.warnings = true
|
22
|
-
|
23
|
-
# Run specs in random order to surface order dependencies. If you find an
|
24
|
-
# order dependency and want to debug it, you can fix the order by providing
|
25
|
-
# the seed, which is printed after each run.
|
26
|
-
# --seed 1234
|
27
|
-
config.order = :random
|
28
|
-
|
29
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
30
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
31
|
-
# test failures related to randomization by passing the same `--seed` value
|
32
|
-
# as the one that triggered the failure.
|
33
|
-
Kernel.srand config.seed
|
34
|
-
|
35
|
-
# See https://github.com/teamcapybara/capybara#selecting-the-driver for other options
|
36
|
-
Capybara.default_driver = :selenium_headless
|
37
|
-
Capybara.javascript_driver = :selenium_headless
|
38
|
-
|
39
|
-
# Setup for Capybara to test static files served by Rack
|
40
|
-
Capybara.server_port = 3003
|
41
|
-
Capybara.server = :puma, { Silent: true }
|
42
|
-
Capybara.app = Rack::File.new(File.join(File.dirname(__FILE__), 'fixture'))
|
43
|
-
end
|
44
|
-
|
45
|
-
## Add cache clearing methods for tests
|
46
|
-
Capybara::Session.class_eval {
|
47
|
-
def __percy_clear_cache!
|
48
|
-
@percy_dom = nil
|
49
|
-
@percy_enabled = nil
|
50
|
-
end
|
51
|
-
}
|