selenium_download_helper 1.0.0 → 1.1.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: 85e717fb652e52a196fe55a4cc971559ea40ca19520697224a61954314a2ccd6
4
- data.tar.gz: 751c36041230552bc4c8e0a0ef461319be336a561fd91d5530c4054c2afed474
3
+ metadata.gz: aa84829d0e2102bcba993d16dfad54b041afb314f99a271e8f2575398d1ad413
4
+ data.tar.gz: e4512c0f922cec27f3bfa779d8531a6cebdb95f1132caa5b74cce96891692ff6
5
5
  SHA512:
6
- metadata.gz: 0ee99f51e617dd311131a3fb5a23d1d05418aaeea6739ac99570c722a9d1de8f850b5dae188f2425bf459300c0a641a384dc184f0cf3a00962e6a804ccc6d8a4
7
- data.tar.gz: 47f6086b1363285424b4951c88ee1995b971c511f7fa942706271aa53bc66e8499cae5bf231f848b4d17d78d2acaf9f3d7be80268bb17ab3878d0c60a1987239
6
+ metadata.gz: 97a0da523c03be13c9fba644030934346382c2cbc78b7f927a14a2e359076188301249ef8589659faec89b7d4e54dbdc21cc70947a387ef8ad029031c8dd852e
7
+ data.tar.gz: 6e3cd2dc07cfcc004803e3b08332321b0a064fdf648ec9e955f6c98e77f12c35604c936f29036f55e6cd51747c6da490ace90a9e2ef1c04556fa43e866e9ab45
data/Gemfile.lock CHANGED
@@ -1,91 +1,87 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- selenium_download_helper (1.0.0)
4
+ selenium_download_helper (1.1.0)
5
5
  rails (>= 7.0)
6
6
  selenium-webdriver
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (7.1.3.4)
12
- actionpack (= 7.1.3.4)
13
- activesupport (= 7.1.3.4)
11
+ actioncable (7.2.1)
12
+ actionpack (= 7.2.1)
13
+ activesupport (= 7.2.1)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
16
  zeitwerk (~> 2.6)
17
- actionmailbox (7.1.3.4)
18
- actionpack (= 7.1.3.4)
19
- activejob (= 7.1.3.4)
20
- activerecord (= 7.1.3.4)
21
- activestorage (= 7.1.3.4)
22
- activesupport (= 7.1.3.4)
23
- mail (>= 2.7.1)
24
- net-imap
25
- net-pop
26
- net-smtp
27
- actionmailer (7.1.3.4)
28
- actionpack (= 7.1.3.4)
29
- actionview (= 7.1.3.4)
30
- activejob (= 7.1.3.4)
31
- activesupport (= 7.1.3.4)
32
- mail (~> 2.5, >= 2.5.4)
33
- net-imap
34
- net-pop
35
- net-smtp
17
+ actionmailbox (7.2.1)
18
+ actionpack (= 7.2.1)
19
+ activejob (= 7.2.1)
20
+ activerecord (= 7.2.1)
21
+ activestorage (= 7.2.1)
22
+ activesupport (= 7.2.1)
23
+ mail (>= 2.8.0)
24
+ actionmailer (7.2.1)
25
+ actionpack (= 7.2.1)
26
+ actionview (= 7.2.1)
27
+ activejob (= 7.2.1)
28
+ activesupport (= 7.2.1)
29
+ mail (>= 2.8.0)
36
30
  rails-dom-testing (~> 2.2)
37
- actionpack (7.1.3.4)
38
- actionview (= 7.1.3.4)
39
- activesupport (= 7.1.3.4)
31
+ actionpack (7.2.1)
32
+ actionview (= 7.2.1)
33
+ activesupport (= 7.2.1)
40
34
  nokogiri (>= 1.8.5)
41
35
  racc
42
- rack (>= 2.2.4)
36
+ rack (>= 2.2.4, < 3.2)
43
37
  rack-session (>= 1.0.1)
44
38
  rack-test (>= 0.6.3)
45
39
  rails-dom-testing (~> 2.2)
46
40
  rails-html-sanitizer (~> 1.6)
47
- actiontext (7.1.3.4)
48
- actionpack (= 7.1.3.4)
49
- activerecord (= 7.1.3.4)
50
- activestorage (= 7.1.3.4)
51
- activesupport (= 7.1.3.4)
41
+ useragent (~> 0.16)
42
+ actiontext (7.2.1)
43
+ actionpack (= 7.2.1)
44
+ activerecord (= 7.2.1)
45
+ activestorage (= 7.2.1)
46
+ activesupport (= 7.2.1)
52
47
  globalid (>= 0.6.0)
53
48
  nokogiri (>= 1.8.5)
54
- actionview (7.1.3.4)
55
- activesupport (= 7.1.3.4)
49
+ actionview (7.2.1)
50
+ activesupport (= 7.2.1)
56
51
  builder (~> 3.1)
57
52
  erubi (~> 1.11)
58
53
  rails-dom-testing (~> 2.2)
