Adds tests
This commit is contained in:
Filipa Lacerda 2017-04-04 09:14:46 +01:00
parent 3db1b959f6
commit d037a2e998
6 changed files with 47 additions and 4 deletions

View file

@ -69,7 +69,7 @@ export default {
type="button"
@click="onClickAction(action.play_path)"
class="js-manual-action-link no-btn btn"
:class="{ 'disabled': !actions.playable }"
:class="{ 'disabled': !action.playable }"
:disabled="!action.playable">
${playIconSvg}
<span>

View file

@ -49,7 +49,7 @@ export default {
data-toggle="dropdown"
data-placement="top"
aria-label="Manual job"
:disabled="isDisabled">
:disabled="isLoading">
${playIconSvg}
<i class="fa fa-caret-down" aria-hidden="true"></i>
<i v-if="isLoading" class="fa fa-spinner fa-spin" aria-hidden="true"></i>
@ -60,9 +60,9 @@ export default {
<button
type="button"
class="js-pipeline-action-link no-btn btn"
:class="{ 'disabled': !actions.playable }"
:class="{ 'disabled': !action.playable }"
@click="onClickAction(action.path)"
:disabled="!actions.playable">
:disabled="!action.playable">
${playIconSvg}
<span>{{action.name}}</span>
</button>

View file

@ -192,5 +192,10 @@ FactoryGirl.define do
trait :no_options do
options { {} }
end
trait :non_playable do
status 'created'
self.when 'manual'
end
end
end

View file

@ -32,5 +32,10 @@ FactoryGirl.define do
environment.update_attribute(:deployments, [deployment])
end
end
trait :non_playable do
status 'created'
self.when 'manual'
end
end
end

View file

@ -115,6 +115,21 @@ feature 'Environments page', :feature, :js do
.not_to change { Ci::Pipeline.count }
end
scenario 'when action is non playable', js: true do
given(:action) do
create(:ci_build, :manual, :non_playable,
pipeline: pipeline,
name: 'close_app')
end
it 'has disabled button to the manual action' do
find('.js-dropdown-play-icon-container').click
expect(page).to have_button('close_app', disabled: true)
end
end
scenario 'does show build name and id' do
expect(page).to have_link("#{build.name} ##{build.id}")
end

View file

@ -197,6 +197,24 @@ describe 'Pipelines', :feature, :js do
end
end
context 'with non playable manual action' do
let!(:manual) do
create(:ci_build, :manual, :non_playable,
pipeline: pipeline,
name: 'manual build',
stage: 'test',
commands: 'test')
end
before { visit_project_pipelines }
it 'has disabled button to the manual action' do
find('.js-pipeline-dropdown-manual-actions').click
expect(page).to have_button('manual build', disabled: true)
end
end
context 'for generic statuses' do
context 'when running' do
let!(:running) do