diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-13 15:10:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-13 15:10:58 +0300 |
commit | d7ba2e953a7ee4c8ddcd2e5663f369eb5ecbcd72 (patch) | |
tree | 5901bab2c6f1de6f968c903efaba7cdd072158a0 /spec/features | |
parent | da12067d6bb2603f40d2de107df70e2ff03630e8 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
3 files changed, 23 insertions, 98 deletions
diff --git a/spec/features/admin/admin_manage_applications_spec.rb b/spec/features/admin/admin_manage_applications_spec.rb index e54837ede11..b6437fce540 100644 --- a/spec/features/admin/admin_manage_applications_spec.rb +++ b/spec/features/admin/admin_manage_applications_spec.rb @@ -3,62 +3,14 @@ require 'spec_helper' RSpec.describe 'admin manage applications' do + let_it_be(:new_application_path) { new_admin_application_path } + let_it_be(:applications_path) { admin_applications_path } + before do admin = create(:admin) sign_in(admin) gitlab_enable_admin_mode_sign_in(admin) end - it 'creates new oauth application' do - visit admin_applications_path - - click_on 'New application' - expect(page).to have_content('New application') - - fill_in :doorkeeper_application_name, with: 'test' - fill_in :doorkeeper_application_redirect_uri, with: 'https://test.com' - check :doorkeeper_application_trusted - check :doorkeeper_application_scopes_read_user - click_on 'Submit' - expect(page).to have_content('Application: test') - expect(page).to have_content('Application ID') - expect(page).to have_content('Secret') - expect(page).to have_content('Trusted Y') - expect(page).to have_content('Confidential Y') - - click_on 'Edit' - expect(page).to have_content('Edit application') - - fill_in :doorkeeper_application_name, with: 'test_changed' - uncheck :doorkeeper_application_trusted - uncheck :doorkeeper_application_confidential - - click_on 'Submit' - expect(page).to have_content('test_changed') - expect(page).to have_content('Application ID') - expect(page).to have_content('Secret') - expect(page).to have_content('Trusted N') - expect(page).to have_content('Confidential N') - - visit admin_applications_path - page.within '.oauth-applications' do - click_on 'Destroy' - end - expect(page.find('.oauth-applications')).not_to have_content('test_changed') - end - - context 'when scopes are blank' do - it 'returns an error' do - visit admin_applications_path - - click_on 'New application' - expect(page).to have_content('New application') - - fill_in :doorkeeper_application_name, with: 'test' - fill_in :doorkeeper_application_redirect_uri, with: 'https://test.com' - click_on 'Submit' - - expect(page).to have_content("Scopes can't be blank") - end - end + include_examples 'manage applications' end diff --git a/spec/features/groups/settings/manage_applications_spec.rb b/spec/features/groups/settings/manage_applications_spec.rb new file mode 100644 index 00000000000..5f84f61678d --- /dev/null +++ b/spec/features/groups/settings/manage_applications_spec.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'User manages applications' do + let_it_be(:group) { create(:group) } + let_it_be(:user) { create(:user) } + let_it_be(:new_application_path) { group_settings_applications_path(group) } + + before do + group.add_owner(user) + sign_in(user) + end + + include_examples 'manage applications' +end diff --git a/spec/features/profiles/user_manages_applications_spec.rb b/spec/features/profiles/user_manages_applications_spec.rb index 22eed748c00..c76ef2613fd 100644 --- a/spec/features/profiles/user_manages_applications_spec.rb +++ b/spec/features/profiles/user_manages_applications_spec.rb @@ -3,55 +3,12 @@ require 'spec_helper' RSpec.describe 'User manages applications' do - let(:user) { create(:user) } + let_it_be(:user) { create(:user) } + let_it_be(:new_application_path) { applications_profile_path } before do sign_in(user) - visit applications_profile_path end - it 'manages applications' do - expect(page).to have_content 'Add new application' - - fill_in :doorkeeper_application_name, with: 'test' - fill_in :doorkeeper_application_redirect_uri, with: 'https://test.com' - check :doorkeeper_application_scopes_read_user - click_on 'Save application' - - expect(page).to have_content 'Application: test' - expect(page).to have_content 'Application ID' - expect(page).to have_content 'Secret' - expect(page).to have_content 'Confidential Yes' - - click_on 'Edit' - - expect(page).to have_content 'Edit application' - fill_in :doorkeeper_application_name, with: 'test_changed' - uncheck :doorkeeper_application_confidential - click_on 'Save application' - - expect(page).to have_content 'test_changed' - expect(page).to have_content 'Application ID' - expect(page).to have_content 'Secret' - expect(page).to have_content 'Confidential No' - - visit applications_profile_path - - page.within '.oauth-applications' do - click_on 'Destroy' - end - expect(page.find('.oauth-applications')).not_to have_content 'test_changed' - end - - context 'when scopes are blank' do - it 'returns an error' do - expect(page).to have_content 'Add new application' - - fill_in :doorkeeper_application_name, with: 'test' - fill_in :doorkeeper_application_redirect_uri, with: 'https://test.com' - click_on 'Save application' - - expect(page).to have_content("Scopes can't be blank") - end - end + include_examples 'manage applications' end |