Commit 114b0a3d authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch '52690-clean-up-windows-scroll-in-job-spec-test' into 'master'

Remove window scroll in features/project/job_spec

Closes #52690

See merge request gitlab-org/gitlab-ce!22512
parents 44a9231d fe3bde2d
...@@ -373,17 +373,15 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do ...@@ -373,17 +373,15 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
context 'when job starts environment', :js do context 'when job starts environment', :js do
let(:environment) { create(:environment, name: 'production', project: project) } let(:environment) { create(:environment, name: 'production', project: project) }
before do
visit project_job_path(project, build)
wait_for_requests
end
context 'job is successful and has deployment' do context 'job is successful and has deployment' do
let(:build) { create(:ci_build, :success, :trace_live, environment: environment.name, pipeline: pipeline) } let(:build) { create(:ci_build, :success, :trace_live, environment: environment.name, pipeline: pipeline) }
let!(:deployment) { create(:deployment, environment: environment, project: environment.project, deployable: build) } let!(:deployment) { create(:deployment, environment: environment, project: environment.project, deployable: build) }
before do
visit project_job_path(project, build)
wait_for_requests
# scroll to the top of the page first
execute_script "window.scrollTo(0,0)"
end
it 'shows a link for the job' do it 'shows a link for the job' do
expect(page).to have_link environment.name expect(page).to have_link environment.name
end end
...@@ -398,11 +396,6 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do ...@@ -398,11 +396,6 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
let(:build) { create(:ci_build, :failed, :trace_artifact, environment: environment.name, pipeline: pipeline) } let(:build) { create(:ci_build, :failed, :trace_artifact, environment: environment.name, pipeline: pipeline) }
it 'shows a link for the job' do it 'shows a link for the job' do
visit project_job_path(project, build)
wait_for_requests
# scroll to the top of the page first
execute_script "window.scrollTo(0,0)"
expect(page).to have_link environment.name expect(page).to have_link environment.name
expect(find('.js-environment-link')['href']).to match("environments/#{environment.id}") expect(find('.js-environment-link')['href']).to match("environments/#{environment.id}")
end end
...@@ -412,11 +405,6 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do ...@@ -412,11 +405,6 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
let(:build) { create(:ci_build, :success, environment: environment.name, pipeline: pipeline) } let(:build) { create(:ci_build, :success, environment: environment.name, pipeline: pipeline) }
it 'shows a link to latest deployment' do it 'shows a link to latest deployment' do
visit project_job_path(project, build)
wait_for_all_requests
# scroll to the top of the page first
execute_script "window.scrollTo(0,0)"
expect(page).to have_link environment.name expect(page).to have_link environment.name
expect(page).to have_content 'This job is creating a deployment' expect(page).to have_content 'This job is creating a deployment'
expect(find('.js-environment-link')['href']).to match("environments/#{environment.id}") expect(find('.js-environment-link')['href']).to match("environments/#{environment.id}")
...@@ -453,8 +441,6 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do ...@@ -453,8 +441,6 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
before do before do
visit project_job_path(project, job) visit project_job_path(project, job)
wait_for_requests wait_for_requests
# scroll to the top of the page first
execute_script "window.scrollTo(0,0)"
end end
context 'job with outdated deployment' do context 'job with outdated deployment' do
...@@ -484,8 +470,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do ...@@ -484,8 +470,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
it 'shows deployment message' do it 'shows deployment message' do
expected_text = 'The deployment of this job to staging did not succeed.' expected_text = 'The deployment of this job to staging did not succeed.'
expect(page).to have_css( expect(page).to have_css('.environment-information', text: expected_text)
'.environment-information', text: expected_text)
end end
end end
...@@ -498,8 +483,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do ...@@ -498,8 +483,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
it 'shows deployment message' do it 'shows deployment message' do
expected_text = 'This job is creating a deployment to staging' expected_text = 'This job is creating a deployment to staging'
expect(page).to have_css( expect(page).to have_css('.environment-information', text: expected_text)
'.environment-information', text: expected_text)
expect(find('.js-environment-link')['href']).to match("environments/#{environment.id}") expect(find('.js-environment-link')['href']).to match("environments/#{environment.id}")
end end
...@@ -509,10 +493,8 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do ...@@ -509,10 +493,8 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
it 'shows that deployment will be overwritten' do it 'shows that deployment will be overwritten' do
expected_text = 'This job is creating a deployment to staging' expected_text = 'This job is creating a deployment to staging'
expect(page).to have_css( expect(page).to have_css('.environment-information', text: expected_text)
'.environment-information', text: expected_text) expect(page).to have_css('.environment-information', text: 'latest deployment')
expect(page).to have_css(
'.environment-information', text: 'latest deployment')
expect(find('.js-environment-link')['href']).to match("environments/#{environment.id}") expect(find('.js-environment-link')['href']).to match("environments/#{environment.id}")
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment