so_many_devices 0.2.0 → 1.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
  SHA256:
3
- metadata.gz: 0c89db46b332aab888e79736d583df4b7897354fa0d5eb7d400ed9518e3ea5c9
4
- data.tar.gz: dd7d100ca70832f4cd6fdba1ba3c090893a08de58c7a259b08ac3636ff4bf7ab
3
+ metadata.gz: 2083f8748f8786c8ec499d5f9a67b6d97d5fc5080c3c7bfb82ee2217bb9ae515
4
+ data.tar.gz: '09eb90cbaac0a1ae8d4f2c4dac0dc5e96306bd03bea6d2f6dd8b24fc0b475f7f'
5
5
  SHA512:
6
- metadata.gz: f819f293cf1f3548930378db087c0329a1d93136e29ae62213a970217622e65be0bc56fe73bf075786fea0dfdea6a9e376a5ee0c4e08cb67b8d8e0cce33c1318
7
- data.tar.gz: d4ade32037dbda8691bcf4a60d93d3088cc5337994dfa1c1d63589aaa4263689e1b2d693864a93db198c55458ac3b447d3265726ad4c33bc9c8c47f96d9144cc
6
+ metadata.gz: ef4f46954c438c4be338b370918fed154e2f9dde3d51e765d40ec5ed489c63c827af69f3eb3c432f003deb028dcd58b117ba57fc7d9754599d10e2dbc3e4622b
7
+ data.tar.gz: 2b2509f8b113fea58f28010997f90f58d7d73f365e49b45db826a3dc0a80e5261b04fd1ee5729410cf0c9532ee9ae4d3ab4f04f1e7af80a57e999b7e53950e23
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ Gemfile.lock
@@ -1,17 +1,17 @@
1
1
  version: v1.0
2
- name: master-deploy
2
+ name: main-deploy
3
3
  agent:
4
4
  machine:
5
5
  type: e1-standard-2
6
6
  os_image: ubuntu1804
7
7
 
8
8
  blocks:
9
- - name: master-deploy
9
+ - name: main-deploy
10
10
  task:
11
11
  secrets:
12
12
  - name: rubygems-deploy
13
13
  jobs:
14
- - name: master-deploy
14
+ - name: main-deploy
15
15
  commands:
16
16
  - checkout --use-cache
17
17
  - gem build so_many_devices
@@ -14,8 +14,6 @@ blocks:
14
14
  minutes: 10
15
15
  dependencies: []
16
16
  task:
17
- secrets:
18
- - name: so_many_devices
19
17
  env_vars:
20
18
  - name: RAILS_ENV
21
19
  value: test
@@ -26,7 +24,8 @@ blocks:
26
24
  - cache restore
27
25
  - bundle install -j 4 --path vendor/bundle
28
26
  - cache store
27
+ - bundle exec standardrb
29
28
  - bundle exec rspec
30
29
  promotions:
31
- - name: master
32
- pipeline_file: master-deploy.yml
30
+ - name: main
31
+ pipeline_file: main-deploy.yml
data/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ ## [0.3.0] - 2023-01-25
2
+
3
+ - Added two new methods `first_download` and `last_download`.
4
+ - Added more instructions to the README for Chrome with downloads options, in particular to clean up folders.
5
+ - Added an example to read a downloaded file
6
+
7
+ ## [0.2.0] - 2020-06-18
8
+
9
+ - Add chrome with downloads capabilities to the list of already so many devices
10
+
11
+ ## [0.1.0] - 2020-03-02
12
+
13
+ - Initial release
data/README.md CHANGED
@@ -76,6 +76,10 @@ config.before(:each, type: :system, js: true) do
76
76
  driven_by :selenium_chrome_with_download_headless # or non-headless version
77
77
  end
78
78
 
79
+ config.after(:each, type: :system, js: true) do
80
+ clear_downloads
81
+ end
82
+
79
83
  config.include SoManyDevices::DownloadsHelper, type: :system
80
84
  ```
81
85
 
@@ -87,10 +91,34 @@ it 'can download a file', :js do
87
91
  click_link 'Download PDF'
88
92
  wait_for_download
89
93
  expect(downloads.length).to eq(1)
90
- expect(download).to match(/.*\.pdf/)
94
+ expect(last_download).to match(/.*\.pdf/)
95
+ last_pdf = File.read(last_download)
96
+ end
97
+ ```
98
+
99
+ If you prefer to use this driver only on selected tests, you can use the following:
100
+
101
+ ```ruby
102
+ config.before(:each, type: :system, js: true, with_downloads: true) do
103
+ driven_by :selenium_chrome_with_download_headless
104
+ end
105
+
106
+ config.after(:each, type: :system, js: true, with_downloads: true) do
107
+ clear_downloads
108
+ end
109
+
110
+ config.include SoManyDevices::DownloadsHelper, type: :system
111
+ ```
112
+
113
+ and in your test (just an example...):
114
+
115
+ ```ruby
116
+ it 'can download a file', :js, :with_downloads do
91
117
  end
92
118
  ```
