Skip to content

Commit

Permalink
fix dialog id ambiguity, fix tests with now moved submit button out o…
Browse files Browse the repository at this point in the history
…f original selector
  • Loading branch information
ChrisHuynh333 committed Jan 9, 2025
1 parent 5690204 commit 26efb01
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= viral_dialog(open: open, id: "file_selector_dialog", size: :large) do |dialog| %>
<%= viral_dialog(open: open, id: "file_selector_form_dialog", size: :large) do |dialog| %>
<%= dialog.with_header(title: t(".select_file")) %>
<%= dialog.with_section do %>
<% if @listing_attachments.empty? %>
Expand Down Expand Up @@ -76,8 +76,8 @@
</tr>
<% end %>
<% unless file_selector_params["required_properties"].present? && file_selector_params["required_properties"].include?(file_selector_params["property"]) %>
<tr>
<td>
<tr class="bg-white border-b dark:bg-slate-800 dark:border-slate-700">
<td class="px-3 py-3 sticky left-0 bg-white dark:bg-slate-800">
<%= form.radio_button "attachment_id",
"no_attachment",
checked: file_selector_params["selected_id"].nil?,
Expand Down
65 changes: 41 additions & 24 deletions test/system/workflow_executions/submissions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,13 @@ class SubmissionsTest < ApplicationSystemTestCase
end

# verify file selector rendered
assert_selector 'h1', text: I18n.t('workflow_executions.file_selector.file_selector_dialog.select_file')
within('#file_selector_form') do
# select new attachment
find("#attachment_id_#{@attachment_fwd2.id}").click
assert_selector '#file_selector_form_dialog'
within('#file_selector_form_dialog') do
assert_selector 'h1', text: I18n.t('workflow_executions.file_selector.file_selector_dialog.select_file')
within('#file_selector_form') do
# select new attachment
find("#attachment_id_#{@attachment_fwd2.id}").click
end
click_button I18n.t('workflow_executions.file_selector.file_selector_dialog.submit_button')
end
### ACTIONS END ###
Expand Down Expand Up @@ -429,10 +432,13 @@ class SubmissionsTest < ApplicationSystemTestCase
end

# verify file selector rendered
assert_selector 'h1', text: I18n.t('workflow_executions.file_selector.file_selector_dialog.select_file')
within('#file_selector_form') do
# select new attachment
find("#attachment_id_#{attachment_b.id}").click
assert_selector '#file_selector_form_dialog'
within('#file_selector_form_dialog') do
assert_selector 'h1', text: I18n.t('workflow_executions.file_selector.file_selector_dialog.select_file')
within('#file_selector_form') do
# select new attachment
find("#attachment_id_#{attachment_b.id}").click
end
click_button I18n.t('workflow_executions.file_selector.file_selector_dialog.submit_button')
end
### ACTIONS END ###
Expand Down Expand Up @@ -485,12 +491,15 @@ class SubmissionsTest < ApplicationSystemTestCase

### VERIFY START ###
# verify file selector rendered
assert_selector 'h1', text: I18n.t('workflow_executions.file_selector.file_selector_dialog.select_file')
within('#file_selector_form') do
# verify other attachments loaded
assert_selector "#attachment_id_#{attachment_b.id}"
# verify no file option does not exist in required field
assert_no_selector '#attachment_id_no_attachment'
assert_selector '#file_selector_form_dialog'
within('#file_selector_form_dialog') do
assert_selector 'h1', text: I18n.t('workflow_executions.file_selector.file_selector_dialog.select_file')
within('#file_selector_form') do
# verify other attachments loaded
assert_selector "#attachment_id_#{attachment_b.id}"
# verify no file option does not exist in required field
assert_no_selector '#attachment_id_no_attachment'
end
end
### VERIFY END ###
end
Expand Down Expand Up @@ -529,14 +538,17 @@ class SubmissionsTest < ApplicationSystemTestCase

### VERIFY START ###
# verify file selector rendered
assert_selector 'h1', text: I18n.t('workflow_executions.file_selector.file_selector_dialog.select_file')
within('#file_selector_form') do
# verify no file option exists in non-required field
assert_selector '#attachment_id_no_attachment'
find('#attachment_id_no_attachment').click
assert_selector '#file_selector_form_dialog'
within('#file_selector_form_dialog') do
assert_selector 'h1', text: I18n.t('workflow_executions.file_selector.file_selector_dialog.select_file')
within('#file_selector_form') do
# verify no file option exists in non-required field
assert_selector '#attachment_id_no_attachment'
find('#attachment_id_no_attachment').click
end
click_button I18n.t('workflow_executions.file_selector.file_selector_dialog.submit_button')
end
within '#dialog' do
within('#dialog') do
# sample_b fastq2 selection is now no file selected
assert_selector "div[id='#{@sample_b.id}_fastq_1']", text: @attachment_fwd3.file.filename.to_s
assert_selector "div[id='#{@sample_b.id}_fastq_2']",
Expand Down Expand Up @@ -581,10 +593,14 @@ class SubmissionsTest < ApplicationSystemTestCase

### VERIFY START ###
# verify file selector rendered
assert_selector 'h1', text: I18n.t('workflow_executions.file_selector.file_selector_dialog.select_file')
assert_no_selector '#file_selector_form'
assert_text I18n.t('workflow_executions.file_selector.file_selector_dialog.empty.title')
assert_text I18n.t('workflow_executions.file_selector.file_selector_dialog.empty.description')
assert_selector '#file_selector_form_dialog'
within('#file_selector_form_dialog') do
assert_selector 'h1', text: I18n.t('workflow_executions.file_selector.file_selector_dialog.select_file')
# verify empty state
assert_no_selector '#file_selector_form'
assert_text I18n.t('workflow_executions.file_selector.file_selector_dialog.empty.title')
assert_text I18n.t('workflow_executions.file_selector.file_selector_dialog.empty.description')
end
### VERIFY END ###
end

Expand All @@ -606,6 +622,7 @@ class SubmissionsTest < ApplicationSystemTestCase
# launch workflow execution dialog
click_on I18n.t(:'projects.samples.index.workflows.button_sr')

assert_selector '#dialog'
within %(turbo-frame[id="samples_dialog"]) do
assert_selector '.dialog--header', text: I18n.t(:'workflow_executions.submissions.pipeline_selection.title')
assert_button text: 'phac-nml/iridanextexample', count: 3
Expand Down

0 comments on commit 26efb01

Please sign in to comment.