show_me_the_cookies 4.0.0 → 5.0.0

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
  SHA1:
3
- metadata.gz: b786abed42a08a5f1ca008e722475ab215db4cac
4
- data.tar.gz: '029a71131e14ab735d7886e971b956f05f0c6adc'
3
+ metadata.gz: 40ab03246d1bebdccb7c79ed98ab3732f7aac255
4
+ data.tar.gz: 9a050a1f8521abc44be9a3d369c636028c7d38f1
5
5
  SHA512:
6
- metadata.gz: 39f69eaac7f76adeca3ffaf1bfac7f051de22390d9d334d3a0d1df78be92ead0f850d834b8ab292e46670462defdcb84b34762396ac851ada1e194c837c6c13f
7
- data.tar.gz: f1fde28a446fd7ad542505734abac440febedc3fce610c8382b6bb0fac0db869c57110375c61e583e9cd89c33b076bd5f0b343543836aca557ec27952fd42aa5
6
+ metadata.gz: 74558199adf4ad24cd6f137e76d640f0ef473ae5745cfdd0b7be72c2947da4a68fbfe659ad2fb8d82f8d0db3357965e047ffb1bb45a4d2379d43d3b674e20af2
7
+ data.tar.gz: eb0f44cf2689edea5881a3a3c25df42120f9ba8991428dd62930782e5200868eb94976372d3c40e1abc70ac1be350a658a4468d33cd6e5552bd1e1f572bbb403
data/Changelog.md ADDED
@@ -0,0 +1,24 @@
1
+ # 5.0
2
+
3
+ ## Capybara-webkit removed
4
+
5
+ Due to obsolescence and maintenance difficulty.
6
+ Setting up capybara-webkit and qt has never been fun, but now it's getting
7
+ silly: According to the [capybara-webkit wiki](https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit) Qt has removed the necessary webkit bindings, and homebrew has removed the old version of qt that still had them.
8
+
9
+ New / current projects should switch to headless Chrome or Firefox with webdriver, which will work with the existing adapters, but if you need the webkit driver for legacy apps stick with version 4, or copy the adapter from version 4 into your app's test support code.
10
+
11
+ ## Chrome and Firefox driver names
12
+
13
+ Drivers are now registered matching the names used by [capybara](https://github.com/teamcapybara/capybara):
14
+
15
+ :selenium => Selenium driving Firefox
16
+ :selenium_headless => Selenium driving Firefox in a headless configuration
17
+ :selenium_chrome => Selenium driving Chrome
18
+ :selenium_chrome_headless => Selenium driving Chrome in a headless configuration
19
+
20
+ # 4.0
21
+
22
+ Changes some cookie escaping logic & supports capybara 3.
23
+
24
+ For more information see the release commit: [cc0a1106d9cb00827aeda3301f5b75d6d10e80ba](https://github.com/nruth/show_me_the_cookies/commit/cc0a1106d9cb00827aeda3301f5b75d6d10e80ba)
data/Gemfile CHANGED
@@ -7,9 +7,8 @@ gem 'rake' # for releases
7
7
 
8
8
  group :test do
9
9
  gem 'rspec', '~> 3.0'
10
- gem 'poltergeist', git: 'https://github.com/teampoltergeist/poltergeist', ref: 'f822d3a'
10
+ gem 'poltergeist'
11
11
  gem 'sinatra'
12
12
  gem 'selenium-webdriver'
13
13
  gem 'chromedriver-helper' # chromedriver installer
14
- gem 'capybara-webkit'
15
14
  end
data/Gemfile.lock CHANGED
@@ -1,94 +1,85 @@
1
- GIT
2
- remote: https://github.com/teampoltergeist/poltergeist
3
- revision: f822d3acbe110669420c311484e3dfafa2d31e18
4
- ref: f822d3a
5
- specs:
6
- poltergeist (1.17.0)
7
- capybara (>= 2.1, < 4)
8
- cliver (~> 0.3.1)
9
- websocket-driver (>= 0.2.0)
10
-
11
1
  PATH
12
2
  remote: .
13
3
  specs:
14
- show_me_the_cookies (4.0.0)
4
+ show_me_the_cookies (5.0.0)
15
5
  capybara (>= 2, < 4)
16
6
 
17
7
  GEM
18
8
  remote: http://rubygems.org/
19
9
  specs:
20
- addressable (2.5.2)
10
+ addressable (2.6.0)
21
11
  public_suffix (>= 2.0.2, < 4.0)
22
12
  archive-zip (0.11.0)
23
13
  io-like (~> 0.3.0)
24
- capybara (3.0.1)
14
+ capybara (3.13.2)
25
15
  addressable
26
16
  mini_mime (>= 0.1.3)
27
17
  nokogiri (~> 1.8)
28
18
  rack (>= 1.6.0)
29
19
  rack-test (>= 0.6.3)
30
- xpath (~> 3.0)
31
- capybara-webkit (1.15.0)
32
- capybara (>= 2.3, < 4.0)
33
- json
20
+ regexp_parser (~> 1.2)
21
+ xpath (~> 3.2)
34
22
  childprocess (0.9.0)
35
23
  ffi (~> 1.0, >= 1.0.11)
36
- chromedriver-helper (1.2.0)
24
+ chromedriver-helper (2.1.0)
37
25
  archive-zip (~> 0.10)
38
26
  nokogiri (~> 1.8)
39
27
  cliver (0.3.2)
40
28
  diff-lcs (1.3)
41
- ffi (1.9.23)
29
+ ffi (1.10.0)
42
30
  io-like (0.3.0)
43
- json (2.1.0)
44
- mini_mime (1.0.0)
45
- mini_portile2 (2.3.0)
46
- mustermann (1.0.2)
47
- nokogiri (1.8.2)
48
- mini_portile2 (~> 2.3.0)
49
- public_suffix (3.0.2)
50
- rack (2.0.4)
51
- rack-protection (2.0.1)
31
+ mini_mime (1.0.1)
32
+ mini_portile2 (2.4.0)
33
+ mustermann (1.0.3)
34
+ nokogiri (1.10.1)
35
+ mini_portile2 (~> 2.4.0)
36
+ poltergeist (1.18.1)
37
+ capybara (>= 2.1, < 4)
38
+ cliver (~> 0.3.1)
39
+ websocket-driver (>= 0.2.0)
40
+ public_suffix (3.0.3)
41
+ rack (2.0.6)
42
+ rack-protection (2.0.5)
52
43
  rack
53
- rack-test (1.0.0)
44
+ rack-test (1.1.0)
54
45
  rack (>= 1.0, < 3)
55
- rake (12.3.1)
56
- rspec (3.7.0)
57
- rspec-core (~> 3.7.0)
58
- rspec-expectations (~> 3.7.0)
59
- rspec-mocks (~> 3.7.0)
60
- rspec-core (3.7.1)
61
- rspec-support (~> 3.7.0)
62
- rspec-expectations (3.7.0)
46
+ rake (12.3.2)
47
+ regexp_parser (1.3.0)
48
+ rspec (3.8.0)
49
+ rspec-core (~> 3.8.0)
50
+ rspec-expectations (~> 3.8.0)
51
+ rspec-mocks (~> 3.8.0)
52
+ rspec-core (3.8.0)
53
+ rspec-support (~> 3.8.0)
54
+ rspec-expectations (3.8.2)
63
55
  diff-lcs (>= 1.2.0, < 2.0)
64
- rspec-support (~> 3.7.0)
65
- rspec-mocks (3.7.0)
56
+ rspec-support (~> 3.8.0)
57
+ rspec-mocks (3.8.0)
66
58
  diff-lcs (>= 1.2.0, < 2.0)
67
- rspec-support (~> 3.7.0)
68
- rspec-support (3.7.1)
69
- rubyzip (1.2.1)
70
- selenium-webdriver (3.11.0)
59
+ rspec-support (~> 3.8.0)
60
+ rspec-support (3.8.0)
61
+ rubyzip (1.2.2)
62
+ selenium-webdriver (3.141.0)
71
63
  childprocess (~> 0.5)
72
- rubyzip (~> 1.2)
73
- sinatra (2.0.1)
64
+ rubyzip (~> 1.2, >= 1.2.2)
65
+ sinatra (2.0.5)
74
66
  mustermann (~> 1.0)
75
67
  rack (~> 2.0)
76
- rack-protection (= 2.0.1)
68
+ rack-protection (= 2.0.5)
77
69
  tilt (~> 2.0)
78
- tilt (2.0.8)
70
+ tilt (2.0.9)
79
71
  websocket-driver (0.7.0)
80
72
  websocket-extensions (>= 0.1.0)
81
73
  websocket-extensions (0.1.3)
82
- xpath (3.0.0)
74
+ xpath (3.2.0)
83
75
  nokogiri (~> 1.8)
84
76
 
85
77
  PLATFORMS
86
78
  ruby
87
79
 
88
80
  DEPENDENCIES
89
- capybara-webkit
90
81
  chromedriver-helper
91
- poltergeist!
82
+ poltergeist
92
83
  rake
93
84
  rspec (~> 3.0)
94
85
  selenium-webdriver
@@ -96,4 +87,4 @@ DEPENDENCIES
96
87
  sinatra
97
88
 
98
89
  BUNDLED WITH
99
- 1.16.0
90
+ 1.16.6
data/README.md CHANGED
@@ -2,10 +2,11 @@
2
2
 
3
3
  [![Build Status](https://semaphoreapp.com/api/v1/projects/9a0dc444-fd04-4187-95a7-7a07abecbad7/201807/shields_badge.png)](https://semaphoreapp.com/nruth/show_me_the_cookies) [![Gem Version](https://badge.fury.io/rb/show_me_the_cookies.svg)](http://badge.fury.io/rb/show_me_the_cookies)
4
4
 
5
- Some helpers for poking around at your Capybara driven browser's cookies in integration tests. Should have been called capybara-cookies if you go by the [rubygems naming guide](http://guides.rubygems.org/name-your-gem/).
5
+ Some helpers for poking around at your Capybara driven browser's cookies in integration tests.
6
6
 
7
- Provides drivers for rack-test, [selenium-webdriver](https://rubygems.org/gems/selenium-webdriver), [Poltergeist](https://github.com/teampoltergeist/poltergeist) (PhantomJS) and [capybara-webkit](https://github.com/thoughtbot/capybara-webkit).
8
- You may add new drivers for your application by implementing an adapter class and calling ShowMeTheCookies.register_adapter in your test code (e.g. a spec/support file).
7
+ Provides drivers for rack-test, [selenium-webdriver](https://rubygems.org/gems/selenium-webdriver), and [Poltergeist](https://github.com/teampoltergeist/poltergeist) (PhantomJS).
8
+
9
+ You can add new drivers to your application by implementing an adapter class and calling ShowMeTheCookies.register_adapter in your test code (e.g. a spec/support file). But in that case you might prefer to skip this gem and use your driver's api directly.
9
10
 
10
11
  ## API
11
12
 
@@ -1,5 +1,5 @@
1
1
  # change gem version here then use bundler's rake tasks to make a new release
2
2
  # follow semantic versioning http://guides.rubygems.org/patterns/#semantic-versioning
3
3
  module ShowMeTheCookies
4
- VERSION = '4.0.0'
4
+ VERSION = '5.0.0'
5
5
  end
@@ -3,7 +3,6 @@ module ShowMeTheCookies
3
3
  require 'show_me_the_cookies/adapters/poltergeist'
4
4
  require 'show_me_the_cookies/adapters/selenium'
5
5
  require 'show_me_the_cookies/adapters/selenium_chrome'
6
- require 'show_me_the_cookies/adapters/webkit'
7
6
 
8
7
  @adapters = {}
9
8
  class << self
@@ -19,11 +18,11 @@ module ShowMeTheCookies
19
18
 
20
19
  # to register your own adapter/driver do this in your test setup code somewhere e.g. spec/support
21
20
  register_adapter(:selenium, ShowMeTheCookies::Selenium)
21
+ register_adapter(:selenium_headless, ShowMeTheCookies::Selenium)
22
22
  register_adapter(:selenium_chrome, ShowMeTheCookies::SeleniumChrome)
23
+ register_adapter(:selenium_chrome_headless, ShowMeTheCookies::SeleniumChrome)
23
24
  register_adapter(:rack_test, ShowMeTheCookies::RackTest)
24
25
  register_adapter(:poltergeist, ShowMeTheCookies::Poltergeist)
25
- register_adapter(:webkit, ShowMeTheCookies::Webkit)
26
- register_adapter(:webkit_debug, ShowMeTheCookies::Webkit)
27
26
 
28
27
  # puts a string summary of the cookie
29
28
  def show_me_the_cookie(cookie_name)
@@ -1,18 +1,8 @@
1
1
  require 'spec_helper'
2
2
  require 'shared_examples_for_api'
3
- require 'selenium-webdriver'
4
3
 
5
-
6
-
7
- Capybara.register_driver :selenium do |app|
8
- options = Selenium::WebDriver::Firefox::Options.new(args: ['-headless'])
9
- Capybara::Selenium::Driver.new(app, browser: :firefox, options: options)
10
- end
11
-
12
- RSpec.describe 'Selenium Webdriver Firefox', type: :feature do
13
- before(:each) do
14
- Capybara.current_driver = :selenium
15
- end
4
+ RSpec.describe 'Selenium Webdriver Headless Chrome', type: :feature,
5
+ driver: :selenium_chrome_headless do
16
6
 
17
7
  describe 'the testing rig' do
18
8
  it 'should load the sinatra app' do
@@ -1,23 +1,8 @@
1
1
  require 'spec_helper'
2
2
  require 'shared_examples_for_api'
3
- require "selenium/webdriver"
4
3
 
5
- Capybara.register_driver :selenium_chrome do |app|
6
- capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
7
- chromeOptions: { args: %w(headless disable-gpu) },
8
- )
9
-
10
- Capybara::Selenium::Driver.new(
11
- app,
12
- browser: :chrome,
13
- desired_capabilities: capabilities,
14
- )
15
- end
16
-
17
- RSpec.describe 'Selenium Webdriver Chrome', type: :feature do
18
- before(:each) do
19
- Capybara.current_driver = :selenium_chrome
20
- end
4
+ RSpec.describe 'Selenium Webdriver Chrome', type: :feature,
5
+ driver: :selenium_chrome do
21
6
 
22
7
  describe 'the testing rig' do
23
8
  it 'should load the sinatra app' do
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+ require 'shared_examples_for_api'
3
+
4
+ RSpec.describe 'Selenium Webdriver Firefox Headless', type: :feature,
5
+ driver: :selenium_headless do
6
+
7
+ describe 'the testing rig' do
8
+ it 'should load the sinatra app' do
9
+ visit '/'
10
+ expect(page).to have_content('Cookie setter ready')
11
+ end
12
+ end
13
+
14
+ it_behaves_like 'the API'
15
+
16
+ it 'raises an exception when writing a cookie before visiting the app' do
17
+ expect { create_cookie('choc', 'milk') }.to(
18
+ raise_error(ShowMeTheCookies::SeleniumSiteNotVisitedError)
19
+ )
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+ require 'shared_examples_for_api'
3
+
4
+ RSpec.describe 'Selenium Webdriver Firefox', type: :feature, driver: :selenium do
5
+ describe 'the testing rig' do
6
+ it 'should load the sinatra app' do
7
+ visit '/'
8
+ expect(page).to have_content('Cookie setter ready')
9
+ end
10
+ end
11
+
12
+ it_behaves_like 'the API'
13
+
14
+ it 'raises an exception when writing a cookie before visiting the app' do
15
+ expect { create_cookie('choc', 'milk') }.to(
16
+ raise_error(ShowMeTheCookies::SeleniumSiteNotVisitedError)
17
+ )
18
+ end
19
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,11 @@
1
1
  require 'capybara/rspec'
2
2
 
3
+ # load chromedriver-helper so it sets the path to the chromedriver executable
4
+ # otherwise get errors like
5
+ # "unable to connect to chromedriver 127.0.0.1:9515 (Selenium::WebDriver::Error::WebDriverError)"
6
+ # when Selenium runs the wrong executable
7
+ require 'chromedriver-helper'
8
+
3
9
  # puma dependency unnecessary for this small project, just use stdlib
4
10
  Capybara.server = :webrick
5
11
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: show_me_the_cookies
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Rutherford
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-10 00:00:00.000000000 Z
11
+ date: 2019-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -38,6 +38,7 @@ extensions: []
38
38
  extra_rdoc_files: []
39
39
  files:
40
40
  - ".gitignore"
41
+ - Changelog.md
41
42
  - Gemfile
42
43
  - Gemfile.lock
43
44
  - README.md
@@ -47,16 +48,16 @@ files:
47
48
  - lib/show_me_the_cookies/adapters/rack_test.rb
48
49
  - lib/show_me_the_cookies/adapters/selenium.rb
49
50
  - lib/show_me_the_cookies/adapters/selenium_chrome.rb
50
- - lib/show_me_the_cookies/adapters/webkit.rb
51
51
  - lib/show_me_the_cookies/version.rb
52
52
  - show_me_the_cookies.gemspec
53
53
  - spec/app/set_cookie.rb
54
54
  - spec/drivers/poltergeist_spec.rb
55
55
  - spec/drivers/rack-test_spec.rb
56
+ - spec/drivers/selenium_chrome_headless_spec.rb
56
57
  - spec/drivers/selenium_chrome_spec.rb
57
- - spec/drivers/selenium_firefox_spec.rb
58
+ - spec/drivers/selenium_headless_spec.rb
59
+ - spec/drivers/selenium_spec.rb
58
60
  - spec/drivers/unknown_driver_spec.rb
59
- - spec/drivers/webkit_spec.rb
60
61
  - spec/shared_examples_for_api.rb
61
62
  - spec/spec_helper.rb
62
63
  homepage: https://github.com/nruth/show_me_the_cookies
@@ -87,9 +88,10 @@ test_files:
87
88
  - spec/app/set_cookie.rb
88
89
  - spec/drivers/poltergeist_spec.rb
89
90
  - spec/drivers/rack-test_spec.rb
91
+ - spec/drivers/selenium_chrome_headless_spec.rb
90
92
  - spec/drivers/selenium_chrome_spec.rb
91
- - spec/drivers/selenium_firefox_spec.rb
93
+ - spec/drivers/selenium_headless_spec.rb
94
+ - spec/drivers/selenium_spec.rb
92
95
  - spec/drivers/unknown_driver_spec.rb
93
- - spec/drivers/webkit_spec.rb
94
96
  - spec/shared_examples_for_api.rb
95
97
  - spec/spec_helper.rb
@@ -1,59 +0,0 @@
1
- module ShowMeTheCookies
2
- class Webkit
3
- def initialize(driver)
4
- @driver = driver
5
- end
6
-
7
- def get_me_the_cookie(name)
8
- cookie = cookie_jar.find(name)
9
- translate(cookie) unless cookie.nil?
10
- end
11
-
12
- def get_me_the_cookies
13
- cookies.each.map(&method(:translate))
14
- end
15
-
16
- def expire_cookies
17
- cookies.each do |cookie|
18
- delete_cookie(cookie.name) if cookie.expires.nil?
19
- end
20
- end
21
-
22
- # Since QTWebkit doesn't seem to offer deletion, clearing all and re-setting the rest seems to be it
23
- def delete_cookie(name)
24
- old_cookies = cookies
25
- @driver.clear_cookies
26
- old_cookies.each do |cookie|
27
- @driver.set_cookie(cookie) unless cookie.name == name.to_s
28
- end
29
- end
30
-
31
- def create_cookie(name, value, options)
32
- host = options.delete(:domain) || (Capybara.app_host ? URI(Capybara.app_host).host : '127.0.0.1')
33
- puts "Webkit create_cookie options not supported: #{options.inspect}" if options && (options != {})
34
- @driver.set_cookie("#{name}=#{Rack::Utils.escape(value)}; domain=#{host}")
35
- end
36
-
37
- private
38
-
39
- # see https://github.com/thoughtbot/capybara-webkit/blob/master/lib/capybara/webkit/cookie_jar.rb
40
- def cookie_jar
41
- @driver.cookies
42
- end
43
-
44
- def cookies
45
- cookie_jar.send("cookies")
46
- end
47
-
48
- def translate(cookie)
49
- {
50
- :name => cookie.name,
51
- :domain => cookie.domain,
52
- :value => cookie.value,
53
- :expires => (cookie.expires rescue nil),
54
- :path => cookie.path,
55
- :secure => cookie.secure.nil? ? false : true
56
- }
57
- end
58
- end
59
- end
@@ -1,22 +0,0 @@
1
- require 'spec_helper'
2
- require 'shared_examples_for_api'
3
- require 'capybara-webkit'
4
-
5
- Capybara::Webkit.configure do |config|
6
- config.allow_url("subdomain.lvh.me")
7
- end
8
-
9
- RSpec.describe 'Webkit', type: :feature do
10
- before(:each) do
11
- Capybara.current_driver = :webkit
12
- end
13
-
14
- describe 'the testing rig' do
15
- it 'should load the sinatra app' do
16
- visit '/'
17
- expect(page).to have_content('Cookie setter ready')
18
- end
19
- end
20
-
21
- it_behaves_like 'the API'
22
- end