Skip to content

Commit

Permalink
Add UI tests to ensure shared workflows are displayed properly
Browse files Browse the repository at this point in the history
  • Loading branch information
malchua committed Jan 28, 2025
1 parent 4e3724f commit d639df0
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
45 changes: 45 additions & 0 deletions test/system/projects/workflow_executions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
38 changes: 38 additions & 0 deletions test/system/workflow_executions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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

0 comments on commit d639df0

Please sign in to comment.