diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-08 00:12:55 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-08 00:12:55 +0300 |
commit | 2cf4bdd0b060175c7058b395014b101fbe6214a3 (patch) | |
tree | f3aaeca09cc434632c8eb2c2998877c3f9a2e0d9 /spec/features | |
parent | 1bdc6c89c32a7380a81598629b9ad05ba9a2a94f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/environments/environments_folder_spec.rb | 63 | ||||
-rw-r--r-- | spec/features/user_settings/active_sessions_spec.rb (renamed from spec/features/profiles/active_sessions_spec.rb) | 6 |
2 files changed, 66 insertions, 3 deletions
diff --git a/spec/features/environments/environments_folder_spec.rb b/spec/features/environments/environments_folder_spec.rb index 6b0306a70a8..9e2932e315f 100644 --- a/spec/features/environments/environments_folder_spec.rb +++ b/spec/features/environments/environments_folder_spec.rb @@ -8,11 +8,43 @@ RSpec.describe 'Environments Folder page', :js, feature_category: :environment_m let_it_be(:project) { create(:project) } let_it_be(:user) { create(:user) } let!(:envs) { create_list(:environment, 4, :with_folders, project: project, folder: folder_name) } + let!(:stopped_env) { create(:environment, :stopped, :with_folders, project: project, folder: folder_name) } def get_env_name(environment) environment.name.split('/').last end + def find_env_element(environment) + find_by_id(environment.name) + end + + def stop_environment(environment) + environment_item = find_env_element(environment) + within(environment_item) do + click_button 'Stop' + end + + within('.modal') do + click_button 'Stop environment' + end + + wait_for_requests + end + + def redeploy_environment(environment) + environment_item = find_env_element(environment) + within(environment_item) do + click_button 'More actions' + click_button 'Delete environment' + end + + within('.modal') do + click_button 'Delete environment' + end + + wait_for_requests + end + before_all do project.add_role(user, :developer) end @@ -36,6 +68,37 @@ RSpec.describe 'Environments Folder page', :js, feature_category: :environment_m expect(page).not_to have_content('production') envs.each { |env| expect(page).to have_content(get_env_name(env)) } end + + it 'shows scope tabs' do + expect(page).to have_content("Active") + expect(page).to have_content("Stopped") + end + + it 'can stop the environment' do + environment_to_stop = envs.first + + stop_environment(environment_to_stop) + + expect(page).not_to have_content(get_env_name(environment_to_stop)) + end + + describe 'stopped environments tab' do + before do + element = find('a', text: 'Stopped') + element.click + wait_for_requests + end + + it 'shows stopped environments on stopped tab' do + expect(page).to have_content(get_env_name(stopped_env)) + end + + it 'can re-start the environment' do + redeploy_environment(stopped_env) + + expect(page).not_to have_content(get_env_name(stopped_env)) + end + end end describe 'legacy folders page' do diff --git a/spec/features/profiles/active_sessions_spec.rb b/spec/features/user_settings/active_sessions_spec.rb index 2e800ae88b6..5d1d4bc6490 100644 --- a/spec/features/profiles/active_sessions_spec.rb +++ b/spec/features/user_settings/active_sessions_spec.rb @@ -55,7 +55,7 @@ RSpec.describe 'Profile > Active Sessions', :clean_gitlab_redis_shared_state, fe end using_session :session1 do - visit profile_active_sessions_path + visit user_settings_active_sessions_path expect(page).to(have_selector('ul.list-group li.list-group-item', text: 'Signed in on', count: 2)) @@ -93,7 +93,7 @@ RSpec.describe 'Profile > Active Sessions', :clean_gitlab_redis_shared_state, fe using_session :session1 do gitlab_sign_in(user) - visit profile_active_sessions_path + visit user_settings_active_sessions_path expect(page).to have_link('Revoke', count: 1) @@ -105,7 +105,7 @@ RSpec.describe 'Profile > Active Sessions', :clean_gitlab_redis_shared_state, fe end using_session :session2 do - visit profile_active_sessions_path + visit user_settings_active_sessions_path expect(page).to have_content('You need to sign in or sign up before continuing.') end |