percy-selenium 1.0.0.pre.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d4dd4bf046b2105027efc770ac2beeee0e4291c5a4cdf4ee98130dc549da07f5
4
+ data.tar.gz: a862d825ff902d8444e1e4b9407d543591df08eff4b51633abba02dcc51b15b3
5
+ SHA512:
6
+ metadata.gz: 7dc3f15847931136e710ebca3001b0603250e5cf1b1c80e510e6c9d293bbc8a6902ba5b6a26879556b1aea669b01cf33342c70ce02ec8b5847c9bb176ec7917d
7
+ data.tar.gz: d78c6ed16f6b4cdff7b59c5c5e09f85e33625dc62fe143aa5783a5b64e7a77dc5a6ff3f160a747fac5b4de7c2cd500d8606f491c3809323b30fcbed6fc0f6f77
@@ -0,0 +1,14 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: npm
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ commit-message:
8
+ prefix: ⬆️
9
+ - package-ecosystem: bundler
10
+ directory: /
11
+ schedule:
12
+ interval: weekly
13
+ commit-message:
14
+ prefix: ⬆️
@@ -0,0 +1,31 @@
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
@@ -0,0 +1,11 @@
1
+ name: Changelog
2
+ on:
3
+ push:
4
+ branches: [main]
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 }}
@@ -0,0 +1,22 @@
1
+ name: Lint
2
+ on:
3
+ push:
4
+ branches: [main]
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
@@ -0,0 +1,22 @@
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
@@ -0,0 +1,26 @@
1
+ name: Test
2
+ on:
3
+ push:
4
+ branches: [main]
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 ADDED
@@ -0,0 +1,17 @@
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 ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --require spec_helper
3
+ --format d
4
+
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
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 ADDED
@@ -0,0 +1,2 @@
1
+ --protected
2
+ --no-private
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in percy-selenium.gemspec
4
+ gemspec
5
+
6
+ gem "guard-rspec", require: false
7
+
8
+ group :test, :development do
9
+ gem "webmock"
10
+ gem "puma"
11
+ gem "pry"
12
+ gem "simplecov", require: false
13
+ end
data/Guardfile ADDED
@@ -0,0 +1,14 @@
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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2021 Perceptual Inc.
2
+
3
+ The MIT License (MIT)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/Makefile ADDED
@@ -0,0 +1,3 @@
1
+ release:
2
+ rake build
3
+ gem push pkg/percy-selenium-*
data/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # percy-selenium-ruby
2
+ ![Test](https://github.com/percy/percy-selenium-ruby/workflows/Test/badge.svg)
3
+
4
+ [Percy](https://percy.io) visual testing for Ruby Selenium.
5
+
6
+ ## Installation
7
+
8
+ npm install `@percy/cli`:
9
+
10
+ ```sh-session
11
+ $ npm install --save-dev @percy/cli
12
+ ```
13
+
14
+ gem install Percy selenium package:
15
+
16
+ ```ssh-session
17
+ $ gem install percy-selenium
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ This is an example test using the `Percy.snapshot` method.
23
+
24
+ ``` ruby
25
+ require 'percy'
26
+
27
+ driver = Selenium::WebDriver.for :firefox
28
+ driver.navigate.to "https://example.com"
29
+
30
+ # Take a snapshot
31
+ Percy.snapshot(driver, 'homepage')
32
+
33
+ driver.quit
34
+ ```
35
+
36
+ Running the test above normally will result in the following log:
37
+
38
+ ```sh-session
39
+ [percy] Percy is not running, disabling snapshots
40
+ ```
41
+
42
+ When running with [`percy
43
+ exec`](https://github.com/percy/cli/tree/master/packages/cli-exec#percy-exec), and your project's
44
+ `PERCY_TOKEN`, a new Percy build will be created and snapshots will be uploaded to your project.
45
+
46
+ ```sh-session
47
+ $ export PERCY_TOKEN=[your-project-token]
48
+ $ percy exec -- [ruby test command]
49
+ [percy] Percy has started!
50
+ [percy] Created build #1: https://percy.io/[your-project]
51
+ [percy] Snapshot taken "Ruby example"
52
+ [percy] Stopping percy...
53
+ [percy] Finalized build #1: https://percy.io/[your-project]
54
+ [percy] Done!
55
+ ```
56
+
57
+ ## Configuration
58
+
59
+ `Percy.snapshot(driver, name[, options])`
60
+
61
+ - `driver` (**required**) - A selenium-webdriver driver instance
62
+ - `name` (**required**) - The snapshot name; must be unique to each snapshot
63
+ - `options` - Additional snapshot options (overrides any project options)
64
+ - `widths` - An array of widths to take screenshots at
65
+ - `min_height` - The minimum viewport height to take screenshots at
66
+ - `percy_css` - Percy specific CSS only applied in Percy's rendering environment
67
+ - `request_headers` - Headers that should be used during asset discovery
68
+ - `enable_javascript` - Enable JavaScript in Percy's rendering environment
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
data/lib/percy.rb ADDED
@@ -0,0 +1,108 @@
1
+ require 'uri'
2
+ require 'json'
3
+ require 'version'
4
+ require 'net/http'
5
+ require 'selenium-webdriver'
6
+
7
+ module Percy
8
+ CLIENT_INFO = "percy-selenium-ruby/#{VERSION}".freeze
9
+ ENV_INFO = "selenium/#{Selenium::WebDriver::VERSION} ruby/#{RUBY_VERSION}".freeze
10
+
11
+ PERCY_DEBUG = ENV['PERCY_LOGLEVEL'] == 'debug'
12
+ PERCY_SERVER_ADDRESS = ENV['PERCY_SERVER_ADDRESS'] || 'http://localhost:5338'
13
+ LABEL = "[\u001b[35m" + (PERCY_DEBUG ? 'percy:ruby' : 'percy') + "\u001b[39m]"
14
+
15
+ # Take a DOM snapshot and post it to the snapshot endpoint
16
+ def self.snapshot(driver, name, options = {})
17
+ return unless percy_enabled?
18
+
19
+ begin
20
+ driver.execute_script(fetch_percy_dom)
21
+ dom_snapshot = driver.execute_script("return PercyDOM.serialize(#{options.to_json})")
22
+
23
+ response = fetch('percy/snapshot',
24
+ name: name,
25
+ url: driver.current_url,
26
+ dom_snapshot: dom_snapshot,
27
+ client_info: CLIENT_INFO,
28
+ environment_info: ENV_INFO,)
29
+
30
+ unless response.body.to_json['success']
31
+ raise StandardError, data['error']
32
+ end
33
+ rescue StandardError => e
34
+ log("Could not take DOM snapshot '#{name}'")
35
+
36
+ if PERCY_DEBUG then log(e) end
37
+ end
38
+ end
39
+
40
+ # Determine if the Percy server is running, caching the result so it is only checked once
41
+ def self.percy_enabled?
42
+ return @percy_enabled unless @percy_enabled.nil?
43
+
44
+ begin
45
+ response = fetch('percy/healthcheck')
46
+ version = response['x-percy-core-version']
47
+
48
+ if version.nil?
49
+ log('You may be using @percy/agent ' \
50
+ 'which is no longer supported by this SDK. ' \
51
+ 'Please uninstall @percy/agent and install @percy/cli instead. ' \
52
+ 'https://docs.percy.io/docs/migrating-to-percy-cli')
53
+ @percy_enabled = false
54
+ return false
55
+ end
56
+
57
+ if version.split('.')[0] != '1'
58
+ log("Unsupported Percy CLI version, #{version}")
59
+ @percy_enabled = false
60
+ return false
61
+ end
62
+
63
+ @percy_enabled = true
64
+ true
65
+ rescue StandardError => e
66
+ log('Percy is not running, disabling snapshots')
67
+
68
+ if PERCY_DEBUG then log(e) end
69
+ @percy_enabled = false
70
+ false
71
+ end
72
+ end
73
+
74
+ # Fetch the @percy/dom script, caching the result so it is only fetched once
75
+ def self.fetch_percy_dom
76
+ return @percy_dom unless @percy_dom.nil?
77
+
78
+ response = fetch('percy/dom.js')
79
+ @percy_dom = response.body
80
+ end
81
+
82
+ def self.log(msg)
83
+ puts "#{LABEL} #{msg}"
84
+ end
85
+
86
+ # Make an HTTP request (GET,POST) using Ruby's Net::HTTP. If `data` is present,
87
+ # `fetch` will POST as JSON.
88
+ def self.fetch(url, data = nil)
89
+ uri = URI("#{PERCY_SERVER_ADDRESS}/#{url}")
90
+
91
+ response = if data
92
+ Net::HTTP.post(uri, data.to_json)
93
+ else
94
+ Net::HTTP.get_response(uri)
95
+ end
96
+
97
+ unless response.is_a? Net::HTTPSuccess
98
+ raise StandardError, "Failed with HTTP error code: #{response.code}"
99
+ end
100
+
101
+ response
102
+ end
103
+
104
+ def self._clear_cache!
105
+ @percy_dom = nil
106
+ @percy_enabled = nil
107
+ end
108
+ end
data/lib/version.rb ADDED
@@ -0,0 +1,3 @@
1
+ module Percy
2
+ VERSION = '1.0.0.pre.0'.freeze
3
+ end
@@ -0,0 +1,33 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'percy-selenium'
8
+ spec.version = Percy::VERSION
9
+ spec.authors = ['Perceptual Inc.']
10
+ spec.email = ['team@percy.io']
11
+ spec.summary = %q{Percy}
12
+ spec.description = %q{}
13
+ spec.homepage = ''
14
+ spec.license = 'MIT'
15
+
16
+ spec.metadata = {
17
+ 'bug_tracker_uri' => 'https://github.com/percy/percy-selenium-ruby/issues',
18
+ 'source_code_uri' => 'https://github.com/percy/percy-selenium-ruby',
19
+ }
20
+
21
+ spec.files = `git ls-files -z`.split("\x0")
22
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
23
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
24
+ spec.require_paths = ['lib']
25
+
26
+ spec.add_runtime_dependency 'selenium-webdriver', '>= 4.0.0.beta1'
27
+
28
+ spec.add_development_dependency 'bundler', '>= 2.0'
29
+ spec.add_development_dependency 'rake', '~> 13.0'
30
+ spec.add_development_dependency 'rspec', '~> 3.5'
31
+ spec.add_development_dependency 'capybara', '~> 3.35'
32
+ spec.add_development_dependency 'percy-style', '~> 0.7.0'
33
+ end
@@ -0,0 +1 @@
1
+ <html><head><title>I am a page</title></head><body>Snapshot me</body></html>
@@ -0,0 +1,107 @@
1
+ RSpec.describe Percy, type: :feature do
2
+ before(:each) do
3
+ WebMock.disable_net_connect!(allow: '127.0.0.1', disallow: 'localhost')
4
+ Percy._clear_cache!
5
+ end
6
+
7
+ describe 'snapshot', type: :feature, js: true do
8
+ it 'disables when healthcheck version is incorrect' do
9
+ stub_request(:get, "#{Percy::PERCY_SERVER_ADDRESS}/percy/healthcheck")
10
+ .to_return(status: 200, body: '', headers: {'x-percy-core-version': '0.1.0'})
11
+
12
+ expect { Percy.snapshot(page, 'Name') }
13
+ .to output("#{Percy::LABEL} Unsupported Percy CLI version, 0.1.0\n").to_stdout
14
+ end
15
+
16
+ it 'disables when healthcheck version is missing' do
17
+ stub_request(:get, "#{Percy::PERCY_SERVER_ADDRESS}/percy/healthcheck")
18
+ .to_return(status: 200, body: '', headers: {})
19
+
20
+ expect { Percy.snapshot(page, 'Name') }
21
+ .to output(
22
+ "#{Percy::LABEL} You may be using @percy/agent which" \
23
+ ' is no longer supported by this SDK. Please uninstall' \
24
+ ' @percy/agent and install @percy/cli instead.' \
25
+ " https://docs.percy.io/docs/migrating-to-percy-cli\n",
26
+ ).to_stdout
27
+ end
28
+
29
+ it 'disables when healthcheck fails' do
30
+ stub_request(:get, "#{Percy::PERCY_SERVER_ADDRESS}/percy/healthcheck")
31
+ .to_return(status: 500, body: '', headers: {})
32
+
33
+ expect { Percy.snapshot(page, 'Name') }
34
+ .to output("#{Percy::LABEL} Percy is not running, disabling snapshots\n").to_stdout
35
+ end
36
+
37
+ it 'disables when healthcheck fails to connect' do
38
+ stub_request(:get, "#{Percy::PERCY_SERVER_ADDRESS}/percy/healthcheck")
39
+ .to_raise(StandardError)
40
+
41
+ expect { Percy.snapshot(page, 'Name') }
42
+ .to output("#{Percy::LABEL} Percy is not running, disabling snapshots\n").to_stdout
43
+ end
44
+
45
+ it 'throws an error when driver is not provided' do
46
+ stub_request(:get, "#{Percy::PERCY_SERVER_ADDRESS}/percy/healthcheck")
47
+ .to_return(status: 500, body: '', headers: {})
48
+
49
+ expect { Percy.snapshot }.to raise_error(ArgumentError)
50
+ end
51
+
52
+ it 'throws an error when name is not provided' do
53
+ stub_request(:get, "#{Percy::PERCY_SERVER_ADDRESS}/percy/healthcheck")
54
+ .to_return(status: 500, body: '', headers: {})
55
+
56
+ expect { Percy.snapshot(page) }.to raise_error(ArgumentError)
57
+ end
58
+
59
+ it 'logs an error when sending a snapshot fails' do
60
+ stub_request(:get, "#{Percy::PERCY_SERVER_ADDRESS}/percy/healthcheck")
61
+ .to_return(status: 200, body: '', headers: {'x-percy-core-version': '1.0.0'})
62
+
63
+ stub_request(:get, "#{Percy::PERCY_SERVER_ADDRESS}/percy/dom.js")
64
+ .to_return(
65
+ status: 200,
66
+ body: 'window.PercyDOM = { serialize: () => document.documentElement.outerHTML };',
67
+ headers: {},
68
+ )
69
+
70
+ stub_request(:post, 'http://localhost:5338/percy/snapshot')
71
+ .to_return(status: 200, body: '', headers: {})
72
+
73
+ expect { Percy.snapshot(page, 'Name') }
74
+ .to output("#{Percy::LABEL} Could not take DOM snapshot 'Name'\n").to_stdout
75
+ end
76
+
77
+ it 'sends snapshots to the local server' do
78
+ stub_request(:get, "#{Percy::PERCY_SERVER_ADDRESS}/percy/healthcheck")
79
+ .to_return(status: 200, body: '', headers: {'x-percy-core-version': '1.0.0'})
80
+
81
+ stub_request(:get, "#{Percy::PERCY_SERVER_ADDRESS}/percy/dom.js")
82
+ .to_return(
83
+ status: 200,
84
+ body: 'window.PercyDOM = { serialize: () => document.documentElement.outerHTML };',
85
+ headers: {},
86
+ )
87
+
88
+ stub_request(:post, 'http://localhost:5338/percy/snapshot')
89
+ .to_return(status: 200, body: '{"success": "true" }', headers: {})
90
+
91
+ visit 'index.html'
92
+ Percy.snapshot(page, 'Name')
93
+
94
+ expect(WebMock).to have_requested(:post, "#{Percy::PERCY_SERVER_ADDRESS}/percy/snapshot")
95
+ .with(
96
+ body: {
97
+ name: 'Name',
98
+ url: 'http://127.0.0.1:3003/index.html',
99
+ dom_snapshot:
100
+ "<html><head><title>I am a page</title></head><body>Snapshot me\n</body></html>",
101
+ client_info: "percy-selenium-ruby/#{Percy::VERSION}",
102
+ environment_info: "selenium/#{Selenium::WebDriver::VERSION} ruby/#{RUBY_VERSION}",
103
+ }.to_json,
104
+ ).once
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,45 @@
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 'rack'
7
+ require 'percy'
8
+ require 'webmock/rspec'
9
+ require 'capybara/rspec'
10
+ require 'selenium-webdriver'
11
+
12
+ RSpec.configure do |config|
13
+ config.expect_with :rspec do |expectations|
14
+ # This option will default to `true` in RSpec 4.
15
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
16
+ end
17
+
18
+ config.mock_with :rspec do |mocks|
19
+ mocks.verify_partial_doubles = true
20
+ end
21
+
22
+ config.disable_monkey_patching!
23
+ # config.warnings = true
24
+
25
+ # Run specs in random order to surface order dependencies. If you find an
26
+ # order dependency and want to debug it, you can fix the order by providing
27
+ # the seed, which is printed after each run.
28
+ # --seed 1234
29
+ config.order = :random
30
+
31
+ # Seed global randomization in this process using the `--seed` CLI option.
32
+ # Setting this allows you to use `--seed` to deterministically reproduce
33
+ # test failures related to randomization by passing the same `--seed` value
34
+ # as the one that triggered the failure.
35
+ Kernel.srand config.seed
36
+
37
+ # See https://github.com/teamcapybara/capybara#selecting-the-driver for other options
38
+ Capybara.default_driver = :selenium_headless
39
+ Capybara.javascript_driver = :selenium_headless
40
+
41
+ # Setup for Capybara to test Jekyll static files served by Rack
42
+ Capybara.server_port = 3003
43
+ Capybara.server = :puma, { Silent: true }
44
+ Capybara.app = Rack::File.new(File.join(File.dirname(__FILE__), 'fixture'))
45
+ end
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: percy-selenium
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0.pre.0
5
+ platform: ruby
6
+ authors:
7
+ - Perceptual Inc.
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-04-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: selenium-webdriver
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 4.0.0.beta1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 4.0.0.beta1
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '13.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '13.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.5'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.5'
69
+ - !ruby/object:Gem::Dependency
70
+ name: capybara
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.35'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.35'
83
+ - !ruby/object:Gem::Dependency
84
+ name: percy-style
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.7.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.7.0
97
+ description: ''
98
+ email:
99
+ - team@percy.io
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".github/dependabot.yml"
105
+ - ".github/release-drafter.yml"
106
+ - ".github/workflows/changelog.yml"
107
+ - ".github/workflows/lint.yml"
108
+ - ".github/workflows/release.yml"
109
+ - ".github/workflows/test.yml"
110
+ - ".gitignore"
111
+ - ".rspec"
112
+ - ".rubocop.yml"
113
+ - ".yardopts"
114
+ - Gemfile
115
+ - Guardfile
116
+ - LICENSE
117
+ - Makefile
118
+ - README.md
119
+ - Rakefile
120
+ - lib/percy.rb
121
+ - lib/version.rb
122
+ - percy-selenium.gemspec
123
+ - spec/fixture/index.html
124
+ - spec/lib/percy/percy_spec.rb
125
+ - spec/spec_helper.rb
126
+ homepage: ''
127
+ licenses:
128
+ - MIT
129
+ metadata:
130
+ bug_tracker_uri: https://github.com/percy/percy-selenium-ruby/issues
131
+ source_code_uri: https://github.com/percy/percy-selenium-ruby
132
+ post_install_message:
133
+ rdoc_options: []
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">"
144
+ - !ruby/object:Gem::Version
145
+ version: 1.3.1
146
+ requirements: []
147
+ rubygems_version: 3.0.3
148
+ signing_key:
149
+ specification_version: 4
150
+ summary: Percy
151
+ test_files:
152
+ - spec/fixture/index.html
153
+ - spec/lib/percy/percy_spec.rb
154
+ - spec/spec_helper.rb