summaryrefslogtreecommitdiff
path: root/spec/features
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2016-12-15 00:59:04 +0000
committerNick Thomas <nick@gitlab.com>2016-12-19 21:27:08 +0000
commit3db5b7033b13c21b904a21f751bc0f19156ea155 (patch)
tree0f5cfa65887744bb352dded9960217ae6df86ff5 /spec/features
parentc3d972f4e861059312c2708dacb57999416fcc70 (diff)
downloadgitlab-ce-3db5b7033b13c21b904a21f751bc0f19156ea155.tar.gz
Add terminal UI and controller actions
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/environment_spec.rb32
-rw-r--r--spec/features/environments_spec.rb28
2 files changed, 60 insertions, 0 deletions
diff --git a/spec/features/environment_spec.rb b/spec/features/environment_spec.rb
index 0c1939fd885..56f6cd2e095 100644
--- a/spec/features/environment_spec.rb
+++ b/spec/features/environment_spec.rb
@@ -38,6 +38,10 @@ feature 'Environment', :feature do
scenario 'does not show a re-deploy button for deployment without build' do
expect(page).not_to have_link('Re-deploy')
end
+
+ scenario 'does not show terminal button' do
+ expect(page).not_to have_terminal_button
+ end
end
context 'with related deployable present' do
@@ -60,6 +64,10 @@ feature 'Environment', :feature do
expect(page).not_to have_link('Stop')
end
+ scenario 'does not show terminal button' do
+ expect(page).not_to have_terminal_button
+ end
+
context 'with manual action' do
given(:manual) { create(:ci_build, :manual, pipeline: pipeline, name: 'deploy to production') }
@@ -84,6 +92,26 @@ feature 'Environment', :feature do
end
end
+ context 'with terminal' do
+ let(:project) { create(:kubernetes_project, :test_repo) }
+
+ context 'for project master' do
+ let(:role) { :master }
+
+ scenario 'it shows the terminal button' do
+ expect(page).to have_terminal_button
+ end
+ end
+
+ context 'for developer' do
+ let(:role) { :developer }
+
+ scenario 'does not show terminal button' do
+ expect(page).not_to have_terminal_button
+ end
+ end
+ end
+
context 'with stop action' do
given(:manual) { create(:ci_build, :manual, pipeline: pipeline, name: 'close_app') }
given(:deployment) { create(:deployment, environment: environment, deployable: build, on_stop: 'close_app') }
@@ -158,4 +186,8 @@ feature 'Environment', :feature do
environment.project,
environment)
end
+
+ def have_terminal_button
+ have_link(nil, href: terminal_namespace_project_environment_path(project.namespace, project, environment))
+ end
end
diff --git a/spec/features/environments_spec.rb b/spec/features/environments_spec.rb
index e1b97b31e5d..72b984cfab8 100644
--- a/spec/features/environments_spec.rb
+++ b/spec/features/environments_spec.rb
@@ -113,6 +113,10 @@ feature 'Environments page', :feature, :js do
expect(page).not_to have_css('external-url')
end
+ scenario 'does not show terminal button' do
+ expect(page).not_to have_terminal_button
+ end
+
context 'with external_url' do
given(:environment) { create(:environment, project: project, external_url: 'https://git.gitlab.com') }
given(:build) { create(:ci_build, pipeline: pipeline) }
@@ -145,6 +149,26 @@ feature 'Environments page', :feature, :js do
end
end
end
+
+ context 'with terminal' do
+ let(:project) { create(:kubernetes_project, :test_repo) }
+
+ context 'for project master' do
+ let(:role) { :master }
+
+ scenario 'it shows the terminal button' do
+ expect(page).to have_terminal_button
+ end
+ end
+
+ context 'for developer' do
+ let(:role) { :developer }
+
+ scenario 'does not show terminal button' do
+ expect(page).not_to have_terminal_button
+ end
+ end
+ end
end
end
end
@@ -195,6 +219,10 @@ feature 'Environments page', :feature, :js do
end
end
+ def have_terminal_button
+ have_link(nil, href: terminal_namespace_project_environment_path(project.namespace, project, environment))
+ end
+
def visit_environments(project)
visit namespace_project_environments_path(project.namespace, project)
end