diff options
Diffstat (limited to 'spec/features/projects/environments')
3 files changed, 16 insertions, 47 deletions
diff --git a/spec/features/projects/environments/environment_metrics_spec.rb b/spec/features/projects/environments/environment_metrics_spec.rb index e8f197b67c2..0f858c627bc 100644 --- a/spec/features/projects/environments/environment_metrics_spec.rb +++ b/spec/features/projects/environments/environment_metrics_spec.rb @@ -27,12 +27,12 @@ RSpec.describe 'Environment > Metrics' do shared_examples 'has environment selector' do it 'has a working environment selector', :js do - click_link('See metrics') + click_link 'Monitoring' expect(page).to have_current_path(project_metrics_dashboard_path(project, environment: environment.id)) - expect(page).to have_css('[data-qa-selector="environments_dropdown"]') + expect(page).to have_css('[data-qa-selector="environments_dropdown"]') # rubocop:disable QA/SelectorUsage - within('[data-qa-selector="environments_dropdown"]') do + within('[data-qa-selector="environments_dropdown"]') do # rubocop:disable QA/SelectorUsage # Click on the dropdown click_on(environment.name) @@ -55,10 +55,10 @@ RSpec.describe 'Environment > Metrics' do create(:deployment, environment: environment, deployable: build) end - it 'shows metrics' do - click_link('See metrics') + it 'shows metrics', :js do + click_link 'Monitoring' - expect(page).to have_css('div#prometheus-graphs') + expect(page).to have_css('[data-qa-selector="prometheus_graphs"]') # rubocop:disable QA/SelectorUsage end it_behaves_like 'has environment selector' diff --git a/spec/features/projects/environments/environment_spec.rb b/spec/features/projects/environments/environment_spec.rb index fea054de64e..5320f68b525 100644 --- a/spec/features/projects/environments/environment_spec.rb +++ b/spec/features/projects/environments/environment_spec.rb @@ -27,20 +27,6 @@ RSpec.describe 'Environment' do visit_environment(environment) end - it 'shows environment name' do - expect(page).to have_content(environment.name) - end - - context 'without auto-stop' do - it 'does not show auto-stop text' do - expect(page).not_to have_content('Auto stops') - end - - it 'does not show auto-stop button' do - expect(page).not_to have_selector(auto_stop_button_selector) - end - end - context 'with auto-stop' do let!(:environment) { create(:environment, :will_auto_stop, name: 'staging', project: project) } @@ -48,11 +34,11 @@ RSpec.describe 'Environment' do visit_environment(environment) end - it 'shows auto stop info' do + it 'shows auto stop info', :js do expect(page).to have_content('Auto stops') end - it 'shows auto stop button' do + it 'shows auto stop button', :js do expect(page).to have_selector(auto_stop_button_selector) expect(page.find(auto_stop_button_selector).find(:xpath, '..')['action']).to have_content(cancel_auto_stop_project_environment_path(environment.project, environment)) end @@ -80,7 +66,6 @@ RSpec.describe 'Environment' do it 'does show deployment SHA' do expect(page).to have_link(deployment.short_sha) expect(page).not_to have_link('Re-deploy') - expect(page).not_to have_terminal_button end end @@ -186,7 +171,7 @@ RSpec.describe 'Environment' do let(:build) { create(:ci_build, pipeline: pipeline) } let(:deployment) { create(:deployment, :success, environment: environment, deployable: build) } - it 'does show an external link button' do + it 'does show an external link button', :js do expect(page).to have_link(nil, href: environment.external_url) end end @@ -200,10 +185,6 @@ RSpec.describe 'Environment' do context 'for project maintainer' do let(:role) { :maintainer } - it 'shows the terminal button' do - expect(page).to have_terminal_button - end - context 'web terminal', :js do before do # Stub #terminals as it causes js-enabled feature specs to @@ -224,14 +205,6 @@ RSpec.describe 'Environment' do end end end - - context 'for developer' do - let(:role) { :developer } - - it 'does not show terminal button' do - expect(page).not_to have_terminal_button - end - end end end @@ -259,7 +232,7 @@ RSpec.describe 'Environment' do click_button('Stop') click_button('Stop environment') # confirm modal wait_for_all_requests - expect(page).to have_content('close_app') + expect(page).to have_button('Delete') end end @@ -269,7 +242,7 @@ RSpec.describe 'Environment' do name: action.ref, project: project) end - it 'does not allow to stop environment' do + it 'does not allow to stop environment', :js do expect(page).not_to have_button('Stop') end end @@ -277,7 +250,7 @@ RSpec.describe 'Environment' do context 'for reporter' do let(:role) { :reporter } - it 'does not show stop button' do + it 'does not show stop button', :js do expect(page).not_to have_button('Stop') end end @@ -287,7 +260,7 @@ RSpec.describe 'Environment' do context 'when environment is stopped' do let(:environment) { create(:environment, project: project, state: :stopped) } - it 'does not show stop button' do + it 'does not show stop button', :js do expect(page).not_to have_button('Stop') end end @@ -323,7 +296,7 @@ RSpec.describe 'Environment' do ref: 'feature') end - it 'user visits environment page' do + it 'user visits environment page', :js do visit_environment(environment) expect(page).to have_button('Stop') @@ -380,8 +353,4 @@ RSpec.describe 'Environment' do def visit_environment(environment) visit project_environment_path(environment.project, environment) end - - def have_terminal_button - have_link(nil, href: terminal_project_environment_path(project, environment)) - end end diff --git a/spec/features/projects/environments/environments_spec.rb b/spec/features/projects/environments/environments_spec.rb index 0dd4bd55d46..9413fae02e0 100644 --- a/spec/features/projects/environments/environments_spec.rb +++ b/spec/features/projects/environments/environments_spec.rb @@ -455,10 +455,10 @@ RSpec.describe 'Environments page', :js do expect(page).to have_content 'review-1' expect(page).to have_content 'review-2' within('.ci-table') do - within('[data-qa-selector="environment_item"]', text: 'review-1') do + within('[data-qa-selector="environment_item"]', text: 'review-1') do # rubocop:disable QA/SelectorUsage expect(find('.js-auto-stop').text).not_to be_empty end - within('[data-qa-selector="environment_item"]', text: 'review-2') do + within('[data-qa-selector="environment_item"]', text: 'review-2') do # rubocop:disable QA/SelectorUsage expect(find('.js-auto-stop').text).not_to be_empty end end |