effective_test_bot 0.4.15 → 0.4.16
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 124e24f5a23f78013a2895ed9b1cb6c84553f50c
|
4
|
+
data.tar.gz: bf2e35d6c19792b9fd322c870d6dd65260a86f48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe29d076bafcb5ab447e37f7a4f69e5417e3169eec65a6c446019e5cb92428e385ac7fb4cb1ad530eaba669bb52d06fdef167ab44bada016fae093c0d57bf02e
|
7
|
+
data.tar.gz: 5a703c21aa3183e2c3fdc1c4429810ea052947696ab0078b591181392c526e2f5e88389db9c532dbab20a88f9f9c0b3eaf3c9573c6b65eace9c2e6938219294b
|
@@ -291,32 +291,13 @@ module EffectiveTestBotFormFiller
|
|
291
291
|
|
292
292
|
# The field here is going to be the %input{:type => file}. Files can be one or more pathnames
|
293
293
|
# http://stackoverflow.com/questions/5188240/using-selenium-to-imitate-dragging-a-file-onto-an-upload-element/11203629#11203629
|
294
|
-
def upload_effective_asset(field,
|
295
|
-
files = Array(files)
|
294
|
+
def upload_effective_asset(field, file)
|
296
295
|
uid = field['id']
|
297
|
-
|
298
|
-
js = "fileList = Array();"
|
299
|
-
|
300
|
-
files.each_with_index do |file, i|
|
301
|
-
# Generate a fake input selector
|
302
|
-
page.execute_script("if($('#effectiveAssetsPlaceholder#{i}').length == 0) {effectiveAssetsPlaceholder#{i} = window.$('<input/>').attr({id: 'effectiveAssetsPlaceholder#{i}', type: 'file'}).appendTo('body'); }")
|
303
|
-
|
304
|
-
# Attach file to the fake input selector through Capybara
|
305
|
-
page.document.attach_file("effectiveAssetsPlaceholder#{i}", files[i])
|
306
|
-
|
307
|
-
# Build up the fake js event
|
308
|
-
js = "#{js} fileList.push(effectiveAssetsPlaceholder#{i}.get(0).files[0]);"
|
309
|
-
end
|
310
|
-
|
311
|
-
# Trigger the fake drop event
|
312
|
-
page.execute_script("#{js} e = $.Event('drop'); e.originalEvent = {dataTransfer : { files : fileList } }; $('#s3_#{uid}').trigger(e);")
|
313
|
-
|
314
|
-
# Remove the file inputs we created
|
315
|
-
page.execute_script("$('input[id^=effectiveAssetsPlaceholder]').remove();")
|
296
|
+
field.set(file)
|
316
297
|
|
317
298
|
# Wait till the Uploader bar goes away
|
318
299
|
begin
|
319
|
-
Timeout.timeout(
|
300
|
+
Timeout.timeout(5) do
|
320
301
|
within("#asset-box-input-#{uid}") do
|
321
302
|
within('.uploads') do
|
322
303
|
while (first('.upload').present? rescue false) do
|
@@ -327,7 +308,7 @@ module EffectiveTestBotFormFiller
|
|
327
308
|
end
|
328
309
|
end
|
329
310
|
rescue Timeout::Error
|
330
|
-
puts "file upload timed out after
|
311
|
+
puts "file upload timed out after 5s"
|
331
312
|
end
|
332
313
|
end
|
333
314
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_test_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|