diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-17 18:09:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-17 18:09:01 +0300 |
commit | d88ab3545c27cd674f5fb8bff5fb64a9eeed590f (patch) | |
tree | c0c6cc7065a765a6c93d67cebbe0dd16431296bd /spec/features | |
parent | f0a387b4a5f08d6739894455664b4d3cb1509cc6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/projects/blobs/blame_spec.rb | 67 | ||||
-rw-r--r-- | spec/features/projects/ci/secure_files_spec.rb | 44 | ||||
-rw-r--r-- | spec/features/projects/tags/user_views_tags_spec.rb | 30 |
3 files changed, 140 insertions, 1 deletions
diff --git a/spec/features/projects/blobs/blame_spec.rb b/spec/features/projects/blobs/blame_spec.rb new file mode 100644 index 00000000000..bb3b5cd931c --- /dev/null +++ b/spec/features/projects/blobs/blame_spec.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'File blame', :js do + include TreeHelper + + let_it_be(:project) { create(:project, :public, :repository) } + + let(:path) { 'CHANGELOG' } + + def visit_blob_blame(path) + visit project_blame_path(project, tree_join('master', path)) + wait_for_all_requests + end + + 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') + end + + context 'when blob length is over the blame range limit' do + before do + stub_const('Projects::BlameService::PER_PAGE', 2) + end + + 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') + + expect(page).to have_css('#L1') + expect(page).not_to have_css('#L3') + expect(find('.page-link.active')).to have_text('1') + 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 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') + end + end + + context 'when feature flag disabled' do + before do + stub_feature_flags(blame_page_pagination: false) + end + + 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') + end + end + end +end diff --git a/spec/features/projects/ci/secure_files_spec.rb b/spec/features/projects/ci/secure_files_spec.rb index 65c41eaf2ac..a0e9d663d35 100644 --- a/spec/features/projects/ci/secure_files_spec.rb +++ b/spec/features/projects/ci/secure_files_spec.rb @@ -7,13 +7,55 @@ RSpec.describe 'Secure Files', :js do let(:user) { create(:user) } before do + stub_feature_flags(ci_secure_files_read_only: false) project.add_maintainer(user) sign_in(user) + end + it 'user sees the Secure Files list component' do visit project_ci_secure_files_path(project) + expect(page).to have_content('There are no records to show') end - it 'user sees the Secure Files list component' do + it 'prompts the user to confirm before deleting a file' do + file = create(:ci_secure_file, project: project) + + visit project_ci_secure_files_path(project) + + expect(page).to have_content(file.name) + + find('button.btn-danger').click + + expect(page).to have_content("Delete #{file.name}?") + + click_on('Delete secure file') + + visit project_ci_secure_files_path(project) + + expect(page).not_to have_content(file.name) + end + + it 'displays an uploaded file in the file list' do + visit project_ci_secure_files_path(project) expect(page).to have_content('There are no records to show') + + page.attach_file('spec/fixtures/ci_secure_files/upload-keystore.jks') do + click_button 'Upload File' + end + + expect(page).to have_content('upload-keystore.jks') + end + + it 'displays an error when a duplicate file upload is attempted' do + create(:ci_secure_file, project: project, name: 'upload-keystore.jks') + visit project_ci_secure_files_path(project) + + expect(page).to have_content('upload-keystore.jks') + + page.attach_file('spec/fixtures/ci_secure_files/upload-keystore.jks') do + click_button 'Upload File' + end + + expect(page).to have_content('A file with this name already exists.') end end diff --git a/spec/features/projects/tags/user_views_tags_spec.rb b/spec/features/projects/tags/user_views_tags_spec.rb index e1962ad3df5..dfb5d5d9221 100644 --- a/spec/features/projects/tags/user_views_tags_spec.rb +++ b/spec/features/projects/tags/user_views_tags_spec.rb @@ -2,6 +2,36 @@ require 'spec_helper' RSpec.describe 'User views tags', :feature do + context 'with html' do + let(:project) { create(:project, :repository, visibility_level: Gitlab::VisibilityLevel::PUBLIC) } + let(:user) { create(:user) } + let(:tag_name) { "stable" } + let!(:release) { create(:release, project: project, tag: tag_name) } + + before do + project.add_developer(user) + project.repository.add_tag(user, tag_name, project.default_branch_or_main) + + sign_in(user) + end + + shared_examples 'renders the tag index page' do + it do + visit project_tags_path(project) + + expect(page).to have_content tag_name + end + end + + it_behaves_like 'renders the tag index page' + + context 'when tag name contains a slash' do + let(:tag_name) { "stable/v0.1" } + + it_behaves_like 'renders the tag index page' + end + end + context 'rss' do shared_examples 'has access to the tags RSS feed' do it do |