- within('.finished-processes') do
- assert_text 'zzzzz-d1hrv-twodonepipeline'
- assert_text 'zzzzz-dz642-compltcontainer'
- assert_text 'zzzzz-dz642-compltcontainr2'
- assert_no_text 'zzzzz-d1hrv-partdonepipelin'
- assert_no_text 'zzzzz-dz642-runningcontainr'
+ end
+
+ [
+ ['jobs', 'running_job_with_components', true],
+ ['pipeline_instances', 'components_is_jobspec', false],
+ ['containers', 'running', false],
+ ['container_requests', 'running', true],
+ ].each do |type, fixture, cancelable|
+ test "cancel button for #{type}/#{fixture}" do
+ if cancelable
+ need_selenium 'to cancel'
+ end
+
+ obj = api_fixture(type)[fixture]
+ visit page_with_token "active", "/#{type}/#{obj['uuid']}"
+
+ assert_text 'created_at'
+ if cancelable
+ assert page.has_button?('Cancel'), 'No Cancel button'
+ click_button 'Cancel'
+ wait_for_ajax
+ assert page.has_no_button?('Cancel'), 'Cancel button not expected after clicking'
+ else
+ assert page.has_no_button?('Cancel'), 'Cancel button not expected'
+ end