Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-29 15:06:40 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-29 15:06:40 +0300
commitd64e3a8b281d355c7d51d04df52fab407b8cc76d (patch)
tree282d6cc62eacd3fb4a0f6841ae52ae4a709e303f /qa
parent833eadad8cac85b99871842854c9a676a607e2da (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/qa.rb13
-rw-r--r--qa/qa/page/admin/settings/component/outbound_requests.rb33
-rw-r--r--qa/qa/page/admin/settings/network.rb7
-rw-r--r--qa/qa/page/main/menu.rb2
-rw-r--r--qa/qa/page/project/sub_menus/settings.rb9
-rw-r--r--qa/qa/resource/project.rb5
-rw-r--r--qa/qa/service/docker_run/jenkins.rb43
-rw-r--r--qa/qa/vendor/jenkins/page/base.rb24
-rw-r--r--qa/qa/vendor/jenkins/page/configure.rb48
-rw-r--r--qa/qa/vendor/jenkins/page/configure_job.rb62
-rw-r--r--qa/qa/vendor/jenkins/page/login.rb31
-rw-r--r--qa/qa/vendor/jenkins/page/new_credentials.rb50
-rw-r--r--qa/qa/vendor/jenkins/page/new_job.rb38
13 files changed, 363 insertions, 2 deletions
diff --git a/qa/qa.rb b/qa/qa.rb
index 17649c161ae..2c3fb6e55e3 100644
--- a/qa/qa.rb
+++ b/qa/qa.rb
@@ -331,6 +331,7 @@ module QA
module Component
autoload :IpLimits, 'qa/page/admin/settings/component/ip_limits'
+ autoload :OutboundRequests, 'qa/page/admin/settings/component/outbound_requests'
autoload :RepositoryStorage, 'qa/page/admin/settings/component/repository_storage'
autoload :AccountAndLimit, 'qa/page/admin/settings/component/account_and_limit'
autoload :PerformanceBar, 'qa/page/admin/settings/component/performance_bar'
@@ -406,6 +407,7 @@ module QA
module DockerRun
autoload :Base, 'qa/service/docker_run/base'
+ autoload :Jenkins, 'qa/service/docker_run/jenkins'
autoload :LDAP, 'qa/service/docker_run/ldap'
autoload :Maven, 'qa/service/docker_run/maven'
autoload :NodeJs, 'qa/service/docker_run/node_js'
@@ -438,6 +440,17 @@ module QA
end
end
+ module Jenkins
+ module Page
+ autoload :Base, 'qa/vendor/jenkins/page/base'
+ autoload :Login, 'qa/vendor/jenkins/page/login'
+ autoload :Configure, 'qa/vendor/jenkins/page/configure'
+ autoload :NewCredentials, 'qa/vendor/jenkins/page/new_credentials'
+ autoload :NewJob, 'qa/vendor/jenkins/page/new_job'
+ autoload :ConfigureJob, 'qa/vendor/jenkins/page/configure_job'
+ end
+ end
+
module Github
module Page
autoload :Base, 'qa/vendor/github/page/base'
diff --git a/qa/qa/page/admin/settings/component/outbound_requests.rb b/qa/qa/page/admin/settings/component/outbound_requests.rb
new file mode 100644
index 00000000000..248ea5b6715
--- /dev/null
+++ b/qa/qa/page/admin/settings/component/outbound_requests.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+module QA
+ module Page
+ module Admin
+ module Settings
+ module Component
+ class OutboundRequests < Page::Base
+ view 'app/views/admin/application_settings/_outbound.html.haml' do
+ element :allow_requests_from_services_checkbox
+ element :save_changes_button
+ end
+
+ def allow_requests_to_local_network_from_services
+ check_allow_requests_to_local_network_from_services_checkbox
+ click_save_changes_button
+ end
+
+ private
+
+ def check_allow_requests_to_local_network_from_services_checkbox
+ check_element :allow_requests_from_services_checkbox
+ end
+
+ def click_save_changes_button
+ click_element :save_changes_button
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/admin/settings/network.rb b/qa/qa/page/admin/settings/network.rb
index fdb8fcda281..83566d3d1ca 100644
--- a/qa/qa/page/admin/settings/network.rb
+++ b/qa/qa/page/admin/settings/network.rb
@@ -9,6 +9,7 @@ module QA
view 'app/views/admin/application_settings/network.html.haml' do
element :ip_limits_section
+ element :outbound_requests_section
end
def expand_ip_limits(&block)
@@ -16,6 +17,12 @@ module QA
Component::IpLimits.perform(&block)
end
end
+
+ def expand_outbound_requests(&block)
+ expand_section(:outbound_requests_section) do
+ Component::OutboundRequests.perform(&block)
+ end
+ end
end
end
end
diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb
index 024f56db8e2..49c48568e68 100644
--- a/qa/qa/page/main/menu.rb
+++ b/qa/qa/page/main/menu.rb
@@ -20,7 +20,7 @@ module QA
element :admin_area_link
element :projects_dropdown, required: true
element :groups_dropdown, required: true
- element :more_dropdown, required: true
+ element :more_dropdown
element :snippets_link
end
diff --git a/qa/qa/page/project/sub_menus/settings.rb b/qa/qa/page/project/sub_menus/settings.rb
index 1cd39fcff58..8be442ba35d 100644
--- a/qa/qa/page/project/sub_menus/settings.rb
+++ b/qa/qa/page/project/sub_menus/settings.rb
@@ -13,6 +13,7 @@ module QA
element :settings_item
element :link_members_settings
element :general_settings_link
+ element :integrations_settings_link
end
end
end
@@ -55,6 +56,14 @@ module QA
end
end
+ def go_to_integrations_settings
+ hover_settings do
+ within_submenu do
+ click_element :integrations_settings_link
+ end
+ end
+ end
+
private
def hover_settings
diff --git a/qa/qa/resource/project.rb b/qa/qa/resource/project.rb
index caaa766e982..3bebe2aaeda 100644
--- a/qa/qa/resource/project.rb
+++ b/qa/qa/resource/project.rb
@@ -9,6 +9,7 @@ module QA
include Members
attr_writer :initialize_with_readme
+ attr_writer :auto_devops_enabled
attr_writer :visibility
attribute :id
@@ -47,6 +48,7 @@ module QA
@standalone = false
@description = 'My awesome project'
@initialize_with_readme = false
+ @auto_devops_enabled = true
@visibility = 'public'
end
@@ -101,7 +103,8 @@ module QA
name: name,
description: description,
visibility: @visibility,
- initialize_with_readme: @initialize_with_readme
+ initialize_with_readme: @initialize_with_readme,
+ auto_devops_enabled: @auto_devops_enabled
}
unless @standalone
diff --git a/qa/qa/service/docker_run/jenkins.rb b/qa/qa/service/docker_run/jenkins.rb
new file mode 100644
index 00000000000..00b63282484
--- /dev/null
+++ b/qa/qa/service/docker_run/jenkins.rb
@@ -0,0 +1,43 @@
+# frozen_string_literal: true
+
+module QA
+ module Service
+ module DockerRun
+ class Jenkins < Base
+ def initialize
+ @image = 'registry.gitlab.com/gitlab-org/gitlab-qa/jenkins-gitlab:version1'
+ @name = 'jenkins-server'
+ @port = '8080'
+ super()
+ end
+
+ def host_address
+ "http://#{host_name}:#{@port}"
+ end
+
+ def host_name
+ return 'localhost' unless QA::Runtime::Env.running_in_ci?
+
+ super
+ end
+
+ def register!
+ command = <<~CMD.tr("\n", ' ')
+ docker run -d --rm
+ --network #{network}
+ --hostname #{host_name}
+ --name #{@name}
+ --env JENKINS_HOME=jenkins_home
+ --publish #{@port}:8080
+ --publish 50000:50000
+ #{@image}
+ CMD
+
+ command.gsub!("--network #{network} ", '') unless QA::Runtime::Env.running_in_ci?
+
+ shell command
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/vendor/jenkins/page/base.rb b/qa/qa/vendor/jenkins/page/base.rb
new file mode 100644
index 00000000000..8dfbe7570f8
--- /dev/null
+++ b/qa/qa/vendor/jenkins/page/base.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+module QA
+ module Vendor
+ module Jenkins
+ module Page
+ class Base
+ include Capybara::DSL
+ include Scenario::Actable
+
+ attr_reader :path
+
+ class << self
+ attr_accessor :host
+ end
+
+ def visit!
+ page.visit URI.join(Base.host, path).to_s
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/vendor/jenkins/page/configure.rb b/qa/qa/vendor/jenkins/page/configure.rb
new file mode 100644
index 00000000000..8851a2564fd
--- /dev/null
+++ b/qa/qa/vendor/jenkins/page/configure.rb
@@ -0,0 +1,48 @@
+# frozen_string_literal: true
+
+require 'capybara/dsl'
+
+module QA
+ module Vendor
+ module Jenkins
+ module Page
+ class Configure < Page::Base
+ def initialize
+ @path = 'configure'
+ end
+
+ def visit_and_setup_gitlab_connection(gitlab_host, token_description)
+ visit!
+ fill_in '_.name', with: 'GitLab'
+ find('.setting-name', text: "Gitlab host URL").find(:xpath, "..").find('input').set gitlab_host
+
+ dropdown_element = find('.setting-name', text: "Credentials").find(:xpath, "..").find('select')
+
+ QA::Support::Retrier.retry_until(exit_on_failure: true) do
+ dropdown_element.select "GitLab API token (#{token_description})"
+ dropdown_element.value != ''
+ end
+
+ yield if block_given?
+
+ click_save
+ end
+
+ def click_test_connection
+ click_on 'Test Connection'
+ end
+
+ def has_success?
+ has_css?('div.ok', text: "Success")
+ end
+
+ private
+
+ def click_save
+ click_on 'Save'
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/vendor/jenkins/page/configure_job.rb b/qa/qa/vendor/jenkins/page/configure_job.rb
new file mode 100644
index 00000000000..ab16e895fa9
--- /dev/null
+++ b/qa/qa/vendor/jenkins/page/configure_job.rb
@@ -0,0 +1,62 @@
+# frozen_string_literal: true
+
+require 'capybara/dsl'
+
+module QA
+ module Vendor
+ module Jenkins
+ module Page
+ class ConfigureJob < Page::Base
+ attr_accessor :job_name
+
+ def initialize
+ @path = "/job/#{@job_name}/configure"
+ end
+
+ def configure(scm_url:)
+ set_git_source_code_management_url(scm_url)
+ click_build_when_change_is_pushed_to_gitlab
+ set_publish_status_to_gitlab
+ click_save
+ end
+
+ private
+
+ def set_git_source_code_management_url(repository_url)
+ select_git_source_code_management
+ set_repository_url(repository_url)
+ end
+
+ def click_build_when_change_is_pushed_to_gitlab
+ find('label', text: 'Build when a change is pushed to GitLab').find(:xpath, "..").find('input').click
+ end
+
+ def set_publish_status_to_gitlab
+ click_add_post_build_action
+ select_publish_build_status_to_gitlab
+ end
+
+ def click_save
+ click_on 'Save'
+ end
+
+ def select_git_source_code_management
+ find('#radio-block-1').click
+ end
+
+ def set_repository_url(repository_url)
+ find('.setting-name', text: "Repository URL").find(:xpath, "..").find('input').set repository_url
+ end
+
+ def click_add_post_build_action
+ click_on "Add post-build action"
+ end
+
+ def select_publish_build_status_to_gitlab
+ click_link "Publish build status to GitLab"
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/vendor/jenkins/page/login.rb b/qa/qa/vendor/jenkins/page/login.rb
new file mode 100644
index 00000000000..7b3558b25e2
--- /dev/null
+++ b/qa/qa/vendor/jenkins/page/login.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+require 'capybara/dsl'
+
+module QA
+ module Vendor
+ module Jenkins
+ module Page
+ class Login < Page::Base
+ def initialize
+ @path = 'login'
+ end
+
+ def visit!
+ super
+
+ QA::Support::Retrier.retry_until(sleep_interval: 3, reload_page: page, max_attempts: 20, exit_on_failure: true) do
+ page.has_text? 'Welcome to Jenkins!'
+ end
+ end
+
+ def login
+ fill_in 'j_username', with: 'admin'
+ fill_in 'j_password', with: 'password'
+ click_on 'Sign in'
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/vendor/jenkins/page/new_credentials.rb b/qa/qa/vendor/jenkins/page/new_credentials.rb
new file mode 100644
index 00000000000..bdef1a13fd4
--- /dev/null
+++ b/qa/qa/vendor/jenkins/page/new_credentials.rb
@@ -0,0 +1,50 @@
+# frozen_string_literal: true
+
+require 'capybara/dsl'
+
+module QA
+ module Vendor
+ module Jenkins
+ module Page
+ class NewCredentials < Page::Base
+ def initialize
+ @path = 'credentials/store/system/domain/_/newCredentials'
+ end
+
+ def visit_and_set_gitlab_api_token(api_token, description)
+ visit!
+ wait_for_page_to_load
+ select_gitlab_api_token
+ set_api_token(api_token)
+ set_description(description)
+ click_ok
+ end
+
+ private
+
+ def select_gitlab_api_token
+ find('.setting-name', text: "Kind").find(:xpath, "..").find('select').select "GitLab API token"
+ end
+
+ def set_api_token(api_token)
+ fill_in '_.apiToken', with: api_token
+ end
+
+ def set_description(description)
+ fill_in '_.description', with: description
+ end
+
+ def click_ok
+ click_on 'OK'
+ end
+
+ def wait_for_page_to_load
+ QA::Support::Waiter.wait(interval: 1.0) do
+ page.has_css?('.setting-name', text: "Description")
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/vendor/jenkins/page/new_job.rb b/qa/qa/vendor/jenkins/page/new_job.rb
new file mode 100644
index 00000000000..11fa4ca8a53
--- /dev/null
+++ b/qa/qa/vendor/jenkins/page/new_job.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+require 'capybara/dsl'
+
+module QA
+ module Vendor
+ module Jenkins
+ module Page
+ class NewJob < Page::Base
+ def initialize
+ @path = 'newJob'
+ end
+
+ def visit_and_create_new_job_with_name(new_job_name)
+ visit!
+ set_new_job_name(new_job_name)
+ click_free_style_project
+ click_ok
+ end
+
+ private
+
+ def set_new_job_name(new_job_name)
+ fill_in 'name', with: new_job_name
+ end
+
+ def click_free_style_project
+ find('.hudson_model_FreeStyleProject').click
+ end
+
+ def click_ok
+ click_on 'OK'
+ end
+ end
+ end
+ end
+ end
+end