diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-13 12:12:50 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-13 12:12:50 +0000 |
commit | 37a739daec0d7021b2af6ad03c60d37ac3461d88 (patch) | |
tree | e9621e1d5b8c59a2f2768deb3f153e1e5fb01437 /spec/features/projects/blobs | |
parent | bfd344aeac677543c2a2f623fd103d4cf0f4e247 (diff) | |
download | gitlab-ce-37a739daec0d7021b2af6ad03c60d37ac3461d88.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/projects/blobs')
-rw-r--r-- | spec/features/projects/blobs/blame_spec.rb | 80 |
1 files changed, 56 insertions, 24 deletions
diff --git a/spec/features/projects/blobs/blame_spec.rb b/spec/features/projects/blobs/blame_spec.rb index 3377fcdee48..f50f6911120 100644 --- a/spec/features/projects/blobs/blame_spec.rb +++ b/spec/features/projects/blobs/blame_spec.rb @@ -35,8 +35,10 @@ RSpec.describe 'File blame', :js do it 'displays the blame page without pagination' do visit_blob_blame(path) - expect(page).to have_css('.blame-commit') - expect(page).not_to have_css('.gl-pagination') + within '[data-testid="blob-content-holder"]' do + expect(page).to have_css('.blame-commit') + expect(page).not_to have_css('.gl-pagination') + end end context 'when blob length is over the blame range limit' do @@ -47,12 +49,15 @@ RSpec.describe 'File blame', :js do it 'displays two first lines of the file with pagination' do visit_blob_blame(path) - expect(page).to have_css('.blame-commit') - expect(page).to have_css('.gl-pagination') + within '[data-testid="blob-content-holder"]' do + expect(page).to have_css('.blame-commit') + expect(page).to have_css('.gl-pagination') + expect(page).to have_link _('View entire blame') - expect(page).to have_css('#L1') - expect(page).not_to have_css('#L3') - expect(find('.page-link.active')).to have_text('1') + expect(page).to have_css('#L1') + expect(page).not_to have_css('#L3') + expect(find('.page-link.active')).to have_text('1') + end end context 'when user clicks on the next button' do @@ -63,15 +68,35 @@ RSpec.describe 'File blame', :js do end it 'displays next two lines of the file with pagination' do - expect(page).not_to have_css('#L1') - expect(page).to have_css('#L3') - expect(find('.page-link.active')).to have_text('2') + within '[data-testid="blob-content-holder"]' do + expect(page).not_to have_css('#L1') + expect(page).to have_css('#L3') + expect(find('.page-link.active')).to have_text('2') + end end it 'correctly redirects to the prior blame page' do - find('.version-link').click + within '[data-testid="blob-content-holder"]' do + find('.version-link').click - expect(find('.page-link.active')).to have_text('2') + expect(find('.page-link.active')).to have_text('2') + end + end + end + + context 'when user clicks on View entire blame button' do + before do + visit_blob_blame(path) + end + + it 'displays the blame page without pagination' do + within '[data-testid="blob-content-holder"]' do + click_link _('View entire blame') + + expect(page).to have_css('#L1') + expect(page).to have_css('#L3') + expect(page).not_to have_css('.gl-pagination') + end end end @@ -83,8 +108,11 @@ RSpec.describe 'File blame', :js do it 'displays the blame page without pagination' do visit_blob_blame(path) - expect(page).to have_css('.blame-commit') - expect(page).not_to have_css('.gl-pagination') + within '[data-testid="blob-content-holder"]' do + expect(page).to have_css('.blame-commit') + expect(page).not_to have_css('.gl-pagination') + expect(page).not_to have_link _('View entire blame') + end end end end @@ -99,25 +127,29 @@ RSpec.describe 'File blame', :js do it 'displays two hundred lines of the file with pagination' do visit_blob_blame(path) - expect(page).to have_css('.blame-commit') - expect(page).to have_css('.gl-pagination') + within '[data-testid="blob-content-holder"]' do + expect(page).to have_css('.blame-commit') + expect(page).to have_css('.gl-pagination') - expect(page).to have_css('#L1') - expect(page).not_to have_css('#L201') - expect(find('.page-link.active')).to have_text('1') + expect(page).to have_css('#L1') + expect(page).not_to have_css('#L201') + expect(find('.page-link.active')).to have_text('1') + end end context 'when user clicks on the next button' do before do visit_blob_blame(path) - - find('.js-next-button').click end it 'displays next two hundred lines of the file with pagination' do - expect(page).not_to have_css('#L1') - expect(page).to have_css('#L201') - expect(find('.page-link.active')).to have_text('2') + within '[data-testid="blob-content-holder"]' do + find('.js-next-button').click + + expect(page).not_to have_css('#L1') + expect(page).to have_css('#L201') + expect(find('.page-link.active')).to have_text('2') + end end end end |