diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-19 14:01:45 +0300 |
commit | 9297025d0b7ddf095eb618dfaaab2ff8f2018d8b (patch) | |
tree | 865198c01d1824a9b098127baa3ab980c9cd2c06 /spec/features/explore/catalog/catalog_settings_spec.rb | |
parent | 6372471f43ee03c05a7c1f8b0c6ac6b8a7431dbe (diff) |
Add latest changes from gitlab-org/gitlab@16-7-stable-eev16.7.0-rc42
Diffstat (limited to 'spec/features/explore/catalog/catalog_settings_spec.rb')
-rw-r--r-- | spec/features/explore/catalog/catalog_settings_spec.rb | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/spec/features/explore/catalog/catalog_settings_spec.rb b/spec/features/explore/catalog/catalog_settings_spec.rb new file mode 100644 index 00000000000..bf324eafd7f --- /dev/null +++ b/spec/features/explore/catalog/catalog_settings_spec.rb @@ -0,0 +1,78 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'CI/CD Catalog settings', :js, feature_category: :pipeline_composition do + let_it_be(:user) { create(:user) } + let_it_be_with_reload(:namespace) { create(:group) } + let_it_be_with_reload(:new_project) { create(:project, :repository, namespace: namespace) } + + context 'when user is not the owner' do + before do + sign_in(user) + visit edit_project_path(new_project) + wait_for_requests + end + + it 'does not show the CI/CD toggle settings' do + expect(page).not_to have_content('CI/CD Catalog resource') + end + end + + context 'when user is the owner' do + before_all do + namespace.add_owner(user) + end + + before do + sign_in(user) + end + + it 'shows the CI/CD toggle settings' do + visit edit_project_path(new_project) + wait_for_requests + + expect(page).to have_content('CI/CD Catalog resource') + end + + describe 'when setting a project as a Catalog resource' do + before do + visit project_path(new_project) + wait_for_requests + end + + it 'adds the project to the CI/CD Catalog' do + expect(page).not_to have_content('CI/CD catalog resource') + + visit edit_project_path(new_project) + + find('[data-testid="catalog-resource-toggle"] button').click + + visit project_path(new_project) + + expect(page).to have_content('CI/CD catalog resource') + end + end + + describe 'when unlisting a project from the CI/CD Catalog' do + before do + create(:ci_catalog_resource, project: new_project, state: :published) + visit project_path(new_project) + wait_for_requests + end + + it 'removes the project to the CI/CD Catalog' do + expect(page).to have_content('CI/CD catalog resource') + + visit edit_project_path(new_project) + + find('[data-testid="catalog-resource-toggle"] button').click + click_button 'Remove from the CI/CD catalog' + + visit project_path(new_project) + + expect(page).not_to have_content('CI/CD catalog resource') + end + end + end +end |