diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2018-07-10 11:11:04 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-07-10 11:11:04 +0300 |
commit | d79cef3a9a5577765d975326fbf4bc1b8c5634de (patch) | |
tree | fad8dce6f89102fda75f511dee80b7fae7675994 /spec/features/projects | |
parent | ca1deb9e5ec1429a65d73b3352d1207301f9fc6f (diff) |
Support manually stopping any environment from the UI
Diffstat (limited to 'spec/features/projects')
-rw-r--r-- | spec/features/projects/environments/environment_spec.rb | 13 | ||||
-rw-r--r-- | spec/features/projects/environments/environments_spec.rb | 12 |
2 files changed, 15 insertions, 10 deletions
diff --git a/spec/features/projects/environments/environment_spec.rb b/spec/features/projects/environments/environment_spec.rb index 0c34309c1f4..624f7139605 100644 --- a/spec/features/projects/environments/environment_spec.rb +++ b/spec/features/projects/environments/environment_spec.rb @@ -166,7 +166,8 @@ describe 'Environment' do end it 'allows to stop environment' do - click_link('Stop') + click_button('Stop') + click_button('Stop environment') # confirm modal expect(page).to have_content('close_app') end @@ -174,7 +175,7 @@ describe 'Environment' do context 'when user has no ability to stop environment' do it 'does not allow to stop environment' do - expect(page).to have_no_link('Stop') + expect(page).not_to have_button('Stop') end end @@ -182,7 +183,7 @@ describe 'Environment' do let(:role) { :reporter } it 'does not show stop button' do - expect(page).not_to have_link('Stop') + expect(page).not_to have_button('Stop') end end end @@ -192,7 +193,7 @@ describe 'Environment' do let(:environment) { create(:environment, project: project, state: :stopped) } it 'does not show stop button' do - expect(page).not_to have_link('Stop') + expect(page).not_to have_button('Stop') end end end @@ -230,7 +231,7 @@ describe 'Environment' do it 'user visits environment page' do visit_environment(environment) - expect(page).to have_link('Stop') + expect(page).to have_button('Stop') end it 'user deletes the branch with running environment' do @@ -242,7 +243,7 @@ describe 'Environment' do visit_environment(environment) - expect(page).to have_no_link('Stop') + expect(page).not_to have_button('Stop') end ## diff --git a/spec/features/projects/environments/environments_spec.rb b/spec/features/projects/environments/environments_spec.rb index 9900c13095e..c2ed753c409 100644 --- a/spec/features/projects/environments/environments_spec.rb +++ b/spec/features/projects/environments/environments_spec.rb @@ -10,6 +10,10 @@ describe 'Environments page', :js do sign_in(user) end + def stop_button_selector + %q{button[data-original-title="Stop environment"]} + end + describe 'page tabs' do it 'shows "Available" and "Stopped" tab with links' do visit_environments(project) @@ -120,7 +124,7 @@ describe 'Environments page', :js do end it 'does not show stip button when environment is not stoppable' do - expect(page).not_to have_selector('.stop-env-link') + expect(page).not_to have_selector(stop_button_selector) end end @@ -178,7 +182,7 @@ describe 'Environments page', :js do end it 'shows a stop button' do - expect(page).not_to have_selector('.stop-env-link') + expect(page).not_to have_selector(stop_button_selector) end it 'does not show external link button' do @@ -211,14 +215,14 @@ describe 'Environments page', :js do end it 'shows a stop button' do - expect(page).to have_selector('.stop-env-link') + expect(page).to have_selector(stop_button_selector) end context 'when user is a reporter' do let(:role) { :reporter } it 'does not show stop button' do - expect(page).not_to have_selector('.stop-env-link') + expect(page).not_to have_selector(stop_button_selector) end end end |