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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c95d01092c2b8baa80ced4adc7c999924218982047730f4c4eb7425871dee6ff
4
- data.tar.gz: 17a6ced2cf748377531e336dde040f9c644625439f5b1ef2b31824d85b730dc0
3
+ metadata.gz: cd3adc36ef52095eaaf1e602bc347163260eaf0763a31083cbdc0915dab9f741
4
+ data.tar.gz: 996139e8abb4148ef33dfdf53f253c5b63b5647c43c59d7efe2d9ee7e58ab8fc
5
5
  SHA512:
6
- metadata.gz: 07e54f416f8aa76ef4efa66c675d3b719b591c3c69fd92f072da0d4722ede8255ee09ab73448e952e8c6b4faa3cf800a61b0b8d0e6fd6748ff4682d4dfe8b78a
7
- data.tar.gz: 2797605c75111a8b2cb0c195788fde9d029dcac84b653d5dd6ee617c5e5c10aa3015bac8abd2c65827edd7f93bccc88ff0eb2a243935913c43151b73dff24ff8
6
+ metadata.gz: 848ffc7e381ab1527e64f97f4d259d4d9f2c39c82fb549bc610b31c586e75aae0f206900bd272885e475ac74a86eb82da45fd6f4261817e448958238d4ce2945
7
+ data.tar.gz: bff21021c4768cf46ba80b08ac26246013c37ec0e82c1cab7077e68ca0c44517c1455e34437e6c6b1cb8cf25b612e3eb854d4015c0ef09088894f87a017bf8f3
@@ -1,6 +1,7 @@
1
1
  require 'net/http'
2
2
  require 'uri'
3
3
  require 'capybara/dsl'
4
+ require_relative './version'
4
5
 
5
6
  module PercyCapybara
6
7
  include Capybara::DSL
data/lib/percy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module PercyCapybara
2
- VERSION = '5.0.0.pre.2'.freeze
2
+ VERSION = '5.0.0.pre.3'.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.2
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-06 00:00:00.000000000 Z
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: []
@@ -1,8 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: bundler
4
- directory: /
5
- schedule:
6
- interval: weekly
7
- commit-message:
8
- prefix: ⬆️
@@ -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
@@ -1,11 +0,0 @@
1
- name: Changelog
2
- on:
3
- push:
4
- branches: [master]
5
- jobs:
6
- update_draft:
7
- runs-on: ubuntu-latest
8
- steps:
9
- - uses: release-drafter/release-drafter@v5
10
- env:
11
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -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
@@ -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
@@ -1,17 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- *.bundle
10
- *.so
11
- *.o
12
- *.a
13
- *.rbc
14
- mkmf.log
15
- .DS_Store
16
- Gemfile.lock
17
- node_modules/
data/.rspec DELETED
@@ -1,4 +0,0 @@
1
- --color
2
- --require spec_helper
3
- --format d
4
-
data/.rubocop.yml DELETED
@@ -1,13 +0,0 @@
1
- inherit_gem:
2
- percy-style:
3
- - default.yml
4
- RSpec/InstanceVariable:
5
- Exclude:
6
- -
7
- RSpec/ContextWording:
8
- Enabled: false
9
- AllCops:
10
- TargetRubyVersion: 2.4
11
- Include:
12
- - lib/**/*.rb
13
- - spec/lib/**/*.rb
data/.yardopts DELETED
@@ -1,2 +0,0 @@
1
- --protected
2
- --no-private
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
@@ -1,3 +0,0 @@
1
- release:
2
- rake build
3
- gem push pkg/percy-capybara-*
data/Rakefile DELETED
@@ -1 +0,0 @@
1
- require 'bundler/gem_tasks'
@@ -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
@@ -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
- }