diff options
Diffstat (limited to 'spec/features/projects/jobs')
-rw-r--r-- | spec/features/projects/jobs/user_browses_job_spec.rb | 27 | ||||
-rw-r--r-- | spec/features/projects/jobs/user_triggers_manual_job_with_variables_spec.rb | 34 |
2 files changed, 59 insertions, 2 deletions
diff --git a/spec/features/projects/jobs/user_browses_job_spec.rb b/spec/features/projects/jobs/user_browses_job_spec.rb index 060b7ffbfc9..12e88bbf6a5 100644 --- a/spec/features/projects/jobs/user_browses_job_spec.rb +++ b/spec/features/projects/jobs/user_browses_job_spec.rb @@ -12,6 +12,7 @@ RSpec.describe 'User browses a job', :js do before do project.add_maintainer(user) project.enable_ci + stub_feature_flags(bootstrap_confirmation_modals: false) sign_in(user) @@ -36,8 +37,18 @@ RSpec.describe 'User browses a job', :js do expect(page).to have_content('Job has been erased') end - context 'with a failed job' do - let!(:build) { create(:ci_build, :failed, :trace_artifact, pipeline: pipeline) } + context 'with unarchived trace artifact' do + let!(:build) { create(:ci_build, :success, :unarchived_trace_artifact, :coverage, pipeline: pipeline) } + + it 'shows no trace message', :js do + wait_for_requests + + expect(page).to have_content('This job does not have a trace.') + end + end + + context 'with a failed job and live trace' do + let!(:build) { create(:ci_build, :failed, :trace_live, pipeline: pipeline) } it 'displays the failure reason' do wait_for_all_requests @@ -46,6 +57,18 @@ RSpec.describe 'User browses a job', :js do ".build-job > a[title='test - failed - (unknown failure)']") end end + + context 'with unarchived trace artifact' do + let!(:artifact) { create(:ci_job_artifact, :unarchived_trace_artifact, job: build) } + + it 'displays the failure reason from the live trace' do + wait_for_all_requests + within('.builds-container') do + expect(page).to have_selector( + ".build-job > a[title='test - failed - (unknown failure)']") + end + end + end end context 'when a failed job has been retried' do diff --git a/spec/features/projects/jobs/user_triggers_manual_job_with_variables_spec.rb b/spec/features/projects/jobs/user_triggers_manual_job_with_variables_spec.rb new file mode 100644 index 00000000000..e8a14694d88 --- /dev/null +++ b/spec/features/projects/jobs/user_triggers_manual_job_with_variables_spec.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'User triggers manual job with variables', :js do + let(:user) { create(:user) } + let(:user_access_level) { :developer } + let(:project) { create(:project, :repository, namespace: user.namespace) } + let(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.sha, ref: 'master') } + let!(:build) { create(:ci_build, :manual, pipeline: pipeline) } + + before do + project.add_maintainer(user) + project.enable_ci + + sign_in(user) + + visit(project_job_path(project, build)) + end + + it 'passes values correctly' do + page.within(find("[data-testid='ci-variable-row']")) do + find("[data-testid='ci-variable-key']").set('key_name') + find("[data-testid='ci-variable-value']").set('key_value') + end + + find("[data-testid='trigger-manual-job-btn']").click + + wait_for_requests + + expect(build.job_variables.as_json).to contain_exactly( + hash_including('key' => 'key_name', 'value' => 'key_value')) + end +end |