diff options
author | Steve Azzopardi <steveazz@outlook.com> | 2018-10-22 09:56:32 +0300 |
---|---|---|
committer | Steve Azzopardi <steveazz@outlook.com> | 2018-10-22 09:56:32 +0300 |
commit | fe3bde2d0f06d1e51f11ec8e9e864dd2d4e0eb4c (patch) | |
tree | 29e7c94a855cdc4ebc0a7108c39495e4b5c9ec9a /spec/features | |
parent | 90a0163b57f7120985c47e455fc3cf32ba250d41 (diff) |
Remove window scroll in features/project/job_spec
We have some tests that execute `execute_script "window.scrollTo(0,0)"`
which is not needed since we are just checking the dom, which end up in
a some slower tests.
Move the `before` block for `when job starts environment` sub contextes
to one block since all of the are the same.
Some formatting fixes to be consistent.
closes https://gitlab.com/gitlab-org/gitlab-ce/issues/52690
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/projects/jobs_spec.rb | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index b0631c9dec8..1ea8a640e17 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -373,17 +373,15 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do context 'when job starts environment', :js do 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 let(:build) { create(:ci_build, :success, :trace_live, environment: environment.name, pipeline: pipeline) } 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 expect(page).to have_link environment.name end @@ -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) } 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(find('.js-environment-link')['href']).to match("environments/#{environment.id}") end @@ -412,11 +405,6 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do let(:build) { create(:ci_build, :success, environment: environment.name, pipeline: pipeline) } 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_content 'This job is creating a deployment' expect(find('.js-environment-link')['href']).to match("environments/#{environment.id}") @@ -453,8 +441,6 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do before do visit project_job_path(project, job) wait_for_requests - # scroll to the top of the page first - execute_script "window.scrollTo(0,0)" end context 'job with outdated deployment' do @@ -484,8 +470,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do it 'shows deployment message' do expected_text = 'The deployment of this job to staging did not succeed.' - expect(page).to have_css( - '.environment-information', text: expected_text) + expect(page).to have_css('.environment-information', text: expected_text) end end @@ -498,8 +483,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do it 'shows deployment message' do expected_text = 'This job is creating a deployment to staging' - expect(page).to have_css( - '.environment-information', text: expected_text) + expect(page).to have_css('.environment-information', text: expected_text) expect(find('.js-environment-link')['href']).to match("environments/#{environment.id}") end @@ -509,10 +493,8 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do it 'shows that deployment will be overwritten' do expected_text = 'This job is creating a deployment to staging' - expect(page).to have_css( - '.environment-information', text: expected_text) - expect(page).to have_css( - '.environment-information', text: 'latest deployment') + expect(page).to have_css('.environment-information', text: expected_text) + expect(page).to have_css('.environment-information', text: 'latest deployment') expect(find('.js-environment-link')['href']).to match("environments/#{environment.id}") end end |