diff --git a/test/system/projects/workflow_executions_test.rb b/test/system/projects/workflow_executions_test.rb index f34a19a987..9de91bbaea 100644 --- a/test/system/projects/workflow_executions_test.rb +++ b/test/system/projects/workflow_executions_test.rb @@ -89,6 +89,35 @@ class WorkflowExecutionsTest < ApplicationSystemTestCase end end + test 'should include workflows that have been shared to the project' do + workflow_execution1 = workflow_executions(:workflow_execution_shared1) + workflow_execution2 = workflow_executions(:workflow_execution_shared2) + + visit namespace_project_workflow_executions_path(@namespace, @project) + + assert_selector 'h1', text: I18n.t(:'projects.workflow_executions.index.title') + + tr = find('a', text: workflow_execution1.id).ancestor('tr') + within tr do + assert_no_link 'Cancel' + assert_no_link 'Destroy' + end + + tr = find('a', text: workflow_execution2.id).ancestor('tr') + within tr do + assert_no_link 'Cancel' + assert_no_link 'Destroy' + end + end + + test 'should not include shared workflows that were not shared to that specific project' do + workflow_execution = workflow_executions(:workflow_execution_shared3) + + visit namespace_project_workflow_executions_path(@namespace, @project) + + assert_no_selector 'a', text: workflow_execution.id + end + test 'should be able to cancel a workflow' do workflow_execution = workflow_executions(:automated_example_prepared) @@ -408,5 +437,21 @@ class WorkflowExecutionsTest < ApplicationSystemTestCase assert_selector 'dd', text: new_we_name ### VERIFY END ### end + + test 'can view a shared workflow execution that was shared by a different user' do + workflow_execution = workflow_executions(:workflow_execution_shared2) + + visit namespace_project_workflow_execution_path(@namespace, @project, workflow_execution) + + assert_text workflow_execution.id + assert_text I18n.t(:"workflow_executions.state.#{workflow_execution.state}") + assert_text workflow_execution.metadata['workflow_name'] + assert_text workflow_execution.metadata['workflow_version'] + + assert_link I18n.t(:'workflow_executions.show.create_export_button') + assert_no_link I18n.t(:'workflow_executions.show.cancel_button') + assert_no_link I18n.t(:'workflow_executions.show.edit_button') + assert_no_link I18n.t(:'workflow_executions.show.remove_button') + end end end diff --git a/test/system/workflow_executions_test.rb b/test/system/workflow_executions_test.rb index e4ebccb584..e5243a2dba 100644 --- a/test/system/workflow_executions_test.rb +++ b/test/system/workflow_executions_test.rb @@ -111,6 +111,28 @@ class WorkflowExecutionsTest < ApplicationSystemTestCase end end + test 'should include a shared workflow in the list of workflow executions when the submitter is the current user' do + workflow_execution = workflow_executions(:workflow_execution_shared1) + + visit workflow_executions_path + + assert_selector 'h1', text: I18n.t(:'workflow_executions.index.title') + + tr = find('a', text: workflow_execution.id).ancestor('tr') + + within tr do + assert_link 'Cancel' + end + end + + test 'should not include a shared workflow in the workflow executions when the submitter is not the current user' do + workflow_execution = workflow_executions(:workflow_execution_shared2) + + visit workflow_executions_path + + assert_no_selector 'a', text: workflow_execution.id + end + test 'should be able to cancel a workflow' do workflow_execution = workflow_executions(:irida_next_example_prepared) @@ -457,4 +479,20 @@ class WorkflowExecutionsTest < ApplicationSystemTestCase assert_selector 'dd', text: new_we_name ### VERIFY END ### end + + test 'can view a shared workflow execution that the current user submitted' do + workflow_execution = workflow_executions(:workflow_execution_shared1) + + visit workflow_execution_path(workflow_execution) + + assert_text workflow_execution.id + assert_text I18n.t(:"workflow_executions.state.#{workflow_execution.state}") + assert_text workflow_execution.metadata['workflow_name'] + assert_text workflow_execution.metadata['workflow_version'] + + assert_link I18n.t(:'workflow_executions.show.create_export_button') + assert_link I18n.t(:'workflow_executions.show.cancel_button') + assert_link I18n.t(:'workflow_executions.show.edit_button') + assert_no_link I18n.t(:'workflow_executions.show.remove_button') + end end