diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-13 21:08:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-13 21:08:56 +0300 |
commit | 7b7bc31c5ba07eebe62e2f2582f111ce24285cd4 (patch) | |
tree | 70c795a932a603e49176d30ee5f0835fcfed46c2 /spec/features/projects/pipelines/pipeline_spec.rb | |
parent | cb38c5062c623059d311c4e9e37428eacdea95d6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/projects/pipelines/pipeline_spec.rb')
-rw-r--r-- | spec/features/projects/pipelines/pipeline_spec.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb index 343c7f53022..098d1201939 100644 --- a/spec/features/projects/pipelines/pipeline_spec.rb +++ b/spec/features/projects/pipelines/pipeline_spec.rb @@ -113,6 +113,50 @@ RSpec.describe 'Pipeline', :js, feature_category: :projects do end end + describe 'pipeline stats text' do + let(:finished_pipeline) do + create(:ci_pipeline, :success, project: project, + ref: 'master', sha: project.commit.id, user: user) + end + + before do + finished_pipeline.update!(started_at: "2023-01-01 01:01:05", created_at: "2023-01-01 01:01:01", + finished_at: "2023-01-01 01:01:10", duration: 9) + end + + context 'pipeline has finished' do + it 'shows pipeline stats with flag on' do + visit project_pipeline_path(project, finished_pipeline) + + within '.pipeline-info' do + expect(page).to have_content("in #{finished_pipeline.duration} seconds") + expect(page).to have_content("and was queued for #{finished_pipeline.queued_duration} seconds") + end + end + + it 'shows pipeline stats with flag off' do + stub_feature_flags(refactor_ci_minutes_consumption: false) + + visit project_pipeline_path(project, finished_pipeline) + + within '.pipeline-info' do + expect(page).to have_content("in #{finished_pipeline.duration} seconds " \ + "and was queued for #{finished_pipeline.queued_duration} seconds") + end + end + end + + context 'pipeline has not finished' do + it 'does not show pipeline stats' do + visit_pipeline + + within '.pipeline-info' do + expect(page).not_to have_selector('[data-testid="pipeline-stats-text"]') + end + end + end + end + describe 'related merge requests' do context 'when there are no related merge requests' do it 'shows a "no related merge requests" message' do |