Commit 781c01d1 authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

Merge branch 'hotfix-s/4229-required-file' into 'dev'

Issue with file uploading

Closes #4229

See merge request !646
parents f98ac893 57e67a96
Pipeline #135328 passed with stages
in 7 minutes and 22 seconds
......@@ -351,7 +351,7 @@ FileFormBuilder.prototype.build_file_field = function(id, hidden) {
var i = this.build_input('upload_' + id, 'upload_field', 'file'+id, 'file', 'file');
if (this.source) {
i.disabled = true;
} else {
} else if (! hidden) {
i.required = true;
}
i.title = "(.fa, .fastq, .fa.gz, .fastq.gz, .clntab)";
......
......@@ -119,6 +119,50 @@ class TestSample < ServerTest
assert (results_cell.text.include? "default + extract reads"), "Results cell contains "+results_cell.text
end
def test_add_with_pre_process
# Add with a pre-process and check that some fields are required
table = go_to_set_by_tag "#test1"
count = table.tbody.rows.count
add_button = $b.span(:text => "+ add samples")
add_button.wait_until(&:present?)
add_button.click
form = $b.form(:id => "upload_form")
form.wait_until(&:present?)
$b.input(:id => "source_computer").click
$b.select(:id => "pre_process").select(/test pre-process 0/)
form = $b.form(:id => "upload_form")
form.wait_until(&:present?)
# Adding another sample
$b.span(:id => "file_button").click
form.file_field(:id => 'file_upload_1_0').set(File.expand_path(__FILE__))
form.file_field(:id => 'file_upload_1_1').set(File.expand_path(__FILE__))
form.input(:type => "submit").click
# Form should not be submitted because we didn't fill all fields
assert ($b.form(:id => "upload_form").present?)
form.file_field(:id => 'file_upload_2_0').set(File.expand_path(__FILE__))
form.input(:type => "submit").click
# Form should not be submitted because we didn't fill all fields
assert ($b.form(:id => "upload_form").present?)
form.file_field(:id => 'file_upload_2_1').set(File.expand_path(__FILE__))
form.input(:type => "submit").click
table = $b.table(:id => "table")
table.wait_until(&:present?)
lines = table.tbody.rows
assert(lines.count == count + 2)
end
def test_edit
table = go_to_set_by_tag "#test3"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment