diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-06 12:06:21 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-06 12:06:21 +0000 |
commit | 63894d59abd34f76f399d755012cdcd32c5b1103 (patch) | |
tree | ce797c74a93eb5a17c0e906cc7327938dcd2a4a1 /spec/features/projects | |
parent | cd15d0e6c32da7f69689c7cff2e90aeda33b8318 (diff) | |
download | gitlab-ce-63894d59abd34f76f399d755012cdcd32c5b1103.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/projects')
-rw-r--r-- | spec/features/projects/clusters/gcp_spec.rb | 24 | ||||
-rw-r--r-- | spec/features/projects/user_changes_project_visibility_spec.rb | 46 |
2 files changed, 70 insertions, 0 deletions
diff --git a/spec/features/projects/clusters/gcp_spec.rb b/spec/features/projects/clusters/gcp_spec.rb index 9e1b4c5c45f..ba7374d5040 100644 --- a/spec/features/projects/clusters/gcp_spec.rb +++ b/spec/features/projects/clusters/gcp_spec.rb @@ -191,4 +191,28 @@ describe 'Gcp Cluster', :js do expect(page).not_to have_css('.gcp-signup-offer') end end + + context 'when third party offers are disabled' do + let(:admin) { create(:admin) } + before do + stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false') + sign_in(admin) + gitlab_enable_admin_mode_sign_in(admin) + visit integrations_admin_application_settings_path + end + + it 'user does not see the offer' do + page.within('.as-third-party-offers') do + click_button 'Expand' + check 'Do not display offers from third parties within GitLab' + click_button 'Save changes' + end + + expect(page).to have_content "Application settings saved successfully" + + visit project_clusters_path(project) + + expect(page).not_to have_css('.gcp-signup-offer') + end + end end diff --git a/spec/features/projects/user_changes_project_visibility_spec.rb b/spec/features/projects/user_changes_project_visibility_spec.rb new file mode 100644 index 00000000000..31da4140d35 --- /dev/null +++ b/spec/features/projects/user_changes_project_visibility_spec.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'User changes public project visibility', :js do + include ProjectForksHelper + + before do + fork_project(project, project.owner) + + sign_in(project.owner) + + visit edit_project_path(project) + end + + shared_examples 'changing visibility to private' do + it 'requires confirmation' do + visibility_select = first('.project-feature-controls .select-control') + visibility_select.select('Private') + + page.within('#js-shared-permissions') do + click_button 'Save changes' + end + + find('.js-confirm-danger-input').send_keys(project.path_with_namespace) + + page.within '.modal' do + click_button 'Reduce project visibility' + end + + expect(page).to have_text("Project '#{project.name}' was successfully updated") + end + end + + context 'when a project is public' do + let(:project) { create(:project, :empty_repo, :public) } + + it_behaves_like 'changing visibility to private' + end + + context 'when the project is internal' do + let(:project) { create(:project, :empty_repo, :internal) } + + it_behaves_like 'changing visibility to private' + end +end |