diff options
Diffstat (limited to 'spec/features/admin/admin_deploy_keys_spec.rb')
-rw-r--r-- | spec/features/admin/admin_deploy_keys_spec.rb | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/spec/features/admin/admin_deploy_keys_spec.rb b/spec/features/admin/admin_deploy_keys_spec.rb index c326d0fd741..53caf0fac33 100644 --- a/spec/features/admin/admin_deploy_keys_spec.rb +++ b/spec/features/admin/admin_deploy_keys_spec.rb @@ -3,11 +3,13 @@ require 'spec_helper' RSpec.describe 'admin deploy keys' do + let_it_be(:admin) { create(:admin) } + let!(:deploy_key) { create(:deploy_key, public: true) } let!(:another_deploy_key) { create(:another_deploy_key, public: true) } before do - admin = create(:admin) + stub_feature_flags(admin_deploy_keys_vue: false) sign_in(admin) gitlab_enable_admin_mode_sign_in(admin) end @@ -15,7 +17,7 @@ RSpec.describe 'admin deploy keys' do it 'show all public deploy keys' do visit admin_deploy_keys_path - page.within(find('.deploy-keys-list', match: :first)) do + page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do expect(page).to have_content(deploy_key.title) expect(page).to have_content(another_deploy_key.title) end @@ -26,7 +28,7 @@ RSpec.describe 'admin deploy keys' do visit admin_deploy_keys_path - page.within(find('.deploy-keys-list', match: :first)) do + page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do expect(page).to have_content(write_key.project.full_name) end end @@ -46,7 +48,7 @@ RSpec.describe 'admin deploy keys' do expect(current_path).to eq admin_deploy_keys_path - page.within(find('.deploy-keys-list', match: :first)) do + page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do expect(page).to have_content('laptop') end end @@ -64,7 +66,7 @@ RSpec.describe 'admin deploy keys' do expect(current_path).to eq admin_deploy_keys_path - page.within(find('.deploy-keys-list', match: :first)) do + page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do expect(page).to have_content('new-title') end end @@ -79,9 +81,23 @@ RSpec.describe 'admin deploy keys' do find('tr', text: deploy_key.title).click_link('Remove') expect(current_path).to eq admin_deploy_keys_path - page.within(find('.deploy-keys-list', match: :first)) do + page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do expect(page).not_to have_content(deploy_key.title) end end end + + context 'when `admin_deploy_keys_vue` feature flag is enabled', :js do + before do + stub_feature_flags(admin_deploy_keys_vue: true) + + visit admin_deploy_keys_path + end + + it 'renders the Vue app', :aggregate_failures do + expect(page).to have_content('Public deploy keys') + expect(page).to have_selector('[data-testid="deploy-keys-list"]') + expect(page).to have_link('New deploy key', href: new_admin_deploy_key_path) + end + end end |