Commit 6e240c42 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'bvl-pipeline-spec-broken-master' into 'master'

Refactor the pipeline feature spec

Closes #59747

See merge request gitlab-org/gitlab-ce!26822
parents a0272056 374d4f17
......@@ -59,11 +59,11 @@ describe 'Pipeline', :js do
let(:project) { create(:project, :repository) }
let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id, user: user) }
before do
visit project_pipeline_path(project, pipeline)
end
subject(:visit_pipeline) { visit project_pipeline_path(project, pipeline) }
it 'shows the pipeline graph' do
visit_pipeline
expect(page).to have_selector('.pipeline-visualization')
expect(page).to have_content('Build')
expect(page).to have_content('Test')
......@@ -73,14 +73,20 @@ describe 'Pipeline', :js do
end
it 'shows Pipeline tab pane as active' do
visit_pipeline
expect(page).to have_css('#js-tab-pipeline.active')
end
it 'shows link to the pipeline ref' do
visit_pipeline
expect(page).to have_link(pipeline.ref)
end
it 'shows the pipeline information' do
visit_pipeline
within '.pipeline-info' do
expect(page).to have_content("#{pipeline.statuses.count} jobs " \
"for #{pipeline.ref} ")
......@@ -96,6 +102,10 @@ describe 'Pipeline', :js do
end
describe 'pipeline graph' do
before do
visit_pipeline
end
context 'when pipeline has running builds' do
it 'shows a running icon and a cancel action for the running build' do
page.within('#ci-badge-deploy') do
......@@ -227,6 +237,10 @@ describe 'Pipeline', :js do
end
context 'page tabs' do
before do
visit_pipeline
end
it 'shows Pipeline, Jobs and Failed Jobs tabs with link' do
expect(page).to have_link('Pipeline')
expect(page).to have_link('Jobs')
......@@ -253,6 +267,10 @@ describe 'Pipeline', :js do
end
context 'retrying jobs' do
before do
visit_pipeline
end
it { expect(page).not_to have_content('retried') }
context 'when retrying' do
......@@ -265,6 +283,10 @@ describe 'Pipeline', :js do
end
context 'canceling jobs' do
before do
visit_pipeline
end
it { expect(page).not_to have_selector('.ci-canceled') }
context 'when canceling' do
......@@ -284,6 +306,10 @@ describe 'Pipeline', :js do
user: user)
end
before do
visit_pipeline
end
it 'does not render link to the pipeline ref' do
expect(page).not_to have_link(pipeline.ref)
expect(page).to have_content(pipeline.ref)
......@@ -305,6 +331,10 @@ describe 'Pipeline', :js do
merge_request.all_pipelines.last
end
before do
visit_pipeline
end
it 'shows the pipeline information' do
within '.pipeline-info' do
expect(page).to have_content("#{pipeline.statuses.count} jobs " \
......@@ -356,6 +386,8 @@ describe 'Pipeline', :js do
before do
pipeline.update(user: user)
visit_pipeline
end
it 'shows the pipeline information' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment