diff options
Diffstat (limited to 'spec/features/projects/jobs_spec.rb')
-rw-r--r-- | spec/features/projects/jobs_spec.rb | 81 |
1 files changed, 40 insertions, 41 deletions
diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index 8457d8a8785..3fa32e2d10b 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -1,11 +1,10 @@ require 'spec_helper' require 'tempfile' -feature 'Jobs', :feature do +feature 'Jobs' do let(:user) { create(:user) } let(:user_access_level) { :developer } - let(:project) { create(:project) } - let(:namespace) { project.namespace } + let(:project) { create(:project, :repository) } let(:pipeline) { create(:ci_pipeline, project: project) } let(:job) { create(:ci_build, :trace, pipeline: pipeline) } @@ -17,7 +16,7 @@ feature 'Jobs', :feature do before do project.team << [user, user_access_level] - gitlab_sign_in(user) + sign_in(user) end describe "GET /:project/jobs" do @@ -25,7 +24,7 @@ feature 'Jobs', :feature do context "Pending scope" do before do - visit namespace_project_jobs_path(project.namespace, project, scope: :pending) + visit project_jobs_path(project, scope: :pending) end it "shows Pending tab jobs" do @@ -40,7 +39,7 @@ feature 'Jobs', :feature do context "Running scope" do before do job.run! - visit namespace_project_jobs_path(project.namespace, project, scope: :running) + visit project_jobs_path(project, scope: :running) end it "shows Running tab jobs" do @@ -55,7 +54,7 @@ feature 'Jobs', :feature do context "Finished scope" do before do job.run! - visit namespace_project_jobs_path(project.namespace, project, scope: :finished) + visit project_jobs_path(project, scope: :finished) end it "shows Finished tab jobs" do @@ -68,7 +67,7 @@ feature 'Jobs', :feature do context "All jobs" do before do project.builds.running_or_pending.each(&:success) - visit namespace_project_jobs_path(project.namespace, project) + visit project_jobs_path(project) end it "shows All tab jobs" do @@ -82,7 +81,7 @@ feature 'Jobs', :feature do context "when visiting old URL" do let(:jobs_url) do - namespace_project_jobs_path(project.namespace, project) + project_jobs_path(project) end before do @@ -98,7 +97,7 @@ feature 'Jobs', :feature do describe "POST /:project/jobs/:id/cancel_all" do before do job.run! - visit namespace_project_jobs_path(project.namespace, project) + visit project_jobs_path(project) click_link "Cancel running" end @@ -117,7 +116,7 @@ feature 'Jobs', :feature do let(:job) { create(:ci_build, :success, pipeline: pipeline) } before do - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) end it 'shows status name', :js do @@ -140,7 +139,7 @@ feature 'Jobs', :feature do let(:job) { create(:ci_build, :success, pipeline: pipeline) } before do - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) end it 'shows retry button' do @@ -157,7 +156,7 @@ feature 'Jobs', :feature do let(:job) { create(:ci_build, :failed, pipeline: pipeline) } before do - visit namespace_project_job_path(namespace, project, job) + visit project_job_path(project, job) end it 'shows New issue button' do @@ -166,10 +165,10 @@ feature 'Jobs', :feature do it 'links to issues/new with the title and description filled in' do button_title = "Build Failed ##{job.id}" - job_path = namespace_project_job_path(namespace, project, job) + job_path = project_job_path(project, job) options = { issue: { title: button_title, description: job_path } } - href = new_namespace_project_issue_path(namespace, project, options) + href = new_project_issue_path(project, options) page.within('.header-action-buttons') do expect(find('.js-new-issue')['href']).to include(href) @@ -180,7 +179,7 @@ feature 'Jobs', :feature do context "Job from other project" do before do - visit namespace_project_job_path(project.namespace, project, job2) + visit project_job_path(project, job2) end it { expect(page.status_code).to eq(404) } @@ -189,7 +188,7 @@ feature 'Jobs', :feature do context "Download artifacts" do before do job.update_attributes(artifacts_file: artifacts_file) - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) end it 'has button to download artifacts' do @@ -202,7 +201,7 @@ feature 'Jobs', :feature do job.update_attributes(artifacts_file: artifacts_file, artifacts_expire_at: expire_at) - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) end context 'no expire date defined' do @@ -248,7 +247,7 @@ feature 'Jobs', :feature do context "when visiting old URL" do let(:job_url) do - namespace_project_job_path(project.namespace, project, job) + project_job_path(project, job) end before do @@ -264,7 +263,7 @@ feature 'Jobs', :feature do before do job.run! - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) end it do @@ -276,7 +275,7 @@ feature 'Jobs', :feature do before do job.run! - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) end context 'when job has an initial trace' do @@ -300,7 +299,7 @@ feature 'Jobs', :feature do end before do - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) end it 'shows variable key and value after click', js: true do @@ -325,7 +324,7 @@ feature 'Jobs', :feature do let(:job) { create(:ci_build, :success, environment: environment.name, deployments: [deployment], pipeline: pipeline) } it 'shows a link for the job' do - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) expect(page).to have_link environment.name end @@ -335,7 +334,7 @@ feature 'Jobs', :feature do let(:job) { create(:ci_build, :failed, environment: environment.name, pipeline: pipeline) } it 'shows a link for the job' do - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) expect(page).to have_link environment.name end @@ -346,7 +345,7 @@ feature 'Jobs', :feature do let(:job) { create(:ci_build, :success, environment: environment.name, pipeline: pipeline) } it 'shows a link to latest deployment' do - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) expect(page).to have_link('latest deployment') end @@ -358,7 +357,7 @@ feature 'Jobs', :feature do context "Job from project" do before do job.run! - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) find('.js-cancel-job').click() end @@ -373,7 +372,7 @@ feature 'Jobs', :feature do context "Job from project", :js do before do job.run! - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) find('.js-cancel-job').click() find('.js-retry-button').click end @@ -392,9 +391,9 @@ feature 'Jobs', :feature do job.cancel! project.update(visibility_level: Gitlab::VisibilityLevel::PUBLIC) - gitlab_sign_out_direct - gitlab_sign_in(create(:user)) - visit namespace_project_job_path(project.namespace, project, job) + sign_out(:user) + sign_in(create(:user)) + visit project_job_path(project, job) end it 'does not show the Retry button' do @@ -408,14 +407,14 @@ feature 'Jobs', :feature do describe "GET /:project/jobs/:id/download" do before do job.update_attributes(artifacts_file: artifacts_file) - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) click_link 'Download' end context "Build from other project" do before do job2.update_attributes(artifacts_file: artifacts_file) - visit download_namespace_project_job_artifacts_path(project.namespace, project, job2) + visit download_project_job_artifacts_path(project, job2) end it { expect(page.status_code).to eq(404) } @@ -428,7 +427,7 @@ feature 'Jobs', :feature do before do Capybara.current_session.driver.headers = { 'X-Sendfile-Type' => 'X-Sendfile' } job.run! - visit namespace_project_job_path(project.namespace, project, job) + visit project_job_path(project, job) find('.js-raw-link-controller').click() end @@ -443,7 +442,7 @@ feature 'Jobs', :feature do before do Capybara.current_session.driver.headers = { 'X-Sendfile-Type' => 'X-Sendfile' } job2.run! - visit raw_namespace_project_job_path(project.namespace, project, job2) + visit raw_project_job_path(project, job2) end it 'sends the right headers' do @@ -467,7 +466,7 @@ feature 'Jobs', :feature do .to receive(:paths) .and_return([existing_file]) - visit namespace_project_job_path(namespace, project, job) + visit project_job_path(project, job) find('.js-raw-link-controller').click end @@ -485,7 +484,7 @@ feature 'Jobs', :feature do .to receive(:paths) .and_return([]) - visit namespace_project_job_path(namespace, project, job) + visit project_job_path(project, job) end it 'sends the right headers' do @@ -496,7 +495,7 @@ feature 'Jobs', :feature do context "when visiting old URL" do let(:raw_job_url) do - raw_namespace_project_job_path(project.namespace, project, job) + raw_project_job_path(project, job) end before do @@ -512,7 +511,7 @@ feature 'Jobs', :feature do describe "GET /:project/jobs/:id/trace.json" do context "Job from project" do before do - visit trace_namespace_project_job_path(project.namespace, project, job, format: :json) + visit trace_project_job_path(project, job, format: :json) end it { expect(page.status_code).to eq(200) } @@ -520,7 +519,7 @@ feature 'Jobs', :feature do context "Job from other project" do before do - visit trace_namespace_project_job_path(project.namespace, project, job2, format: :json) + visit trace_project_job_path(project, job2, format: :json) end it { expect(page.status_code).to eq(404) } @@ -530,7 +529,7 @@ feature 'Jobs', :feature do describe "GET /:project/jobs/:id/status" do context "Job from project" do before do - visit status_namespace_project_job_path(project.namespace, project, job) + visit status_project_job_path(project, job) end it { expect(page.status_code).to eq(200) } @@ -538,7 +537,7 @@ feature 'Jobs', :feature do context "Job from other project" do before do - visit status_namespace_project_job_path(project.namespace, project, job2) + visit status_project_job_path(project, job2) end it { expect(page.status_code).to eq(404) } |