diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-06 15:06:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-06 15:06:21 +0300 |
commit | 63894d59abd34f76f399d755012cdcd32c5b1103 (patch) | |
tree | ce797c74a93eb5a17c0e906cc7327938dcd2a4a1 /spec | |
parent | cd15d0e6c32da7f69689c7cff2e90aeda33b8318 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
4 files changed, 98 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 diff --git a/spec/fixtures/api/schemas/entities/merge_request_poll_cached_widget.json b/spec/fixtures/api/schemas/entities/merge_request_poll_cached_widget.json index e8959307767..b40b71d2cd6 100644 --- a/spec/fixtures/api/schemas/entities/merge_request_poll_cached_widget.json +++ b/spec/fixtures/api/schemas/entities/merge_request_poll_cached_widget.json @@ -26,6 +26,7 @@ "has_conflicts": { "type": "boolean" }, "can_be_merged": { "type": "boolean" }, "remove_source_branch": { "type": ["boolean", "null"] }, + "diffs_path": { "type": "string" }, "source_branch_exists": { "type": "boolean" }, "branch_missing": { "type": "boolean" }, "commits_without_merge_commits": { "type": "array" }, diff --git a/spec/javascripts/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js b/spec/javascripts/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js index 2bb2319cc60..3a4fdaf9a20 100644 --- a/spec/javascripts/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js +++ b/spec/javascripts/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js @@ -938,4 +938,31 @@ describe('ReadyToMerge', () => { expect(customVm.$el.querySelector('.js-modify-commit-message-button')).toBeNull(); }); }); + + describe('with a mismatched SHA', () => { + const findMismatchShaBlock = () => vm.$el.querySelector('.js-sha-mismatch'); + + beforeEach(() => { + vm = createComponent({ + mr: { + isSHAMismatch: true, + mergeRequestDiffsPath: '/merge_requests/1/diffs', + }, + }); + }); + + it('displays a warning message', () => { + expect(findMismatchShaBlock()).toExist(); + }); + + it('warns the user to refresh to review', () => { + expect(findMismatchShaBlock().textContent.trim()).toBe( + 'New changes were added. Reload the page to review them', + ); + }); + + it('displays link to the diffs tab', () => { + expect(findMismatchShaBlock().querySelector('a').href).toContain(vm.mr.mergeRequestDiffsPath); + }); + }); }); |