59
54
  rails-html-sanitizer (~> 1.6)
60
- activejob (7.1.3.4)
61
- activesupport (= 7.1.3.4)
55
+ activejob (7.2.1)
56
+ activesupport (= 7.2.1)
62
57
  globalid (>= 0.3.6)
63
- activemodel (7.1.3.4)
64
- activesupport (= 7.1.3.4)
65
- activerecord (7.1.3.4)
66
- activemodel (= 7.1.3.4)
67
- activesupport (= 7.1.3.4)
58
+ activemodel (7.2.1)
59
+ activesupport (= 7.2.1)
60
+ activerecord (7.2.1)
61
+ activemodel (= 7.2.1)
62
+ activesupport (= 7.2.1)
68
63
  timeout (>= 0.4.0)
69
- activestorage (7.1.3.4)
70
- actionpack (= 7.1.3.4)
71
- activejob (= 7.1.3.4)
72
- activerecord (= 7.1.3.4)
73
- activesupport (= 7.1.3.4)
64
+ activestorage (7.2.1)
65
+ actionpack (= 7.2.1)
66
+ activejob (= 7.2.1)
67
+ activerecord (= 7.2.1)
68
+ activesupport (= 7.2.1)
74
69
  marcel (~> 1.0)
75
- activesupport (7.1.3.4)
70
+ activesupport (7.2.1)
76
71
  base64
77
72
  bigdecimal
78
- concurrent-ruby (~> 1.0, >= 1.0.2)
73
+ concurrent-ruby (~> 1.0, >= 1.3.1)
79
74
  connection_pool (>= 2.2.5)
80
75
  drb
81
76
  i18n (>= 1.6, < 2)
77
+ logger (>= 1.4.2)
82
78
  minitest (>= 5.1)
83
- mutex_m
84
- tzinfo (~> 2.0)
79
+ securerandom (>= 0.3)
80
+ tzinfo (~> 2.0, >= 2.0.5)
85
81
  base64 (0.2.0)
86
82
  bigdecimal (3.1.8)
87
83
  builder (3.3.0)
88
- concurrent-ruby (1.3.3)
84
+ concurrent-ruby (1.3.4)
89
85
  connection_pool (2.4.1)
90
86
  crass (1.0.6)
91
87
  date (3.3.4)
@@ -112,8 +108,7 @@ GEM
112
108
  marcel (1.0.4)
113
109
  mini_mime (1.1.5)
114
110
  mini_portile2 (2.8.7)
115
- minitest (5.24.1)
116
- mutex_m (0.2.0)
111
+ minitest (5.25.1)
117
112
  net-imap (0.4.14)
118
113
  date
119
114
  net-protocol
@@ -124,16 +119,16 @@ GEM
124
119
  net-smtp (0.5.0)
125
120
  net-protocol
126
121
  nio4r (2.7.3)
127
- nokogiri (1.16.6)
122
+ nokogiri (1.16.7)
128
123
  mini_portile2 (~> 2.8.2)
129
124
  racc (~> 1.4)
130
- nokogiri (1.16.6-arm64-darwin)
125
+ nokogiri (1.16.7-arm64-darwin)
131
126
  racc (~> 1.4)
132
- nokogiri (1.16.6-x86_64-darwin)
127
+ nokogiri (1.16.7-x86_64-darwin)
133
128
  racc (~> 1.4)
134
129
  psych (5.1.2)
135
130
  stringio
136
- racc (1.8.0)
131
+ racc (1.8.1)
137
132
  rack (3.1.7)
138
133
  rack-session (2.0.0)
139
134
  rack (>= 3.0.0)
@@ -142,20 +137,20 @@ GEM
142
137
  rackup (2.1.0)
143
138
  rack (>= 3)
144
139
  webrick (~> 1.8)
145
- rails (7.1.3.4)
146
- actioncable (= 7.1.3.4)
147
- actionmailbox (= 7.1.3.4)
148
- actionmailer (= 7.1.3.4)
149
- actionpack (= 7.1.3.4)
150
- actiontext (= 7.1.3.4)
151
- actionview (= 7.1.3.4)
152
- activejob (= 7.1.3.4)
153
- activemodel (= 7.1.3.4)
154
- activerecord (= 7.1.3.4)
155
- activestorage (= 7.1.3.4)
156
- activesupport (= 7.1.3.4)
140
+ rails (7.2.1)
141
+ actioncable (= 7.2.1)
142
+ actionmailbox (= 7.2.1)
143
+ actionmailer (= 7.2.1)
144
+ actionpack (= 7.2.1)
145
+ actiontext (= 7.2.1)
146
+ actionview (= 7.2.1)
147
+ activejob (= 7.2.1)
148
+ activemodel (= 7.2.1)
149
+ activerecord (= 7.2.1)
150
+ activestorage (= 7.2.1)
151
+ activesupport (= 7.2.1)
157
152
  bundler (>= 1.15.0)
158
- railties (= 7.1.3.4)
153
+ railties (= 7.2.1)
159
154
  rails-dom-testing (2.2.0)
