so_many_devices 0.2.0 → 2.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c89db46b332aab888e79736d583df4b7897354fa0d5eb7d400ed9518e3ea5c9
4
- data.tar.gz: dd7d100ca70832f4cd6fdba1ba3c090893a08de58c7a259b08ac3636ff4bf7ab
3
+ metadata.gz: 15b6efb219438698be4a46e590cce66fdb663a413edd09d9cb2a1ce2e7a7ef63
4
+ data.tar.gz: 97ac505a5cd73539560f53732abc61c262c2a025983c54470cd97a86a0768e16
5
5
  SHA512:
6
- metadata.gz: f819f293cf1f3548930378db087c0329a1d93136e29ae62213a970217622e65be0bc56fe73bf075786fea0dfdea6a9e376a5ee0c4e08cb67b8d8e0cce33c1318
7
- data.tar.gz: d4ade32037dbda8691bcf4a60d93d3088cc5337994dfa1c1d63589aaa4263689e1b2d693864a93db198c55458ac3b447d3265726ad4c33bc9c8c47f96d9144cc
6
+ metadata.gz: 0d67c72914f145926dda6f5478fe91cb5460cd2bbe669dea37f6e9ab8c134f5aa65826de3ce2ea0acd3db4abc67787a29d8e34c354a5fb5002fc4b27237cf157
7
+ data.tar.gz: de20ca536bfa8216233c04c64c798ce27e9dd8ee52768ca3d196cf87f41089b865404932f361e36b00d12e5a86225712759c89ef21ed110d525215da100263ba
data/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ ## [2.0.0] - 2026-11-06
4
+
5
+ - **Breaking**: require Ruby 3.3 or newer.
6
+ - **Breaking**: all drivers run Chrome with `--force-prefers-reduced-motion`.
7
+ - Fix device drivers on Selenium 4, which no longer provides `Remote::Capabilities.chrome` and `desired_capabilities:`.
8
+ - Register the Chrome drivers with downloads only once, instead of once per device.
9
+ - Release from Semaphore when a version tag is pushed.
10
+
11
+ ## [1.0.0] - 2023-01-25
12
+
13
+ - Added two new methods `first_download` and `last_download`.
14
+ - Added more instructions to the README for Chrome with downloads options, in particular to clean up folders.
15
+ - Added an example to read a downloaded file
16
+
17
+ ## [0.2.0] - 2020-06-18
18
+
19
+ - Add chrome with downloads capabilities to the list of already so many devices
20
+
21
+ ## [0.1.0] - 2020-03-02
22
+
23
+ - Initial release
data/README.md CHANGED
@@ -43,6 +43,9 @@ config.before(:each, type: :system, js: true) do
43
43
  end
44
44
  ```
45
45
 
46
+ All drivers run Chrome with `--force-prefers-reduced-motion`, so pages honouring `prefers-reduced-motion`
47
+ skip their animations and transitions, which makes tests faster and less flaky.
48
+
46
49
  We use it to run our system tests on so many devices! Here is our standard configuration:
47
50
 
48
51
  ```ruby
@@ -76,6 +79,10 @@ config.before(:each, type: :system, js: true) do
76
79
  driven_by :selenium_chrome_with_download_headless # or non-headless version
77
80
  end
78
81
 
82
+ config.after(:each, type: :system, js: true) do
83
+ clear_downloads
84
+ end
85
+
79
86
  config.include SoManyDevices::DownloadsHelper, type: :system
80
87
  ```
81
88
 
@@ -87,24 +94,60 @@ it 'can download a file', :js do
87
94
  click_link 'Download PDF'
88
95
  wait_for_download
89
96
  expect(downloads.length).to eq(1)
90
- expect(download).to match(/.*\.pdf/)
97
+ expect(last_download).to match(/.*\.pdf/)
98
+ last_pdf = File.read(last_download)
99
+ end
100
+ ```
101
+
102
+ If you prefer to use this driver only on selected tests, you can use the following:
103
+
104
+ ```ruby
105
+ config.before(:each, type: :system, js: true, with_downloads: true) do
106
+ driven_by :selenium_chrome_with_download_headless
107
+ end
108
+
109
+ config.after(:each, type: :system, js: true, with_downloads: true) do
110
+ clear_downloads
111
+ end
112
+
113
+ config.include SoManyDevices::DownloadsHelper, type: :system
114
+ ```
115
+
116
+ and in your test (just an example...):
117
+
118
+ ```ruby
119
+ it 'can download a file', :js, :with_downloads do
91
120
  end
92
121
  ```
93
122
 
123
+ The call to `clear_downloads` makes sure that all the downloads are removed from the downloads folder.
124
+ All downloads are performed in the `tmp/downloads` folder of your project.
94
125
 
