summaryrefslogtreecommitdiff
path: root/spec/features/projects/jobs/user_browses_job_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/projects/jobs/user_browses_job_spec.rb')
-rw-r--r--spec/features/projects/jobs/user_browses_job_spec.rb46
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/features/projects/jobs/user_browses_job_spec.rb b/spec/features/projects/jobs/user_browses_job_spec.rb
index 54b462da87a..fbe765d4c44 100644
--- a/spec/features/projects/jobs/user_browses_job_spec.rb
+++ b/spec/features/projects/jobs/user_browses_job_spec.rb
@@ -34,6 +34,52 @@ describe 'User browses a job', :js do
expect(page).to have_content('Job has been erased')
end
+ shared_examples 'has collapsible sections' do
+ it 'collapses the section clicked' do
+ wait_for_requests
+ text_to_hide = "Cloning into '/nolith/ci-tests'"
+ text_to_show = 'Waiting for pod'
+
+ expect(page).to have_content(text_to_hide)
+ expect(page).to have_content(text_to_show)
+
+ first('.js-section-start[data-section="get-sources"]').click
+
+ expect(page).not_to have_content(text_to_hide)
+ expect(page).to have_content(text_to_show)
+ end
+ end
+
+ context 'when job trace contains sections' do
+ let!(:build) { create(:ci_build, :success, :trace_with_sections, :coverage, pipeline: pipeline) }
+
+ it_behaves_like 'has collapsible sections'
+ end
+
+ context 'when job trace contains duplicate sections' do
+ let!(:build) { create(:ci_build, :success, :trace_with_duplicate_sections, :coverage, pipeline: pipeline) }
+
+ it_behaves_like 'has collapsible sections'
+ end
+
+ context 'when job trace contains sections' do
+ let!(:build) { create(:ci_build, :success, :trace_with_duplicate_sections, :coverage, pipeline: pipeline) }
+
+ it 'collapses a section' do
+ wait_for_requests
+ text_to_hide = "Cloning into '/nolith/ci-tests'"
+ text_to_show = 'Waiting for pod'
+
+ expect(page).to have_content(text_to_hide)
+ expect(page).to have_content(text_to_show)
+
+ first('.js-section-start[data-section="get-sources"]').click
+
+ expect(page).not_to have_content(text_to_hide)
+ expect(page).to have_content(text_to_show)
+ end
+ end
+
context 'with a failed job' do
let!(:build) { create(:ci_build, :failed, :trace_artifact, pipeline: pipeline) }