From 969309e2bda53bb8bce71a23a212f10f2f54eb1d Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 27 May 2021 00:10:40 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .gitlab/ci/docs.gitlab-ci.yml | 2 - .../pages/groups/new/components/app.vue | 55 ++++++++++++++++++ .../create_group_description_details.vue | 44 ++++++++++++++ .../javascripts/pages/groups/new/index.js | 31 ++++++---- .../new_namespace/new_namespace_page.vue | 2 +- app/services/merge_requests/update_service.rb | 2 +- app/views/groups/_new_group_fields.html.haml | 2 +- app/views/groups/new.html.haml | 57 ++++++------------- .../_registration_enabled_callout.html.haml | 25 ++++---- ...devops_implicitly_enabled_banner.html.haml | 17 +++--- app/views/shared/_global_alert.html.haml | 20 +++++++ doc/ci/unit_test_reports.md | 4 +- doc/user/application_security/sast/index.md | 4 ++ doc/user/group/import/index.md | 2 +- doc/user/group/index.md | 1 + locale/gitlab.pot | 24 ++++---- qa/qa/page/group/new.rb | 8 +++ qa/qa/resource/group.rb | 1 + .../create_group_with_mattermost_team_spec.rb | 10 +++- .../create_and_process_pipeline_spec.rb | 13 ++++- spec/features/dashboard/group_spec.rb | 2 + .../import_export/connect_instance_spec.rb | 2 +- .../groups/import_export/import_file_spec.rb | 14 ++--- spec/features/groups_spec.rb | 38 ++++++++----- .../merge_requests/update_service_spec.rb | 7 +++ 25 files changed, 265 insertions(+), 122 deletions(-) create mode 100644 app/assets/javascripts/pages/groups/new/components/app.vue create mode 100644 app/assets/javascripts/pages/groups/new/components/create_group_description_details.vue create mode 100644 app/views/shared/_global_alert.html.haml diff --git a/.gitlab/ci/docs.gitlab-ci.yml b/.gitlab/ci/docs.gitlab-ci.yml index 35d462584ee..5be7d85dcfe 100644 --- a/.gitlab/ci/docs.gitlab-ci.yml +++ b/.gitlab/ci/docs.gitlab-ci.yml @@ -54,8 +54,6 @@ docs-lint links: extends: - .docs:rules:docs-lint image: registry.gitlab.com/gitlab-org/gitlab-docs/lint-html:alpine-3.13-ruby-2.7.2 - # TODO: revert to .default-retry when https://gitlab.com/gitlab-org/gitlab/-/issues/331002 is fixed. - retry: 2 stage: test needs: [] script: diff --git a/app/assets/javascripts/pages/groups/new/components/app.vue b/app/assets/javascripts/pages/groups/new/components/app.vue new file mode 100644 index 00000000000..9aac364d20e --- /dev/null +++ b/app/assets/javascripts/pages/groups/new/components/app.vue @@ -0,0 +1,55 @@ + + + diff --git a/app/assets/javascripts/pages/groups/new/components/create_group_description_details.vue b/app/assets/javascripts/pages/groups/new/components/create_group_description_details.vue new file mode 100644 index 00000000000..ea08a0821a8 --- /dev/null +++ b/app/assets/javascripts/pages/groups/new/components/create_group_description_details.vue @@ -0,0 +1,44 @@ + + + diff --git a/app/assets/javascripts/pages/groups/new/index.js b/app/assets/javascripts/pages/groups/new/index.js index 569b5afd676..7557edb1b49 100644 --- a/app/assets/javascripts/pages/groups/new/index.js +++ b/app/assets/javascripts/pages/groups/new/index.js @@ -1,8 +1,9 @@ -import $ from 'jquery'; +import Vue from 'vue'; import BindInOut from '~/behaviors/bind_in_out'; import initFilePickers from '~/file_pickers'; import Group from '~/group'; -import LinkedTabs from '~/lib/utils/bootstrap_linked_tabs'; +import { parseBoolean } from '~/lib/utils/common_utils'; +import NewGroupCreationApp from './components/app.vue'; import GroupPathValidator from './group_path_validator'; new GroupPathValidator(); // eslint-disable-line no-new @@ -12,15 +13,21 @@ initFilePickers(); new Group(); // eslint-disable-line no-new -const CONTAINER_SELECTOR = '.group-edit-container .nav-tabs'; -const DEFAULT_ACTION = '#create-group-pane'; -// eslint-disable-next-line no-new -new LinkedTabs({ - defaultAction: DEFAULT_ACTION, - parentEl: CONTAINER_SELECTOR, - hashedTabs: true, -}); +function initNewGroupCreation(el) { + const { hasErrors } = el.dataset; -if (window.location.hash) { - $(CONTAINER_SELECTOR).find(`a[href="${window.location.hash}"]`).tab('show'); + const props = { + hasErrors: parseBoolean(hasErrors), + }; + + return new Vue({ + el, + render(h) { + return h(NewGroupCreationApp, { props }); + }, + }); } + +const el = document.querySelector('.js-new-group-creation'); + +initNewGroupCreation(el); diff --git a/app/assets/javascripts/vue_shared/new_namespace/new_namespace_page.vue b/app/assets/javascripts/vue_shared/new_namespace/new_namespace_page.vue index 54313297b14..a2b432d11f4 100644 --- a/app/assets/javascripts/vue_shared/new_namespace/new_namespace_page.vue +++ b/app/assets/javascripts/vue_shared/new_namespace/new_namespace_page.vue @@ -129,7 +129,7 @@ export default { - + diff --git a/app/services/merge_requests/update_service.rb b/app/services/merge_requests/update_service.rb index 40d0d25fad8..af041de5596 100644 --- a/app/services/merge_requests/update_service.rb +++ b/app/services/merge_requests/update_service.rb @@ -49,7 +49,7 @@ module MergeRequests # if merge_request.previous_changes.include?('target_branch') || merge_request.previous_changes.include?('source_branch') - merge_request.mark_as_unchecked + merge_request.mark_as_unchecked unless merge_request.unchecked? end end diff --git a/app/views/groups/_new_group_fields.html.haml b/app/views/groups/_new_group_fields.html.haml index fd0a7af30ed..0e3309fc8da 100644 --- a/app/views/groups/_new_group_fields.html.haml +++ b/app/views/groups/_new_group_fields.html.haml @@ -22,6 +22,6 @@ .col-sm-4 = recaptcha_tags .row - .form-actions.col-sm-12 + .col-sm-12 = f.submit _('Create group'), class: "btn gl-button btn-confirm" = link_to _('Cancel'), dashboard_groups_path, class: 'btn gl-button btn-default btn-cancel' diff --git a/app/views/groups/new.html.haml b/app/views/groups/new.html.haml index 920a6ccd9ec..11927142ea6 100644 --- a/app/views/groups/new.html.haml +++ b/app/views/groups/new.html.haml @@ -2,47 +2,24 @@ - @hide_top_links = true - page_title _('New Group') - header_title _("Groups"), dashboard_groups_path -- active_tab = local_assigns.fetch(:active_tab, 'create') +- add_page_specific_style 'page_bundles/new_namespace' -.group-edit-container.gl-mt-3 - .row - .col-lg-3.group-settings-sidebar - %h4.prepend-top-0 - = _('New group') - %p - - group_docs_path = help_page_path('user/group/index') - - group_docs_link_start = ''.html_safe % { url: group_docs_path } - = s_('%{group_docs_link_start}Groups%{group_docs_link_end} allow you to manage and collaborate across multiple projects. Members of a group have access to all of its projects.').html_safe % { group_docs_link_start: group_docs_link_start, group_docs_link_end: ''.html_safe } - %p - - subgroup_docs_path = help_page_path('user/group/subgroups/index') - - subgroup_docs_link_start = ''.html_safe % { url: subgroup_docs_path } - = s_('Groups can also be nested by creating %{subgroup_docs_link_start}subgroups%{subgroup_docs_link_end}.').html_safe % { subgroup_docs_link_start: subgroup_docs_link_start, subgroup_docs_link_end: ''.html_safe } - %p - = _('Projects that belong to a group are prefixed with the group namespace. Existing projects may be moved into a group.') +.group-edit-container.gl-mt-5 - .col-lg-9.js-toggle-container - %ul.nav.nav-tabs.nav-links.gitlab-tabs{ role: 'tablist' } - %li.nav-item{ role: 'presentation' } - %a.nav-link.active{ href: '#create-group-pane', id: 'create-group-tab', role: 'tab', data: { toggle: 'tab', track_label: 'create_group', track_event: 'click_tab', track_value: '' } } - %span.d-none.d-sm-block= s_('GroupsNew|Create group') - %span.d-block.d-sm-none= s_('GroupsNew|Create') - %li.nav-item{ role: 'presentation' } - %a.nav-link{ href: '#import-group-pane', id: 'import-group-tab', role: 'tab', data: { toggle: 'tab', track_label: 'import_group', track_event: 'click_tab', track_value: '' } } - %span.d-none.d-sm-block= s_('GroupsNew|Import group') - %span.d-block.d-sm-none= s_('GroupsNew|Import') + .js-new-group-creation{ data: { has_errors: @group.errors.any?.to_s } } - .tab-content.gitlab-tab-content.gl-border-none - .tab-pane.js-toggle-container{ id: 'create-group-pane', class: active_when(active_tab == 'create'), role: 'tabpanel' } - = form_for @group, html: { class: 'group-form gl-show-field-errors' } do |f| - = render 'new_group_fields', f: f, group_name_id: 'create-group-name' + .row{ 'v-cloak': true } + #create-group-pane.tab-pane + = form_for @group, html: { class: 'group-form gl-show-field-errors' } do |f| + = render 'new_group_fields', f: f, group_name_id: 'create-group-name' - .tab-pane.no-padding.js-toggle-container{ id: 'import-group-pane', class: active_when(active_tab) == 'import', role: 'tabpanel' } - - if import_sources_enabled? - - if Feature.enabled?(:bulk_import) - = render 'import_group_from_another_instance_panel' - .gl-mt-7.gl-border-b-solid.gl-border-gray-100.gl-border-1 - = render 'import_group_from_file_panel' - - else - .nothing-here-block - %h4= s_('GroupsNew|No import options available') - %p= s_('GroupsNew|Contact an administrator to enable options for importing your group.') + #import-group-pane.tab-pane + - if import_sources_enabled? + - if Feature.enabled?(:bulk_import) + = render 'import_group_from_another_instance_panel' + .gl-mt-7.gl-border-b-solid.gl-border-gray-100.gl-border-1 + = render 'import_group_from_file_panel' + - else + .nothing-here-block + %h4= s_('GroupsNew|No import options available') + %p= s_('GroupsNew|Contact an administrator to enable options for importing your group.') diff --git a/app/views/layouts/header/_registration_enabled_callout.html.haml b/app/views/layouts/header/_registration_enabled_callout.html.haml index 1b1804edcc7..9266702e44e 100644 --- a/app/views/layouts/header/_registration_enabled_callout.html.haml +++ b/app/views/layouts/header/_registration_enabled_callout.html.haml @@ -1,15 +1,14 @@ - return unless show_registration_enabled_user_callout? -%div{ class: [container_class, @content_class, 'gl-pt-5!'] } - .gl-alert.gl-alert-warning.js-registration-enabled-callout{ role: 'alert', data: { feature_id: UserCalloutsHelper::REGISTRATION_ENABLED_CALLOUT, dismiss_endpoint: user_callouts_path } } - = sprite_icon('warning', size: 16, css_class: 'gl-alert-icon') - %button.gl-alert-dismiss.js-close{ type: 'button', aria: { label: _('Close') }, data: { testid: 'close-registration-enabled-callout' } } - = sprite_icon('close', size: 16) - .gl-alert-title - = _('Open registration is enabled on your instance.') - .gl-alert-body - = html_escape(_('%{anchorOpen}Learn more%{anchorClose} about how you can customize / disable registration on your instance.')) % { anchorOpen: "".html_safe, anchorClose: ''.html_safe } - .gl-alert-actions - = link_to general_admin_application_settings_path(anchor: 'js-signup-settings'), class: 'btn gl-alert-action btn-info btn-md gl-button' do - %span.gl-button-text - = _('View setting') += render 'shared/global_alert', + title: _('Open registration is enabled on your instance.'), + variant: :warning, + alert_class: 'js-registration-enabled-callout', + alert_data: { feature_id: UserCalloutsHelper::REGISTRATION_ENABLED_CALLOUT, dismiss_endpoint: user_callouts_path }, + close_button_data: { testid: 'close-registration-enabled-callout' } do + .gl-alert-body + = html_escape(_('%{anchorOpen}Learn more%{anchorClose} about how you can customize / disable registration on your instance.')) % { anchorOpen: "".html_safe, anchorClose: ''.html_safe } + .gl-alert-actions + = link_to general_admin_application_settings_path(anchor: 'js-signup-settings'), class: 'btn gl-alert-action btn-info btn-md gl-button' do + %span.gl-button-text + = _('View setting') diff --git a/app/views/shared/_auto_devops_implicitly_enabled_banner.html.haml b/app/views/shared/_auto_devops_implicitly_enabled_banner.html.haml index 6f70c927147..f788bf53a4c 100644 --- a/app/views/shared/_auto_devops_implicitly_enabled_banner.html.haml +++ b/app/views/shared/_auto_devops_implicitly_enabled_banner.html.haml @@ -1,13 +1,14 @@ - if show_auto_devops_implicitly_enabled_banner?(project, current_user) - .qa-auto-devops-banner.auto-devops-implicitly-enabled-banner.gl-alert.gl-alert-info - = sprite_icon('information-o', css_class: 'gl-icon gl-alert-icon gl-alert-icon-no-title') - %button.js-close.gl-alert-dismiss{ type: 'button', 'aria-label' => _('Dismiss'), class: 'hide-auto-devops-implicitly-enabled-banner alert-link', data: { project_id: project.id } } - = sprite_icon('close', css_class: 'gl-icon') + = render 'shared/global_alert', + variant: :info, + alert_class: 'qa-auto-devops-banner auto-devops-implicitly-enabled-banner', + close_button_class: 'hide-auto-devops-implicitly-enabled-banner', + close_button_data: { project_id: project.id } do .gl-alert-body = s_("AutoDevOps|The Auto DevOps pipeline has been enabled and will be used if no alternative CI configuration file is found.") - - unless Gitlab.config.registry.enabled - %div - = _('Container registry is not enabled on this GitLab instance. Ask an administrator to enable it in order for Auto DevOps to work.') - .gl-alert-actions.gl-mt-3 + - unless Gitlab.config.registry.enabled + %div + = _('Container registry is not enabled on this GitLab instance. Ask an administrator to enable it in order for Auto DevOps to work.') + .gl-alert-actions = link_to _('Settings'), project_settings_ci_cd_path(project), class: 'alert-link btn gl-button btn-info' = link_to _('More information'), help_page_path('topics/autodevops/index.md'), target: '_blank', class: 'alert-link btn gl-button btn-default gl-ml-2' diff --git a/app/views/shared/_global_alert.html.haml b/app/views/shared/_global_alert.html.haml new file mode 100644 index 00000000000..bebc72fe428 --- /dev/null +++ b/app/views/shared/_global_alert.html.haml @@ -0,0 +1,20 @@ +- icons = { info: 'information-o', warning: 'warning', success: 'check-circle', danger: 'error', tip: 'bulb' } + +- title = local_assigns.fetch(:title, nil) +- variant = local_assigns.fetch(:variant, :info) +- alert_class = local_assigns.fetch(:alert_class, nil) +- alert_data = local_assigns.fetch(:alert_data, nil) +- close_button_class = local_assigns.fetch(:close_button_class, nil) +- close_button_data = local_assigns.fetch(:close_button_data, nil) +- icon = icons[variant] + +%div{ role: 'alert', class: ["gl-alert-#{variant}", alert_class], data: alert_data } + %div{ class: [container_class, @content_class, 'gl-px-0!'] } + .gl-alert + = sprite_icon(icon, size: 16, css_class: "gl-alert-icon#{' gl-alert-icon-no-title' if title.nil?}") + %button.gl-alert-dismiss.js-close{ type: 'button', aria: { label: _('Close') }, class: close_button_class, data: close_button_data } + = sprite_icon('close', size: 16) + - if title + .gl-alert-title + = title + = yield diff --git a/doc/ci/unit_test_reports.md b/doc/ci/unit_test_reports.md index bbb62f74caa..e55393a79a1 100644 --- a/doc/ci/unit_test_reports.md +++ b/doc/ci/unit_test_reports.md @@ -339,12 +339,12 @@ If parsing JUnit report XML results in an error, an indicator is shown next to t Upload your screenshots as [artifacts](yaml/README.md#artifactsreportsjunit) to GitLab. If JUnit report format XML files contain an `attachment` tag, GitLab parses the attachment. Note that: -- The `attachment` tag **must** contain the absolute path to the screenshots you uploaded. For +- The `attachment` tag **must** contain the relative path to `$CI_PROJECT_DIR` of the screenshots you uploaded. For example: ```xml - [[ATTACHMENT|/absolute/path/to/some/file]] + [[ATTACHMENT|/path/to/some/file]] ``` diff --git a/doc/user/application_security/sast/index.md b/doc/user/application_security/sast/index.md index 90c85da45fc..a199db87d08 100644 --- a/doc/user/application_security/sast/index.md +++ b/doc/user/application_security/sast/index.md @@ -772,3 +772,7 @@ For Maven builds, add the following to your `pom.xml` file: ### Flawfinder encoding error This occurs when Flawfinder encounters an invalid UTF-8 character. To fix this, convert all source code in your project to UTF-8 character encoding. This can be done with [`cvt2utf`](https://github.com/x1angli/cvt2utf) or [`iconv`](https://www.gnu.org/software/libiconv/documentation/libiconv-1.13/iconv.1.html) either over the entire project or per job using the [`before_script`](../../../ci/yaml/README.md#before_script) feature. + +### Semgrep slowness, unexpected results, or other errors + +If Semgrep is slow, reports too many false positives or false negatives, crashes, fails, or is otherwise broken, see the Semgrep docs for [troubleshooting GitLab SAST](https://semgrep.dev/docs/troubleshooting/gitlab-sast/). diff --git a/doc/user/group/import/index.md b/doc/user/group/import/index.md index 14464ff1a5f..42fa52df555 100644 --- a/doc/user/group/import/index.md +++ b/doc/user/group/import/index.md @@ -105,7 +105,7 @@ on an existing group's page. ![Navigation paths to create a new group](img/new_group_navigation_v13_8.png) -1. On the New Group page, select the **Import group** tab. +1. On the New Group page, select **Import group**. ![Fill in import details](img/import_panel_v13_8.png) diff --git a/doc/user/group/index.md b/doc/user/group/index.md index a0c54fd09f5..5788975f42c 100644 --- a/doc/user/group/index.md +++ b/doc/user/group/index.md @@ -51,6 +51,7 @@ To create a group: 1. From the top menu, either: - Select **Groups > Your Groups**, and on the right, select the **New group** button. - To the left of the search box, select the plus sign and then **New group**. +1. Select **Create group**. 1. For the **Group name**, use only: - Alphanumeric characters - Emojis diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 60b3c61ab0e..2c553f1b41c 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -558,9 +558,6 @@ msgstr "" msgid "%{global_id} is not a valid ID for %{expected_types}." msgstr "" -msgid "%{group_docs_link_start}Groups%{group_docs_link_end} allow you to manage and collaborate across multiple projects. Members of a group have access to all of its projects." -msgstr "" - msgid "%{group_name} activity" msgstr "" @@ -16085,9 +16082,6 @@ msgstr "" msgid "Groups and subgroups" msgstr "" -msgid "Groups can also be nested by creating %{subgroup_docs_link_start}subgroups%{subgroup_docs_link_end}." -msgstr "" - msgid "Groups to synchronize" msgstr "" @@ -16124,22 +16118,31 @@ msgstr "" msgid "GroupsEmptyState|You can manage your group member’s permissions and access to each project in the group." msgstr "" +msgid "GroupsNew|%{linkStart}Groups%{linkEnd} allow you to manage and collaborate across multiple projects. Members of a group have access to all of its projects. Groups can also be nested by creating subgroups." +msgstr "" + +msgid "GroupsNew|Assemble related projects together and grant members access to several projects at once." +msgstr "" + msgid "GroupsNew|Connect instance" msgstr "" msgid "GroupsNew|Contact an administrator to enable options for importing your group." msgstr "" -msgid "GroupsNew|Create" +msgid "GroupsNew|Create group" msgstr "" -msgid "GroupsNew|Create group" +msgid "GroupsNew|Create new group" +msgstr "" + +msgid "GroupsNew|Export groups with all their related data and move to a new GitLab instance." msgstr "" msgid "GroupsNew|GitLab source URL" msgstr "" -msgid "GroupsNew|Import" +msgid "GroupsNew|Groups can also be nested by creating %{linkStart}subgroups%{linkEnd}." msgstr "" msgid "GroupsNew|Import group" @@ -26160,9 +26163,6 @@ msgstr "" msgid "Projects shared with %{group_name}" msgstr "" -msgid "Projects that belong to a group are prefixed with the group namespace. Existing projects may be moved into a group." -msgstr "" - msgid "Projects to index" msgstr "" diff --git a/qa/qa/page/group/new.rb b/qa/qa/page/group/new.rb index 5a908266597..3687d759336 100644 --- a/qa/qa/page/group/new.rb +++ b/qa/qa/page/group/new.rb @@ -38,6 +38,14 @@ module QA fill_element(:import_gitlab_token, token) end + def click_import_group + click_on 'Import group' + end + + def click_create_group + click_on 'Create group' + end + # Connect gitlab instance # # @param [String] gitlab_url diff --git a/qa/qa/resource/group.rb b/qa/qa/resource/group.rb index a263b11c0ca..8e3431ab297 100644 --- a/qa/qa/resource/group.rb +++ b/qa/qa/resource/group.rb @@ -29,6 +29,7 @@ module QA group_show.go_to_new_subgroup Page::Group::New.perform do |group_new| + group_new.click_create_group group_new.set_path(path) group_new.set_visibility('Public') group_new.create diff --git a/qa/qa/specs/features/browser_ui/1_manage/group/create_group_with_mattermost_team_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/group/create_group_with_mattermost_team_spec.rb index 7bcc1fa4e1c..192c1a3908b 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/group/create_group_with_mattermost_team_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/group/create_group_with_mattermost_team_spec.rb @@ -10,9 +10,13 @@ module QA Page::Dashboard::Groups.perform do |groups| groups.click_new_group - expect(groups).to have_content( - /Create a Mattermost team for this group/ - ) + Page::Group::New.perform do |group_new| + group_new.click_create_group + + expect(group_new).to have_content( + /Create a Mattermost team for this group/ + ) + end end end end diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb index cdb64361549..a348008a44f 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb @@ -1,10 +1,12 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner do + # TODO: Remove `:requires_admin` meta when the feature flag is removed + RSpec.describe 'Verify', :runner, :requires_admin do describe 'Pipeline creation and processing' do let(:executor) { "qa-runner-#{Time.now.to_i}" } let(:max_wait) { 30 } + let(:feature_flag) { :ci_drop_new_builds_when_ci_quota_exceeded } let(:project) do Resource::Project.fabricate_via_api! do |project| @@ -20,8 +22,13 @@ module QA end end + before do + Runtime::Feature.enable(feature_flag, project: project) + end + after do runner.remove_via_api! + Runtime::Feature.disable(feature_flag, project: project) end it 'users creates a pipeline which gets processed', :smoke, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1849' do @@ -47,7 +54,7 @@ module QA - echo 'FAILURE' - exit 1 - test-tags: + test-tags-mismatch: tags: - invalid script: echo 'NOOP' @@ -70,7 +77,7 @@ module QA { 'test-success': :passed, 'test-failure': :failed, - 'test-tags': :pending, + 'test-tags-mismatch': :failed, 'test-artifacts': :passed }.each do |job, status| Page::Project::Pipeline::Show.perform do |pipeline| diff --git a/spec/features/dashboard/group_spec.rb b/spec/features/dashboard/group_spec.rb index bc6f449edc5..02cbdc7c777 100644 --- a/spec/features/dashboard/group_spec.rb +++ b/spec/features/dashboard/group_spec.rb @@ -16,6 +16,8 @@ RSpec.describe 'Dashboard Group' do it 'creates new group', :js do visit dashboard_groups_path find('[data-testid="new-group-button"]').click + click_link 'Create group' + new_name = 'Samurai' fill_in 'group_name', with: new_name diff --git a/spec/features/groups/import_export/connect_instance_spec.rb b/spec/features/groups/import_export/connect_instance_spec.rb index 73de49101ea..a281180c54f 100644 --- a/spec/features/groups/import_export/connect_instance_spec.rb +++ b/spec/features/groups/import_export/connect_instance_spec.rb @@ -15,7 +15,7 @@ RSpec.describe 'Import/Export - Connect to another instance', :js do visit new_group_path - find('#import-group-tab').click + click_link 'Import group' end context 'when the user provides valid credentials' do diff --git a/spec/features/groups/import_export/import_file_spec.rb b/spec/features/groups/import_export/import_file_spec.rb index 7018f3b1086..08295a3392a 100644 --- a/spec/features/groups/import_export/import_file_spec.rb +++ b/spec/features/groups/import_export/import_file_spec.rb @@ -28,9 +28,9 @@ RSpec.describe 'Import/Export - Group Import', :js do group_name = 'Test Group Import' visit new_group_path + click_link 'Import group' - fill_in :group_name, with: group_name - find('#import-group-tab').click + fill_in :import_group_name, with: group_name expect(page).to have_content 'Import group from file' attach_file(file) do @@ -51,9 +51,9 @@ RSpec.describe 'Import/Export - Group Import', :js do context 'when modifying the pre-filled path' do it 'successfully imports the group' do visit new_group_path + click_link 'Import group' - fill_in :group_name, with: 'Test Group Import' - find('#import-group-tab').click + fill_in :import_group_name, with: 'Test Group Import' fill_in :import_group_path, with: 'custom-path' attach_file(file) do @@ -74,7 +74,7 @@ RSpec.describe 'Import/Export - Group Import', :js do it 'suggests a unique path' do visit new_group_path - find('#import-group-tab').click + click_link 'Import group' fill_in :import_group_path, with: 'test-group-import' expect(page).to have_content 'Group path is already taken. Suggestions: test-group-import1' @@ -87,9 +87,9 @@ RSpec.describe 'Import/Export - Group Import', :js do it 'displays an error' do visit new_group_path + click_link 'Import group' - fill_in :group_name, with: 'Test Group Import' - find('#import-group-tab').click + fill_in :import_group_name, with: 'Test Group Import' attach_file(file) do find('.js-filepicker-button').click end diff --git a/spec/features/groups_spec.rb b/spec/features/groups_spec.rb index bcccadf7710..5f8079f0436 100644 --- a/spec/features/groups_spec.rb +++ b/spec/features/groups_spec.rb @@ -15,9 +15,10 @@ RSpec.describe 'Group' do end end - describe 'create a group' do + describe 'create a group', :js do before do visit new_group_path + click_link 'Create group' end describe 'as a non-admin' do @@ -50,13 +51,14 @@ RSpec.describe 'Group' do fill_in 'Group URL', with: 'space group' click_button 'Create group' - expect(current_path).to eq(groups_path) - expect(page).to have_namespace_error_message + expect(current_path).to eq(new_group_path) + expect(page).to have_text('Please choose a group URL with no special characters.') end end describe 'with .atom at end of group path' do it 'renders new group form with validation errors' do + fill_in 'Group name', with: 'test-group' fill_in 'Group URL', with: 'atom_group.atom' click_button 'Create group' @@ -67,6 +69,7 @@ RSpec.describe 'Group' do describe 'with .git at end of group path' do it 'renders new group form with validation errors' do + fill_in 'Group name', with: 'test-group' fill_in 'Group URL', with: 'git_group.git' click_button 'Create group' @@ -109,6 +112,7 @@ RSpec.describe 'Group' do stub_mattermost_setting(enabled: mattermost_enabled) visit new_group_path + click_link 'Create group' end context 'Mattermost enabled' do @@ -119,7 +123,7 @@ RSpec.describe 'Group' do end it 'unchecks the checkbox by default' do - expect(find('#group_create_chat_team')['checked']).to eq(false) + expect(find('#group_create_chat_team')).not_to be_checked end it 'updates the team URL on graph path update', :js do @@ -147,6 +151,7 @@ RSpec.describe 'Group' do stub_application_setting(recaptcha_enabled: true) allow(Gitlab::Recaptcha).to receive(:load_configurations!) visit new_group_path + click_link 'Create group' end it 'renders recaptcha' do @@ -159,6 +164,7 @@ RSpec.describe 'Group' do stub_feature_flags(recaptcha_on_top_level_group_creation: false) stub_application_setting(recaptcha_enabled: true) visit new_group_path + click_link 'Create group' end it 'does not render recaptcha' do @@ -167,30 +173,30 @@ RSpec.describe 'Group' do end end - describe 'create a nested group' do + describe 'create a nested group', :js do let_it_be(:group) { create(:group, path: 'foo') } context 'as admin' do let(:user) { create(:admin) } before do - visit new_group_path(group, parent_id: group.id) + visit new_group_path(parent_id: group.id) end context 'when admin mode is enabled', :enable_admin_mode do it 'creates a nested group' do + click_link 'Create group' fill_in 'Group name', with: 'bar' - fill_in 'Group URL', with: 'bar' click_button 'Create group' expect(current_path).to eq(group_path('foo/bar')) - expect(page).to have_content("Group 'bar' was successfully created.") + expect(page).to have_selector 'h1', text: 'bar' end end context 'when admin mode is disabled' do it 'is not allowed' do - expect(page).to have_gitlab_http_status(:not_found) + expect(page).not_to have_button('Create group') end end end @@ -203,14 +209,14 @@ RSpec.describe 'Group' do sign_out(:user) sign_in(user) - visit new_group_path(group, parent_id: group.id) + visit new_group_path(parent_id: group.id) + click_link 'Create group' fill_in 'Group name', with: 'bar' - fill_in 'Group URL', with: 'bar' click_button 'Create group' expect(current_path).to eq(group_path('foo/bar')) - expect(page).to have_content("Group 'bar' was successfully created.") + expect(page).to have_selector 'h1', text: 'bar' end end @@ -221,7 +227,7 @@ RSpec.describe 'Group' do end context 'when creating subgroup' do - let(:path) { new_group_path(group, parent_id: group.id) } + let(:path) { new_group_path(parent_id: group.id) } it 'does not render recaptcha' do visit path @@ -237,6 +243,7 @@ RSpec.describe 'Group' do before do group.add_owner(user) visit new_group_path(parent_id: group.id) + click_link 'Create group' end it 'shows a message if group url is available' do @@ -255,14 +262,15 @@ RSpec.describe 'Group' do end end - it 'checks permissions to avoid exposing groups by parent_id' do + it 'checks permissions to avoid exposing groups by parent_id', :js do group = create(:group, :private, path: 'secret-group') sign_out(:user) sign_in(create(:user)) visit new_group_path(parent_id: group.id) - expect(page).not_to have_content('secret-group') + expect(page).to have_title('Not Found') + expect(page).to have_content('Page Not Found') end describe 'group edit', :js do diff --git a/spec/services/merge_requests/update_service_spec.rb b/spec/services/merge_requests/update_service_spec.rb index a85fbd77d70..b62009e6cdc 100644 --- a/spec/services/merge_requests/update_service_spec.rb +++ b/spec/services/merge_requests/update_service_spec.rb @@ -768,6 +768,13 @@ RSpec.describe MergeRequests::UpdateService, :mailer do update_merge_request({ target_branch: 'target' }) end + + it "does not try to mark as unchecked if it's already unchecked" do + expect(merge_request).to receive(:unchecked?).and_return(true) + expect(merge_request).not_to receive(:mark_as_unchecked) + + update_merge_request({ target_branch: "target" }) + end end context 'when auto merge is enabled and target branch changed' do