160
155
  activesupport (>= 5.0.0)
161
156
  minitest
@@ -163,10 +158,10 @@ GEM
163
158
  rails-html-sanitizer (1.6.0)
164
159
  loofah (~> 2.21)
165
160
  nokogiri (~> 1.14)
166
- railties (7.1.3.4)
167
- actionpack (= 7.1.3.4)
168
- activesupport (= 7.1.3.4)
169
- irb
161
+ railties (7.2.1)
162
+ actionpack (= 7.2.1)
163
+ activesupport (= 7.2.1)
164
+ irb (~> 1.13)
170
165
  rackup (>= 1.0.0)
171
166
  rake (>= 12.2)
172
167
  thor (~> 1.0, >= 1.2.2)
@@ -176,7 +171,7 @@ GEM
176
171
  psych (>= 4.0.0)
177
172
  reline (0.5.9)
178
173
  io-console (~> 0.5)
179
- rexml (3.3.2)
174
+ rexml (3.3.6)
180
175
  strscan
181
176
  rspec (3.10.0)
182
177
  rspec-core (~> 3.10.0)
@@ -192,6 +187,7 @@ GEM
192
187
  rspec-support (~> 3.10.0)
193
188
  rspec-support (3.10.2)
194
189
  rubyzip (2.3.2)
190
+ securerandom (0.3.1)
195
191
  selenium-webdriver (4.23.0)
196
192
  base64 (~> 0.2)
197
193
  logger (~> 1.4)
@@ -204,12 +200,13 @@ GEM
204
200
  timeout (0.4.1)
205
201
  tzinfo (2.0.6)
206
202
  concurrent-ruby (~> 1.0)
203
+ useragent (0.16.10)
207
204
  webrick (1.8.1)
208
205
  websocket (1.2.11)
209
206
  websocket-driver (0.7.6)
210
207
  websocket-extensions (>= 0.1.0)
211
208
  websocket-extensions (0.1.5)
212
- zeitwerk (2.6.16)
209
+ zeitwerk (2.6.17)
213
210
 
214
211
  PLATFORMS
215
212
  arm64-darwin-22
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SeleniumDownloadHelper
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
@@ -15,12 +15,12 @@ module SeleniumDownloadHelper
15
15
  end
16
16
  end
17
17
 
18
- def wait_for_downloaded(timeout: 10, interval: 0.2, all: false, &block)
18
+ def wait_for_downloaded(timeout: 10, interval: 0.2, all: false, filename: nil, &block)
19
19
  download_path= mkdownloaddir
20
20
  page.driver.browser.download_path = download_path
21
21
  yield
22
- Selenium::WebDriver::Wait.new(timeout: timeout, interval: interval).until { downloaded?(download_path) }
23
- downloaded_files(download_path).then { |files| all ? files : files.first }
22
+ Selenium::WebDriver::Wait.new(timeout: timeout, interval: interval).until { downloaded?(download_path, filename:) }
23
+ downloaded_files(download_path, filename:).then { |files| all ? files : files.first }
24
24
  end
25
25
 
26
26
  private
@@ -34,12 +34,14 @@ module SeleniumDownloadHelper
34
34
  Dir.mktmpdir('selenium_download_helper__', base_download_dir)
35
35
  end
36
36
 
37
- def downloaded_files(download_path)
38
- Dir[File.join(download_path, '*')].map { |filepath| Pathname.new(filepath) }
37
+ def downloaded_files(download_path, filename: nil)
38
+ Dir[File.join(download_path, '*')]
39
+ .map { |filepath| Pathname.new(filepath) }
40
+ .select { |file| filename.nil? || filename === file.basename.to_s }
39
41
  end
40
42
 
41
- def downloaded?(download_path)
42
- files = downloaded_files(download_path)
43
+ def downloaded?(download_path, filename: nil)
44
+ files = downloaded_files(download_path, filename:)
43
45
  files.map(&:to_s).grep(/\.crdownload$/).none? && files.any?
44
46
  end
45
47
  end
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = spec.homepage
19
- spec.metadata["changelog_uri"] = "https://github.com/SonicGarden/selenium_download_helper/blob/master/CHANGELOG.md"
19
+ spec.metadata["changelog_uri"] = "https://github.com/SonicGarden/selenium_download_helper/releases"
20
20
 
21
21
  # Specify which files should be added to the gem when it is released.
22
22
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selenium_download_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aki77
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-26 00:00:00.000000000 Z
11
+ date: 2024-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -66,7 +66,7 @@ licenses:
66
66
  metadata:
67
67
  homepage_uri: https://github.com/SonicGarden/selenium_download_helper
68
68
  source_code_uri: https://github.com/SonicGarden/selenium_download_helper
69
- changelog_uri: https://github.com/SonicGarden/selenium_download_helper/blob/master/CHANGELOG.md
69
+ changelog_uri: https://github.com/SonicGarden/selenium_download_helper/releases
70
70
  post_install_message:
71
71
  rdoc_options: []
72
72
  require_paths: