summaryrefslogtreecommitdiff
path: root/qa/qa/factory/resource
diff options
context:
space:
mode:
authorAndreas Kämmerle <andreas.kaemmerle@gmail.com>2018-07-03 15:30:36 +0200
committerAndreas Kämmerle <andreas.kaemmerle@gmail.com>2018-07-03 15:30:36 +0200
commite4a310113a3a5784be863151e5bcecacb23aa244 (patch)
tree79f9019b2e001a192eae3569b5746ba9c4ec9476 /qa/qa/factory/resource
parentd505b48806c0880ac810374973c4b9ba802c26e8 (diff)
parentc489d53b2e2eecb22f8dc7034da142221220e89f (diff)
downloadgitlab-ce-e4a310113a3a5784be863151e5bcecacb23aa244.tar.gz
Merge branch 'master' of https://gitlab.com/gitlab-org/gitlab-ce into update-template-name-via-sentence-case
# Conflicts: # .gitlab/issue_templates/Feature proposal.md
Diffstat (limited to 'qa/qa/factory/resource')
-rw-r--r--qa/qa/factory/resource/branch.rb22
-rw-r--r--qa/qa/factory/resource/kubernetes_cluster.rb55
-rw-r--r--qa/qa/factory/resource/merge_request.rb4
-rw-r--r--qa/qa/factory/resource/wiki.rb25
4 files changed, 96 insertions, 10 deletions
diff --git a/qa/qa/factory/resource/branch.rb b/qa/qa/factory/resource/branch.rb
index 1785441f5a8..7fb0633ec90 100644
--- a/qa/qa/factory/resource/branch.rb
+++ b/qa/qa/factory/resource/branch.rb
@@ -31,13 +31,13 @@ module QA
def fabricate!
project.visit!
- Factory::Repository::Push.fabricate! do |resource|
+ Factory::Repository::ProjectPush.fabricate! do |resource|
resource.project = project
resource.file_name = 'kick-off.txt'
resource.commit_message = 'First commit'
end
- branch = Factory::Repository::Push.fabricate! do |resource|
+ branch = Factory::Repository::ProjectPush.fabricate! do |resource|
resource.project = project
resource.file_name = 'README.md'
resource.commit_message = 'Add readme'
@@ -46,7 +46,9 @@ module QA
resource.remote_branch = @branch_name
end
- Page::Project::Show.act { wait_for_push }
+ Page::Project::Show.perform do |page|
+ page.wait { page.has_content?(branch_name) }
+ end
# The upcoming process will make it access the Protected Branches page,
# select the already created branch and protect it according
@@ -62,13 +64,13 @@ module QA
page.select_branch(branch_name)
if allow_to_push
- page.allow_devs_and_masters_to_push
+ page.allow_devs_and_maintainers_to_push
else
page.allow_no_one_to_push
end
if allow_to_merge
- page.allow_devs_and_masters_to_merge
+ page.allow_devs_and_maintainers_to_merge
else
page.allow_no_one_to_merge
end
@@ -79,9 +81,13 @@ module QA
page.protect_branch
- # Wait for page load, which resets the expanded sections
- page.wait(reload: false) do
- !page.has_content?('Collapse')
+ # Avoid Selenium::WebDriver::Error::StaleElementReferenceError
+ # without sleeping. I.e. this completes fast on fast machines.
+ page.refresh
+
+ # It is possible for the protected branch row to "disappear" at first
+ page.wait do
+ page.has_content?(branch_name)
end
end
end
diff --git a/qa/qa/factory/resource/kubernetes_cluster.rb b/qa/qa/factory/resource/kubernetes_cluster.rb
new file mode 100644
index 00000000000..f32cf985e9d
--- /dev/null
+++ b/qa/qa/factory/resource/kubernetes_cluster.rb
@@ -0,0 +1,55 @@
+require 'securerandom'
+
+module QA
+ module Factory
+ module Resource
+ class KubernetesCluster < Factory::Base
+ attr_writer :project, :cluster,
+ :install_helm_tiller, :install_ingress, :install_prometheus, :install_runner
+
+ product :ingress_ip do
+ Page::Project::Operations::Kubernetes::Show.perform do |page|
+ page.ingress_ip
+ end
+ end
+
+ def fabricate!
+ @project.visit!
+
+ Page::Menu::Side.act { click_operations_kubernetes }
+
+ Page::Project::Operations::Kubernetes::Index.perform do |page|
+ page.add_kubernetes_cluster
+ end
+
+ Page::Project::Operations::Kubernetes::Add.perform do |page|
+ page.add_existing_cluster
+ end
+
+ Page::Project::Operations::Kubernetes::AddExisting.perform do |page|
+ page.set_cluster_name(@cluster.cluster_name)
+ page.set_api_url(@cluster.api_url)
+ page.set_ca_certificate(@cluster.ca_certificate)
+ page.set_token(@cluster.token)
+ page.add_cluster!
+ end
+
+ if @install_helm_tiller
+ Page::Project::Operations::Kubernetes::Show.perform do |page|
+ # Helm must be installed before everything else
+ page.install!(:helm)
+ page.await_installed(:helm)
+
+ page.install!(:ingress) if @install_ingress
+ page.await_installed(:ingress) if @install_ingress
+ page.install!(:prometheus) if @install_prometheus
+ page.await_installed(:prometheus) if @install_prometheus
+ page.install!(:runner) if @install_runner
+ page.await_installed(:runner) if @install_runner
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/factory/resource/merge_request.rb b/qa/qa/factory/resource/merge_request.rb
index 7588ac5735d..24d3597d993 100644
--- a/qa/qa/factory/resource/merge_request.rb
+++ b/qa/qa/factory/resource/merge_request.rb
@@ -21,14 +21,14 @@ module QA
project.name = 'project-with-merge-request'
end
- dependency Factory::Repository::Push, as: :target do |push, factory|
+ dependency Factory::Repository::ProjectPush, as: :target do |push, factory|
factory.project.visit!
push.project = factory.project
push.branch_name = 'master'
push.remote_branch = factory.target_branch
end
- dependency Factory::Repository::Push, as: :source do |push, factory|
+ dependency Factory::Repository::ProjectPush, as: :source do |push, factory|
push.project = factory.project
push.branch_name = factory.target_branch
push.remote_branch = factory.source_branch
diff --git a/qa/qa/factory/resource/wiki.rb b/qa/qa/factory/resource/wiki.rb
new file mode 100644
index 00000000000..cc200a512d5
--- /dev/null
+++ b/qa/qa/factory/resource/wiki.rb
@@ -0,0 +1,25 @@
+module QA
+ module Factory
+ module Resource
+ class Wiki < Factory::Base
+ attr_accessor :title, :content, :message
+
+ dependency Factory::Resource::Project, as: :project do |project|
+ project.name = 'project-for-wikis'
+ project.description = 'project for adding wikis'
+ end
+
+ def fabricate!
+ Page::Menu::Side.act { click_wiki }
+ Page::Project::Wiki::New.perform do |page|
+ page.go_to_create_first_page
+ page.set_title(@title)
+ page.set_content(@content)
+ page.set_message(@message)
+ page.create_new_page
+ end
+ end
+ end
+ end
+ end
+end