summaryrefslogtreecommitdiff
path: root/spec/features/projects
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/projects')
-rw-r--r--spec/features/projects/files/gitlab_ci_syntax_yml_dropdown_spec.rb54
-rw-r--r--spec/features/projects/pages/user_edits_settings_spec.rb4
-rw-r--r--spec/features/projects/services/user_activates_jira_spec.rb44
-rw-r--r--spec/features/projects/settings/service_desk_setting_spec.rb45
-rw-r--r--spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb8
-rw-r--r--spec/features/projects/settings/user_searches_in_settings_spec.rb42
-rw-r--r--spec/features/projects/show/user_uploads_files_spec.rb30
7 files changed, 196 insertions, 31 deletions
diff --git a/spec/features/projects/files/gitlab_ci_syntax_yml_dropdown_spec.rb b/spec/features/projects/files/gitlab_ci_syntax_yml_dropdown_spec.rb
index ca6f03472dd..cd796d45aba 100644
--- a/spec/features/projects/files/gitlab_ci_syntax_yml_dropdown_spec.rb
+++ b/spec/features/projects/files/gitlab_ci_syntax_yml_dropdown_spec.rb
@@ -5,11 +5,13 @@ require 'spec_helper'
RSpec.describe 'Projects > Files > User wants to add a .gitlab-ci.yml file' do
include Spec::Support::Helpers::Features::EditorLiteSpecHelpers
+ let_it_be(:namespace) { create(:namespace) }
+ let(:project) { create(:project, :repository, namespace: namespace) }
+
before do
- project = create(:project, :repository)
sign_in project.owner
- stub_experiment(ci_syntax_templates: experiment_active)
- stub_experiment_for_subject(ci_syntax_templates: in_experiment_group)
+ stub_experiment(ci_syntax_templates_b: experiment_active)
+ stub_experiment_for_subject(ci_syntax_templates_b: in_experiment_group)
visit project_new_blob_path(project, 'master', file_name: '.gitlab-ci.yml')
end
@@ -23,35 +25,45 @@ RSpec.describe 'Projects > Files > User wants to add a .gitlab-ci.yml file' do
end
end
- context 'when experiment is active and the user is in the control group' do
+ context 'when experiment is active' do
let(:experiment_active) { true }
- let(:in_experiment_group) { false }
- it 'does not show the "Learn CI/CD syntax" template dropdown' do
- expect(page).not_to have_css('.gitlab-ci-syntax-yml-selector')
+ context 'when the user is in the control group' do
+ let(:in_experiment_group) { false }
+
+ it 'does not show the "Learn CI/CD syntax" template dropdown' do
+ expect(page).not_to have_css('.gitlab-ci-syntax-yml-selector')
+ end
end
- end
- context 'when experiment is active and the user is in the experimental group' do
- let(:experiment_active) { true }
- let(:in_experiment_group) { true }
+ context 'when the user is in the experimental group' do
+ let(:in_experiment_group) { true }
+
+ it 'allows the user to pick a "Learn CI/CD syntax" template from the dropdown', :js do
+ expect(page).to have_css('.gitlab-ci-syntax-yml-selector')
- it 'allows the user to pick a "Learn CI/CD syntax" template from the dropdown', :js do
- expect(page).to have_css('.gitlab-ci-syntax-yml-selector')
+ find('.js-gitlab-ci-syntax-yml-selector').click
- find('.js-gitlab-ci-syntax-yml-selector').click
+ wait_for_requests
- wait_for_requests
+ within '.gitlab-ci-syntax-yml-selector' do
+ find('.dropdown-input-field').set('Artifacts example')
+ find('.dropdown-content .is-focused', text: 'Artifacts example').click
+ end
- within '.gitlab-ci-syntax-yml-selector' do
- find('.dropdown-input-field').set('Artifacts example')
- find('.dropdown-content .is-focused', text: 'Artifacts example').click
+ wait_for_requests
+
+ expect(page).to have_css('.gitlab-ci-syntax-yml-selector .dropdown-toggle-text', text: 'Learn CI/CD syntax')
+ expect(editor_get_value).to have_content('You can use artifacts to pass data to jobs in later stages.')
end
- wait_for_requests
+ context 'when the group is created longer than 90 days ago' do
+ let(:namespace) { create(:namespace, created_at: 91.days.ago) }
- expect(page).to have_css('.gitlab-ci-syntax-yml-selector .dropdown-toggle-text', text: 'Learn CI/CD syntax')
- expect(editor_get_value).to have_content('You can use artifacts to pass data to jobs in later stages.')
+ it 'does not show the "Learn CI/CD syntax" template dropdown' do
+ expect(page).not_to have_css('.gitlab-ci-syntax-yml-selector')
+ end
+ end
end
end
end
diff --git a/spec/features/projects/pages/user_edits_settings_spec.rb b/spec/features/projects/pages/user_edits_settings_spec.rb
index 3649fae17ce..6156b5243de 100644
--- a/spec/features/projects/pages/user_edits_settings_spec.rb
+++ b/spec/features/projects/pages/user_edits_settings_spec.rb
@@ -140,7 +140,7 @@ RSpec.describe 'Pages edits pages settings', :js do
before do
allow(Projects::UpdateService).to receive(:new).and_return(service)
- allow(service).to receive(:execute).and_return(status: :error, message: 'Some error has occured')
+ allow(service).to receive(:execute).and_return(status: :error, message: 'Some error has occurred')
end
it 'tries to change the setting' do
@@ -150,7 +150,7 @@ RSpec.describe 'Pages edits pages settings', :js do
click_button 'Save'
- expect(page).to have_text('Some error has occured')
+ expect(page).to have_text('Some error has occurred')
end
end
diff --git a/spec/features/projects/services/user_activates_jira_spec.rb b/spec/features/projects/services/user_activates_jira_spec.rb
index 85afc54be48..3b8032e1d0d 100644
--- a/spec/features/projects/services/user_activates_jira_spec.rb
+++ b/spec/features/projects/services/user_activates_jira_spec.rb
@@ -6,12 +6,14 @@ RSpec.describe 'User activates Jira', :js do
include_context 'project service activation'
include_context 'project service Jira context'
+ before do
+ server_info = { key: 'value' }.to_json
+ stub_request(:get, test_url).to_return(body: server_info)
+ end
+
describe 'user tests Jira Service' do
context 'when Jira connection test succeeds' do
before do
- server_info = { key: 'value' }.to_json
- stub_request(:get, test_url).with(basic_auth: %w(username password)).to_return(body: server_info)
-
visit_project_integration('Jira')
fill_form
click_test_then_save_integration(expect_test_to_fail: false)
@@ -81,4 +83,40 @@ RSpec.describe 'User activates Jira', :js do
end
end
end
+
+ describe 'issue transition settings' do
+ it 'shows validation errors' do
+ visit_project_integration('Jira')
+
+ expect(page).to have_field('Move to Done', checked: true)
+
+ fill_form
+ choose 'Use custom transitions'
+ click_save_integration
+
+ within '[data-testid="issue-transition-settings"]' do
+ expect(page).to have_content('This field is required.')
+ end
+
+ fill_in 'service[jira_issue_transition_id]', with: '1, 2, 3'
+ click_save_integration
+
+ expect(page).to have_content('Jira settings saved and active.')
+ expect(project.reload.jira_service.jira_issue_transition_id).to eq('1, 2, 3')
+ end
+
+ it 'clears the transition IDs when using automatic transitions' do
+ create(:jira_service, project: project, jira_issue_transition_id: '1, 2, 3')
+ visit_project_integration('Jira')
+
+ expect(page).to have_field('Use custom transitions', checked: true)
+ expect(page).to have_field('service[jira_issue_transition_id]', with: '1, 2, 3')
+
+ choose 'Move to Done'
+ click_save_integration
+
+ expect(page).to have_content('Jira settings saved and active.')
+ expect(project.reload.jira_service.jira_issue_transition_id).to eq('')
+ end
+ end
end
diff --git a/spec/features/projects/settings/service_desk_setting_spec.rb b/spec/features/projects/settings/service_desk_setting_spec.rb
index d31913d2dcf..50451075db5 100644
--- a/spec/features/projects/settings/service_desk_setting_spec.rb
+++ b/spec/features/projects/settings/service_desk_setting_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe 'Service Desk Setting', :js do
+RSpec.describe 'Service Desk Setting', :js, :clean_gitlab_redis_cache do
let(:project) { create(:project_empty_repo, :private, service_desk_enabled: false) }
let(:presenter) { project.present(current_user: user) }
let(:user) { create(:user) }
@@ -66,5 +66,48 @@ RSpec.describe 'Service Desk Setting', :js do
expect(find('[data-testid="incoming-email"]').value).to eq('address-suffix@example.com')
end
+
+ context 'issue description templates' do
+ let_it_be(:issuable_project_template_files) do
+ {
+ '.gitlab/issue_templates/project-issue-bar.md' => 'Project Issue Template Bar',
+ '.gitlab/issue_templates/project-issue-foo.md' => 'Project Issue Template Foo'
+ }
+ end
+
+ let_it_be(:issuable_group_template_files) do
+ {
+ '.gitlab/issue_templates/group-issue-bar.md' => 'Group Issue Template Bar',
+ '.gitlab/issue_templates/group-issue-foo.md' => 'Group Issue Template Foo'
+ }
+ end
+
+ let_it_be_with_reload(:group) { create(:group)}
+ let_it_be_with_reload(:project) { create(:project, :custom_repo, group: group, files: issuable_project_template_files) }
+ let_it_be(:group_template_repo) { create(:project, :custom_repo, group: group, files: issuable_group_template_files) }
+
+ before do
+ stub_licensed_features(custom_file_templates_for_namespace: false, custom_file_templates: false)
+ group.update_columns(file_template_project_id: group_template_repo.id)
+ end
+
+ context 'when inherited_issuable_templates enabled' do
+ before do
+ stub_feature_flags(inherited_issuable_templates: true)
+ visit edit_project_path(project)
+ end
+
+ it_behaves_like 'issue description templates from current project only'
+ end
+
+ context 'when inherited_issuable_templates disabled' do
+ before do
+ stub_feature_flags(inherited_issuable_templates: false)
+ visit edit_project_path(project)
+ end
+
+ it_behaves_like 'issue description templates from current project only'
+ end
+ end
end
end
diff --git a/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb b/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb
index e8e32d93f7b..397c334a2b8 100644
--- a/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb
+++ b/spec/features/projects/settings/user_manages_merge_requests_settings_spec.rb
@@ -133,7 +133,7 @@ RSpec.describe 'Projects > Settings > User manages merge request settings' do
it 'when unchecked sets :remove_source_branch_after_merge to false' do
uncheck('project_remove_source_branch_after_merge')
within('.merge-request-settings-form') do
- find('.qa-save-merge-request-changes')
+ find('.rspec-save-merge-request-changes')
click_on('Save changes')
end
@@ -157,7 +157,7 @@ RSpec.describe 'Projects > Settings > User manages merge request settings' do
choose('project_project_setting_attributes_squash_option_default_on')
within('.merge-request-settings-form') do
- find('.qa-save-merge-request-changes')
+ find('.rspec-save-merge-request-changes')
click_on('Save changes')
end
@@ -172,7 +172,7 @@ RSpec.describe 'Projects > Settings > User manages merge request settings' do
choose('project_project_setting_attributes_squash_option_always')
within('.merge-request-settings-form') do
- find('.qa-save-merge-request-changes')
+ find('.rspec-save-merge-request-changes')
click_on('Save changes')
end
@@ -187,7 +187,7 @@ RSpec.describe 'Projects > Settings > User manages merge request settings' do
choose('project_project_setting_attributes_squash_option_never')
within('.merge-request-settings-form') do
- find('.qa-save-merge-request-changes')
+ find('.rspec-save-merge-request-changes')
click_on('Save changes')
end
diff --git a/spec/features/projects/settings/user_searches_in_settings_spec.rb b/spec/features/projects/settings/user_searches_in_settings_spec.rb
new file mode 100644
index 00000000000..563dff615d6
--- /dev/null
+++ b/spec/features/projects/settings/user_searches_in_settings_spec.rb
@@ -0,0 +1,42 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'User searches project settings', :js do
+ let_it_be(:user) { create(:user) }
+ let_it_be(:project) { create(:project, :repository, namespace: user.namespace) }
+
+ before do
+ sign_in(user)
+ end
+
+ context 'in general settings page' do
+ let(:visit_path) { edit_project_path(project) }
+
+ it_behaves_like 'can search settings with feature flag check', 'Naming', 'Visibility'
+ end
+
+ context 'in Repository page' do
+ before do
+ visit project_settings_repository_path(project)
+ end
+
+ it_behaves_like 'can search settings', 'Deploy keys', 'Mirroring repositories'
+ end
+
+ context 'in CI/CD page' do
+ before do
+ visit project_settings_ci_cd_path(project)
+ end
+
+ it_behaves_like 'can search settings', 'General pipelines', 'Auto DevOps'
+ end
+
+ context 'in Operations page' do
+ before do
+ visit project_settings_operations_path(project)
+ end
+
+ it_behaves_like 'can search settings', 'Alerts', 'Incidents'
+ end
+end
diff --git a/spec/features/projects/show/user_uploads_files_spec.rb b/spec/features/projects/show/user_uploads_files_spec.rb
index 053598a528e..b7c5d324d93 100644
--- a/spec/features/projects/show/user_uploads_files_spec.rb
+++ b/spec/features/projects/show/user_uploads_files_spec.rb
@@ -33,4 +33,34 @@ RSpec.describe 'Projects > Show > User uploads files' do
include_examples 'it uploads and commit a new file to a forked project'
end
+
+ context 'with an empty repo' do
+ let(:project) { create(:project, :empty_repo, creator: user) }
+
+ context 'when in the empty_repo_upload experiment' do
+ before do
+ stub_experiments(empty_repo_upload: :candidate)
+
+ visit(project_path(project))
+ end
+
+ it 'uploads and commits a new text file', :js do
+ click_link('Upload file')
+
+ drop_in_dropzone(File.join(Rails.root, 'spec', 'fixtures', 'doc_sample.txt'))
+
+ page.within('#modal-upload-blob') do
+ fill_in(:commit_message, with: 'New commit message')
+ end
+
+ click_button('Upload file')
+
+ wait_for_requests
+
+ expect(page).to have_content('New commit message')
+ expect(page).to have_content('Lorem ipsum dolor sit amet')
+ expect(page).to have_content('Sed ut perspiciatis unde omnis')
+ end
+ end
+ end
end