diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/features/projects/jobs_spec.rb | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/features/projects/jobs_spec.rb')
-rw-r--r-- | spec/features/projects/jobs_spec.rb | 133 |
1 files changed, 87 insertions, 46 deletions
diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index e19337e1ff5..4edda9febbe 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -25,72 +25,113 @@ RSpec.describe 'Jobs', :clean_gitlab_redis_shared_state do end describe "GET /:project/jobs" do - let!(:job) { create(:ci_build, pipeline: pipeline) } - - context "Pending scope" do + context 'with no jobs' do before do - visit project_jobs_path(project, scope: :pending) - end + stub_experiment(jobs_empty_state: experiment_active) + stub_experiment_for_subject(jobs_empty_state: in_experiment_group) - it "shows Pending tab jobs" do - expect(page).to have_selector('.nav-links li.active', text: 'Pending') - expect(page).to have_content job.short_sha - expect(page).to have_content job.ref - expect(page).to have_content job.name + visit project_jobs_path(project) end - end - context "Running scope" do - before do - job.run! - visit project_jobs_path(project, scope: :running) - end + context 'when experiment not active' do + let(:experiment_active) { false } + let(:in_experiment_group) { false } - it "shows Running tab jobs" do - expect(page).to have_selector('.nav-links li.active', text: 'Running') - expect(page).to have_content job.short_sha - expect(page).to have_content job.ref - expect(page).to have_content job.name + it 'shows the empty state control page' do + expect(page).to have_content('No jobs to show') + expect(page).to have_link('Get started with Pipelines') + end end - end - context "Finished scope" do - before do - job.run! - visit project_jobs_path(project, scope: :finished) + context 'when experiment active and user in control group' do + let(:experiment_active) { true } + let(:in_experiment_group) { false } + + it 'shows the empty state control page' do + expect(page).to have_content('No jobs to show') + expect(page).to have_link('Get started with Pipelines') + end end - it "shows Finished tab jobs" do - expect(page).to have_selector('.nav-links li.active', text: 'Finished') - expect(page).to have_content 'No jobs to show' + context 'when experiment active and user in experimental group' do + let(:experiment_active) { true } + let(:in_experiment_group) { true } + + it 'shows the empty state experiment page' do + expect(page).to have_content('Use jobs to automate your tasks') + expect(page).to have_link('Create CI/CD configuration file') + end end end - context "All jobs" do - before do - project.builds.running_or_pending.each(&:success) - visit project_jobs_path(project) + context 'with a job' do + let!(:job) { create(:ci_build, pipeline: pipeline) } + + context "Pending scope" do + before do + visit project_jobs_path(project, scope: :pending) + end + + it "shows Pending tab jobs" do + expect(page).to have_selector('.nav-links li.active', text: 'Pending') + expect(page).to have_content job.short_sha + expect(page).to have_content job.ref + expect(page).to have_content job.name + end end - it "shows All tab jobs" do - expect(page).to have_selector('.nav-links li.active', text: 'All') - expect(page).to have_content job.short_sha - expect(page).to have_content job.ref - expect(page).to have_content job.name + context "Running scope" do + before do + job.run! + visit project_jobs_path(project, scope: :running) + end + + it "shows Running tab jobs" do + expect(page).to have_selector('.nav-links li.active', text: 'Running') + expect(page).to have_content job.short_sha + expect(page).to have_content job.ref + expect(page).to have_content job.name + end end - end - context "when visiting old URL" do - let(:jobs_url) do - project_jobs_path(project) + context "Finished scope" do + before do + job.run! + visit project_jobs_path(project, scope: :finished) + end + + it "shows Finished tab jobs" do + expect(page).to have_selector('.nav-links li.active', text: 'Finished') + expect(page).to have_content 'No jobs to show' + end end - before do - visit jobs_url.sub('/-/jobs', '/builds') + context "All jobs" do + before do + project.builds.running_or_pending.each(&:success) + visit project_jobs_path(project) + end + + it "shows All tab jobs" do + expect(page).to have_selector('.nav-links li.active', text: 'All') + expect(page).to have_content job.short_sha + expect(page).to have_content job.ref + expect(page).to have_content job.name + end end - it "redirects to new URL" do - expect(page.current_path).to eq(jobs_url) + context "when visiting old URL" do + let(:jobs_url) do + project_jobs_path(project) + end + + before do + visit jobs_url.sub('/-/jobs', '/builds') + end + + it "redirects to new URL" do + expect(page.current_path).to eq(jobs_url) + end end end end |