95
126
  ## Development
96
127
 
97
- After checking out the repo, run `bin/setup` to install dependencies.
98
- Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
128
+ After checking out the repo, run `bin/setup` to install dependencies.
129
+ Then, run `bin/check` to run the tests and `bin/fastcheck` to run the linter.
130
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
131
+
132
+ ### Release
133
+
134
+ 1. Bump the version in `lib/so_many_devices/version.rb`, run `bundle install`, update `CHANGELOG.md` and commit to `main`.
135
+ 2. Tag the commit with the bare version and push the tag:
136
+
137
+ ```bash
138
+ git tag -a 1.2.3 -m 1.2.3
139
+ git push origin 1.2.3
140
+ ```
141
+
142
+ 3. Create a GitHub release for the tag with the changelog section as notes.
99
143
 
100
- To install this gem onto your local machine, run `bundle exec rake install`.
101
- To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`,
102
- which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
144
+ Semaphore runs the tests on the tag and, when they pass, promotes the `release` pipeline, which pushes the gem to
145
+ [rubygems.org](https://rubygems.org). It fails when the tag does not match the gem version.
103
146
 
104
147
  ## Contributing
105
148
 
106
149
  Bug reports and pull requests are welcome on GitHub at <https://github.com/renuo/so_many_devices>.
107
- This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/renuo/so_many_devices/blob/master/CODE_OF_CONDUCT.md).
150
+ This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/renuo/so_many_devices/blob/main/CODE_OF_CONDUCT.md).
108
151
 
109
152
  Do you think our devices are not that many? 😡
110
153
 
@@ -116,7 +159,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
116
159
 
117
160
  ## Code of Conduct
118
161
 
119
- Everyone interacting in the SoManyDevices project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/renuo/so_many_devices/blob/master/CODE_OF_CONDUCT.md).
162
+ Everyone interacting in the SoManyDevices project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/renuo/so_many_devices/blob/main/CODE_OF_CONDUCT.md).
120
163
 
121
164
 
122
165
  ## Special Thanks
data/Rakefile CHANGED
@@ -3,4 +3,4 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
@@ -11,6 +11,14 @@ module SoManyDevices
11
11
  downloads.first
12
12
  end
13
13
 
14
+ def first_download
15
+ downloads.first
16
+ end
17
+
18
+ def last_download
19
+ downloads.last
20
+ end
21
+
14
22
  def download_content
15
23
  wait_for_download
16
24
  File.read(download)
@@ -1,3 +1,3 @@
1
1
  module SoManyDevices
2
- VERSION = "0.2.0"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -1,34 +1,32 @@
1
1
  require "so_many_devices/version"
2
2
  require "so_many_devices/downloads_helper"
3
- require 'yaml'
4
- require 'capybara'
3
+ require "yaml"
4
+ require "capybara"
5
5
 
6
6
  module SoManyDevices
7
7
  class Error < StandardError; end
8
8
 
9
- devices = YAML::load_file(File.join(__dir__, 'so_many_devices.yml'))
9
+ standard_args = ["--disable-site-isolation-trials", "--force-prefers-reduced-motion"]
10
+ headless_args = ["--headless", *standard_args]
11
+ headless_args << "--disable-gpu" if Gem.win_platform?
10
12
 
11
- devices.each do |device_name, options|
12
- standard_args = ['--disable-site-isolation-trials']
13
- headless_args = ['--headless', '--disable-site-isolation-trials']
14
- headless_args << '--disable-gpu' if Gem.win_platform?
13
+ devices = YAML.load_file(File.join(__dir__, "so_many_devices.yml"))
15
14
 
16
- [[device_name, standard_args], ["#{device_name}_headless", headless_args]].each do |device_name, args|
17
- Capybara.register_driver device_name.to_sym do |app|
18
- capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
19
- 'goog:chromeOptions' => { args: args, mobileEmulation: options }
20
- )
21
- Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: capabilities)
15
+ devices.each do |device_name, emulation|
16
+ [[device_name, standard_args], ["#{device_name}_headless", headless_args]].each do |driver_name, args|
17
+ Capybara.register_driver driver_name.to_sym do |app|
18
+ browser_options = ::Selenium::WebDriver::Chrome::Options.new(args: args, emulation: emulation)
19
+ Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
22
20
  end
23
21
  end
22
+ end
24
23
 
25
- [[:selenium_chrome_with_download, standard_args], [:selenium_chrome_with_download_headless, headless_args]].each do |device_name, args|
26
- Capybara.register_driver device_name do | app |
27
- browser_options = ::Selenium::WebDriver::Chrome::Options.new(args: args)
28
- browser_options.add_preference(:download, prompt_for_download: false, default_directory: SoManyDevices::DownloadsHelper::PATH.to_s)
29
- browser_options.add_preference(:browser, set_download_behavior: { behavior: 'allow' })
30
- Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
31
- end
24
+ [[:selenium_chrome_with_download, standard_args], [:selenium_chrome_with_download_headless, headless_args]].each do |driver_name, args|
25
+ Capybara.register_driver driver_name do |app|
26
+ browser_options = ::Selenium::WebDriver::Chrome::Options.new(args: args)
27
+ browser_options.add_preference(:download, prompt_for_download: false, default_directory: SoManyDevices::DownloadsHelper::PATH.to_s)
28
+ browser_options.add_preference(:browser, set_download_behavior: {behavior: "allow"})
29
+ Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
32
30
  end
33
31
  end
34
32
  end
@@ -1,29 +1,27 @@
1
- require_relative 'lib/so_many_devices/version'
1
+ require_relative "lib/so_many_devices/version"
2
2
 
3
3
  Gem::Specification.new do |spec|
4
- spec.name = "so_many_devices"
5
- spec.version = SoManyDevices::VERSION
6
- spec.authors = ["Alessandro Rodi"]
7
- spec.email = ["coorasse@gmail.com"]
4
+ spec.name = "so_many_devices"
5
+ spec.version = SoManyDevices::VERSION
6
+ spec.authors = ["Alessandro Rodi"]
7
+ spec.email = ["coorasse@gmail.com"]
8
8
 
9
- spec.summary = %q{A list of configurations for so many devices!}
10
- spec.description = %q{This incomplete but very satisfying list of devices, will help you run your app on so many devices!}
11
- spec.homepage = "https://github.com/renuo/so_many_devices"
12
- spec.license = "MIT"
13
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
9
+ spec.summary = "A list of configurations for so many devices!"
10
+ spec.description = "This incomplete but very satisfying list of devices, will help you run your app on so many devices!"
11
+ spec.homepage = "https://github.com/renuo/so_many_devices"
12
+ spec.license = "MIT"
13
+ spec.required_ruby_version = ">= 3.3.0"
14
14
 
15
- spec.metadata["homepage_uri"] = spec.homepage
16
- spec.metadata["source_code_uri"] = "https://github.com/renuo/so_many_devices"
17
- spec.metadata["changelog_uri"] = "https://github.com/renuo/so_many_devices/CHANGELOG.md"
15
+ spec.metadata["source_code_uri"] = spec.homepage
16
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
18
17
 
19
- # Specify which files should be added to the gem when it is released.
20
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
- spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.files = Dir.chdir(__dir__) do
19
+ `git ls-files -z`.split("\x0").reject do |f|
20
+ (File.expand_path(f) == __FILE__) ||
21
+ f.start_with?(*%w[bin/ spec/ logo/ .git .github .semaphore .rspec .ruby-version Gemfile])
22
+ end
23
23
  end
24
- spec.bindir = "exe"
25
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
24
  spec.require_paths = ["lib"]
27
25
 
28
- spec.add_dependency 'capybara', '>= 3.0'
26
+ spec.add_dependency "capybara", ">= 3.0"
29
27
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: so_many_devices
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Rodi
8
- autorequire:
9
- bindir: exe
8
+ bindir: bin
10
9
  cert_chain: []
11
- date: 2020-06-18 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: capybara
@@ -32,33 +31,22 @@ executables: []
32
31
  extensions: []
33
32
  extra_rdoc_files: []
34
33
  files:
35
- - ".gitignore"
36
- - ".rspec"
37
- - ".semaphore/master-deploy.yml"
38
- - ".semaphore/semaphore.yml"
39
- - ".travis.yml"
34
+ - CHANGELOG.md
40
35
  - CODE_OF_CONDUCT.md
41
- - Gemfile
42
- - Gemfile.lock
43
36
  - LICENSE.txt
44
37
  - README.md
45
38
  - Rakefile
46
- - bin/console
47
- - bin/setup
48
39
  - lib/so_many_devices.rb
49
40
  - lib/so_many_devices.yml
50
41
  - lib/so_many_devices/downloads_helper.rb
51
42
  - lib/so_many_devices/version.rb
52
- - logo/renuo.png
53
43
  - so_many_devices.gemspec
54
44
  homepage: https://github.com/renuo/so_many_devices
55
45
  licenses:
56
46
  - MIT
57
47
  metadata:
58
- homepage_uri: https://github.com/renuo/so_many_devices
59
48
  source_code_uri: https://github.com/renuo/so_many_devices
60
- changelog_uri: https://github.com/renuo/so_many_devices/CHANGELOG.md
61
- post_install_message:
49
+ changelog_uri: https://github.com/renuo/so_many_devices/blob/main/CHANGELOG.md
62
50
  rdoc_options: []
63
51
  require_paths:
64
52
  - lib
@@ -66,16 +54,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
54
  requirements:
67
55
  - - ">="
68
56
  - !ruby/object:Gem::Version
69
- version: 2.3.0
57
+ version: 3.3.0
70
58
  required_rubygems_version: !ruby/object:Gem::Requirement
71
59
  requirements:
72
60
  - - ">="
73
61
  - !ruby/object:Gem::Version
74
62
  version: '0'
75
63
  requirements: []
76
- rubyforge_project:
77
- rubygems_version: 2.7.6.2
78
- signing_key:
64
+ rubygems_version: 4.0.23
79
65
  specification_version: 4
80
66
  summary: A list of configurations for so many devices!
81
67
  test_files: []
data/.gitignore DELETED
@@ -1,11 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
@@ -1,19 +0,0 @@
1
- version: v1.0
2
- name: master-deploy
3
- agent:
4
- machine:
5
- type: e1-standard-2
6
- os_image: ubuntu1804
7
-
8
- blocks:
9
- - name: master-deploy
10
- task:
11
- secrets:
12
- - name: rubygems-deploy
13
- jobs:
14
- - name: master-deploy
15
- commands:
16
- - checkout --use-cache
17
- - gem build so_many_devices
18
- - chmod 0600 ~/.gem/credentials
19
- - gem push so_many_devices-*.gem
@@ -1,32 +0,0 @@
1
- version: "v1.0"
2
- name: so_many_devices
3
- agent:
4
- machine:
5
- type: e1-standard-2
6
- os_image: ubuntu1804
7
- auto_cancel:
8
- running:
9
- when: "true"
10
-
11
- blocks:
12
- - name: tests
13
- execution_time_limit:
14
- minutes: 10
15
- dependencies: []
16
- task:
17
- secrets:
18
- - name: so_many_devices
19
- env_vars:
20
- - name: RAILS_ENV
21
- value: test
22
- jobs:
23
- - name: tests
24
- commands:
25
- - checkout --use-cache
26
- - cache restore
27
- - bundle install -j 4 --path vendor/bundle
28
- - cache store
29
- - bundle exec rspec
30
- promotions:
31
- - name: master
32
- pipeline_file: master-deploy.yml
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.6.1
6
- before_install: gem install bundler -v 2.1.4
data/Gemfile DELETED
@@ -1,7 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in so_many_devices.gemspec
4
- gemspec
5
-
6
- gem "rake", "~> 12.0"
7
- gem "rspec", "~> 3.0"
data/Gemfile.lock DELETED
@@ -1,56 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- so_many_devices (0.2.0)
5
- capybara (>= 3.0)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- addressable (2.7.0)
11
- public_suffix (>= 2.0.2, < 5.0)
12
- capybara (3.32.1)
13
- addressable
14
- mini_mime (>= 0.1.3)
15
- nokogiri (~> 1.8)
16
- rack (>= 1.6.0)
17
- rack-test (>= 0.6.3)
18
- regexp_parser (~> 1.5)
19
- xpath (~> 3.2)
20
- diff-lcs (1.3)
21
- mini_mime (1.0.2)
22
- mini_portile2 (2.4.0)
23
- nokogiri (1.10.9)
24
- mini_portile2 (~> 2.4.0)
25
- public_suffix (4.0.4)
26
- rack (2.2.2)
27
- rack-test (1.1.0)
28
- rack (>= 1.0, < 3)
29
- rake (12.3.3)
30
- regexp_parser (1.7.0)
31
- rspec (3.9.0)
32
- rspec-core (~> 3.9.0)
33
- rspec-expectations (~> 3.9.0)
34
- rspec-mocks (~> 3.9.0)
35
- rspec-core (3.9.2)
36
- rspec-support (~> 3.9.3)
37
- rspec-expectations (3.9.2)
38
- diff-lcs (>= 1.2.0, < 2.0)
39
- rspec-support (~> 3.9.0)
40
- rspec-mocks (3.9.1)
41
- diff-lcs (>= 1.2.0, < 2.0)
42
- rspec-support (~> 3.9.0)
43
- rspec-support (3.9.3)
44
- xpath (3.2.0)
45
- nokogiri (~> 1.8)
46
-
47
- PLATFORMS
48
- ruby
49
-
50
- DEPENDENCIES
51
- rake (~> 12.0)
52
- rspec (~> 3.0)
53
- so_many_devices!
54
-
55
- BUNDLED WITH
56
- 2.1.4
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "so_many_devices"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
data/logo/renuo.png DELETED
Binary file