diff options
author | Fabio Pitino <fpitino@gitlab.com> | 2019-06-17 16:14:02 +0100 |
---|---|---|
committer | Fabio Pitino <fpitino@gitlab.com> | 2019-06-17 16:14:02 +0100 |
commit | 13268ba6bfa6659b7b4db46266a8f5063db91619 (patch) | |
tree | a656134da90c499cb6c3db303c91223378fffd08 | |
parent | 81848b6375169705d0d7a00ff2b10cb0db71c8a9 (diff) | |
download | gitlab-ce-13268ba6bfa6659b7b4db46266a8f5063db91619.tar.gz |
Extract shared examples for duplicate sections and non
-rw-r--r-- | spec/factories/ci/builds.rb | 10 | ||||
-rw-r--r-- | spec/features/projects/jobs/user_browses_job_spec.rb | 28 |
2 files changed, 38 insertions, 0 deletions
diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index 1a5f8ecaa77..5f7c75a3a92 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -238,6 +238,16 @@ FactoryBot.define do end end + trait :trace_with_sections do + after(:create) do |build, evaluator| + trace = File.binread( + File.expand_path( + Rails.root.join('spec/fixtures/trace/trace_with_sections'))) + + build.trace.set(trace) + end + end + trait :unicode_trace_live do after(:create) do |build, evaluator| trace = File.binread( diff --git a/spec/features/projects/jobs/user_browses_job_spec.rb b/spec/features/projects/jobs/user_browses_job_spec.rb index 49a7904f2e2..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,34 @@ 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) } |