93
119
 
120
+ The call to `clear_downloads` makes sure that all the downloads are removed from the downloads folder.
121
+ All downloads are performed in the `tmp/downloads` folder of your project.
94
122
 
95
123
  ## Development
96
124
 
@@ -104,7 +132,7 @@ which will create a git tag for the version, push git commits and tags, and push
104
132
  ## Contributing
105
133
 
106
134
  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).
135
+ 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
136
 
109
137
  Do you think our devices are not that many? 😡
110
138
 
@@ -116,7 +144,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
116
144
 
117
145
  ## Code of Conduct
118
146
 
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).
147
+ 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
148
 
121
149
 
122
150
  ## 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 = "1.0.0"
3
3
  end
@@ -1,32 +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
+ devices = YAML.load_file(File.join(__dir__, "so_many_devices.yml"))
10
10
 
11
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?
12
+ standard_args = ["--disable-site-isolation-trials"]
13
+ headless_args = ["--headless", "--disable-site-isolation-trials"]
14
+ headless_args << "--disable-gpu" if Gem.win_platform?
15
15
 
16
16
  [[device_name, standard_args], ["#{device_name}_headless", headless_args]].each do |device_name, args|
17
17
  Capybara.register_driver device_name.to_sym do |app|
18
18
  capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
19
- 'goog:chromeOptions' => { args: args, mobileEmulation: options }
19
+ "goog:chromeOptions" => {args: args, mobileEmulation: options}
20
20
  )
21
21
  Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: capabilities)
22
22
  end
23
23
  end
24
24
 
25
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 |
26
+ Capybara.register_driver device_name do |app|
27
27
  browser_options = ::Selenium::WebDriver::Chrome::Options.new(args: args)
28
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' })
29
+ browser_options.add_preference(:browser, set_download_behavior: {behavior: "allow"})
30
30
  Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
31
31
  end
32
32
  end
@@ -1,29 +1,30 @@
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"
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
13
  spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
14
14
 
15
15
  spec.metadata["homepage_uri"] = spec.homepage
16
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"
17
+ spec.metadata["changelog_uri"] = "https://github.com/renuo/so_many_devices/blob/main/CHANGELOG.md"
18
18
 
19
19
  # Specify which files should be added to the gem when it is released.
20
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
21
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
22
22
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
23
  end
24
- spec.bindir = "exe"
25
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.bindir = "exe"
25
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
26
  spec.require_paths = ["lib"]
27
27
 
28
- spec.add_dependency 'capybara', '>= 3.0'
28
+ spec.add_dependency "capybara", ">= 3.0"
29
+ spec.add_development_dependency "standard"
29
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Rodi
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-18 00:00:00.000000000 Z
11
+ date: 2023-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: standard
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description: This incomplete but very satisfying list of devices, will help you run
28
42
  your app on so many devices!
29
43
  email:
@@ -34,12 +48,12 @@ extra_rdoc_files: []
34
48
  files:
35
49
  - ".gitignore"
36
50
  - ".rspec"
37
- - ".semaphore/master-deploy.yml"
51
+ - ".semaphore/main-deploy.yml"
38
52
  - ".semaphore/semaphore.yml"
39
53
  - ".travis.yml"
54
+ - CHANGELOG.md
40
55
  - CODE_OF_CONDUCT.md
41
56
  - Gemfile
42
- - Gemfile.lock
43
57
  - LICENSE.txt
44
58
  - README.md
45
59
  - Rakefile
@@ -57,8 +71,8 @@ licenses:
57
71
  metadata:
58
72
  homepage_uri: https://github.com/renuo/so_many_devices
59
73
  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:
74
+ changelog_uri: https://github.com/renuo/so_many_devices/blob/main/CHANGELOG.md
75
+ post_install_message:
62
76
  rdoc_options: []
63
77
  require_paths:
64
78
  - lib
@@ -73,9 +87,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
87
  - !ruby/object:Gem::Version
74
88
  version: '0'
75
89
  requirements: []
76
- rubyforge_project:
77
- rubygems_version: 2.7.6.2
78
- signing_key:
90
+ rubygems_version: 3.3.10
91
+ signing_key:
79
92
  specification_version: 4
80
93
  summary: A list of configurations for so many devices!
81
94
  test_files: []
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