summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qa/qa.rb9
-rw-r--r--qa/qa/factory/resource/cluster.rb22
-rw-r--r--qa/qa/factory/resource/project.rb5
-rw-r--r--qa/qa/page/menu/side.rb14
-rw-r--r--qa/qa/page/project/clusters/index.rb17
-rw-r--r--qa/qa/page/project/clusters/new.rb17
-rw-r--r--qa/qa/page/project/clusters/user_provided/new.rb25
-rw-r--r--qa/qa/specs/features/project/kubernetes_spec.rb30
8 files changed, 139 insertions, 0 deletions
diff --git a/qa/qa.rb b/qa/qa.rb
index 7220af5088e..ca5c9d0a8da 100644
--- a/qa/qa.rb
+++ b/qa/qa.rb
@@ -34,6 +34,7 @@ module QA
autoload :SecretVariable, 'qa/factory/resource/secret_variable'
autoload :Runner, 'qa/factory/resource/runner'
autoload :PersonalAccessToken, 'qa/factory/resource/personal_access_token'
+ autoload :Cluster, 'qa/factory/resource/cluster'
end
module Repository
@@ -138,6 +139,14 @@ module QA
autoload :Show, 'qa/page/project/issue/show'
autoload :Index, 'qa/page/project/issue/index'
end
+
+ module Clusters
+ autoload :Index, 'qa/page/project/clusters/index'
+ autoload :New, 'qa/page/project/clusters/new'
+ module UserProvided
+ autoload :New, 'qa/page/project/clusters/user_provided/new'
+ end
+ end
end
module Profile
diff --git a/qa/qa/factory/resource/cluster.rb b/qa/qa/factory/resource/cluster.rb
new file mode 100644
index 00000000000..0b9127c1bb2
--- /dev/null
+++ b/qa/qa/factory/resource/cluster.rb
@@ -0,0 +1,22 @@
+require 'securerandom'
+
+module QA
+ module Factory
+ module Resource
+ class Cluster < Factory::Base
+
+ dependency Factory::Resource::Project, as: :project
+
+ def fabricate!
+ project.visit!
+
+ Page::Menu::Side.act { click_ci_cd_kubernetes }
+
+ Page::Project::Clusters::Index.act { go_to_new_cluster }
+
+ Page::Project::Clusters::New.act { add_an_existing_cluster }
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/factory/resource/project.rb b/qa/qa/factory/resource/project.rb
index 7df2dc6618c..0e4251c7e52 100644
--- a/qa/qa/factory/resource/project.rb
+++ b/qa/qa/factory/resource/project.rb
@@ -8,6 +8,11 @@ module QA
dependency Factory::Resource::Group, as: :group
+ def initialize
+ @name = "generated-project-name-#{SecureRandom.hex(8)}"
+ @description = "Generated project name"
+ end
+
def name=(name)
@name = "#{name}-#{SecureRandom.hex(8)}"
@description = 'My awesome project'
diff --git a/qa/qa/page/menu/side.rb b/qa/qa/page/menu/side.rb
index 7e028add2ef..911895aec7b 100644
--- a/qa/qa/page/menu/side.rb
+++ b/qa/qa/page/menu/side.rb
@@ -39,6 +39,12 @@ module QA
end
end
+ def click_ci_cd_kubernetes
+ hover_ci_cd do
+ click_link('Kubernetes')
+ end
+ end
+
def go_to_settings
within_sidebar do
click_on 'Settings'
@@ -61,6 +67,14 @@ module QA
end
end
+ def hover_ci_cd
+ within_sidebar do
+ find('.shortcuts-pipelines').hover
+
+ yield
+ end
+ end
+
def within_sidebar
page.within('.sidebar-top-level-items') do
yield
diff --git a/qa/qa/page/project/clusters/index.rb b/qa/qa/page/project/clusters/index.rb
new file mode 100644
index 00000000000..e69299802e1
--- /dev/null
+++ b/qa/qa/page/project/clusters/index.rb
@@ -0,0 +1,17 @@
+module QA
+ module Page
+ module Project
+ module Clusters
+ class Index < Page::Base
+ view 'app/views/projects/clusters/index.html.haml' do
+ element :add_cluster_link, title: 'Add Kubernetes cluster'
+ end
+
+ def go_to_new_cluster
+ click_link('Add Kubernetes cluster')
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/project/clusters/new.rb b/qa/qa/page/project/clusters/new.rb
new file mode 100644
index 00000000000..6b426c676b8
--- /dev/null
+++ b/qa/qa/page/project/clusters/new.rb
@@ -0,0 +1,17 @@
+module QA
+ module Page
+ module Project
+ module Clusters
+ class New < Page::Base
+ view 'app/views/projects/clusters/new.html.haml' do
+ element :add_cluster_link, title: 'Add an existing Kubernetes cluster'
+ end
+
+ def add_an_existing_cluster
+ click_link('Add an existing Kubernetes cluster')
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/project/clusters/user_provided/new.rb b/qa/qa/page/project/clusters/user_provided/new.rb
new file mode 100644
index 00000000000..a1bd9eb9ee7
--- /dev/null
+++ b/qa/qa/page/project/clusters/user_provided/new.rb
@@ -0,0 +1,25 @@
+module QA
+ module Page
+ module Project
+ module Clusters
+ module UserProvided
+ class New < Page::Base
+ view 'app/views/projects/clusters/new.html.haml' do
+ element :name_field, 'text_field :name'
+ element :environment_scope_field, 'text_field :environment_scope'
+ element :api_url_field, 'text_field :api_url'
+ element :ca_cert_field, 'text_field :ca_cert'
+ element :token_field, 'text_field :token'
+ element :namespace_field, 'text_field :namespace'
+ element :submit, "submit 'Add Kubernetes cluster'"
+ end
+
+ def go_to_new_cluster
+ click_link('Add Kubernetes cluster')
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/specs/features/project/kubernetes_spec.rb b/qa/qa/specs/features/project/kubernetes_spec.rb
new file mode 100644
index 00000000000..7fb66f0aa8c
--- /dev/null
+++ b/qa/qa/specs/features/project/kubernetes_spec.rb
@@ -0,0 +1,30 @@
+module QA
+ feature 'Kubernetes Applications', :core, :docker do
+ after do
+ # Destroy @created_cluster
+ end
+
+ scenario 'user deploys helm applications to kubernetes cluster' do
+ Runtime::Browser.visit(:gitlab, Page::Main::Login)
+ Page::Main::Login.act { sign_in_using_credentials }
+
+ @created_cluster = Factory::Resource::Cluster.fabricate! do |cluster|
+ end
+
+ expect(page).to have_css('h4', text: 'Applications')
+
+ #expect(page).to_not have_css('.js-cluster-application-row-helm .js-cluster-application-install-button[disabled]')
+ #Page::Project::Clusters::Show.act { install_helm_tiller }
+ #expect(page).to have_css('.js-cluster-application-row-helm .js-cluster-application-install-button[disabled]')
+ #expect(page).to have_css('.js-cluster-application-row-helm .js-cluster-application-install-button', text: 'Installed')
+ #expect(page).to_not have_css('.js-cluster-application-row-ingress .js-cluster-application-install-button[disabled]')
+ #Page::Project::Clusters::Show.act { install_ingress }
+ #expect(page).to have_css('.js-cluster-application-row-ingress .js-cluster-application-install-button[disabled]')
+ #expect(page).to have_css('.js-cluster-application-row-ingress .js-cluster-application-install-button', text: 'Installed')
+
+ #expect(page).to have_content('Ingress IP Address')
+
+ # Assert there is an HTTP server on the end of this IP address
+ end
+ end
+end