summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Pitino <fpitino@gitlab.com>2019-06-13 12:23:18 +0100
committerFabio Pitino <fpitino@gitlab.com>2019-06-13 12:23:18 +0100
commitcb0616fe01729cd0f2be02b16a87407a87144300 (patch)
treef4a4728c55f5304307738f563bac590944dd6ee4
parent9f832e59ab659d27865704f9f0b43f81f6f2aa8a (diff)
downloadgitlab-ce-cb0616fe01729cd0f2be02b16a87407a87144300.tar.gz
Add feature spec for collapsible sections
-rw-r--r--spec/factories/ci/builds.rb10
-rw-r--r--spec/features/projects/jobs/user_browses_job_spec.rb17
2 files changed, 27 insertions, 0 deletions
diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb
index a473136b57b..b12c41cadd3 100644
--- a/spec/factories/ci/builds.rb
+++ b/spec/factories/ci/builds.rb
@@ -228,6 +228,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 54b462da87a..1d6af95938f 100644
--- a/spec/features/projects/jobs/user_browses_job_spec.rb
+++ b/spec/features/projects/jobs/user_browses_job_spec.rb
@@ -34,6 +34,23 @@ describe 'User browses a job', :js do
expect(page).to have_content('Job has been erased')
end
+ context 'when job trace contains sections' do
+ let!(:build) { create(:ci_build, :success, :trace_with_sections, :coverage, pipeline: pipeline) }
+
+ it 'collapses a section' do
+ wait_for_requests
+ text_to_hide = "Cloning into '/nolith/ci-tests'"
+
+ expect(page).to have_content(text_to_hide)
+ expect(page).to have_css('.js-s_get-sources')
+
+ find('.js-section-start[data-section="get-sources"]').click
+
+ expect(page).not_to have_content(text_to_hide)
+ expect(page).to have_no_css('.js-s_get-sources')
+ end
+ end
+
context 'with a failed job' do
let!(:build) { create(:ci_build, :failed, :trace_artifact, pipeline: pipeline) }