diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-11-30 15:20:00 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-11-30 15:20:00 +0800 |
commit | 85be6d83be4632c76760e373da131a90afb093b9 (patch) | |
tree | 7ed7312dd8ad6e8e0ebd30b78774261c30c55d4e /qa | |
parent | 689658456f706be7278fbf50fcde9c7f43cd0655 (diff) | |
parent | f7254a4060b30e3134c6cf932eaba0fc8e249e9a (diff) | |
download | gitlab-ce-85be6d83be4632c76760e373da131a90afb093b9.tar.gz |
Merge remote-tracking branch 'upstream/master' into no-ivar-in-modules
* upstream/master: (170 commits)
support ordering of project notes in notes api
Redirect to an already forked project if it exists
Reschedule the migration to populate fork networks
Create fork networks for forks for which the source was deleted.
Fix item name and namespace text overflow in Projects dropdown
Minor backport from EE
fix link that was linking to `html` instead of `md`
Backport epic tasklist
Add timeouts for Gitaly calls
SSHUploadPack over Gitaly is now OptOut
fix icon colors in commit list
Fix star icon color/stroke
Backport border inline edit
Add checkboxes to automatically run AutoDevops pipeline
BE for automatic pipeline when enabling Auto DevOps
I am certainly weary of debugging sidekiq but I don't think that's what was meant
Ensure MRs always use branch refs for comparison
Fix issue comment submit button disabled on GFM paste
Lock seed-fu at the correct version in Gemfile.lock
Improve indexes on merge_request_diffs
...
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa.rb | 14 | ||||
-rw-r--r-- | qa/qa/page/admin/menu.rb | 7 | ||||
-rw-r--r-- | qa/qa/page/admin/settings.rb | 18 | ||||
-rw-r--r-- | qa/qa/page/base.rb | 17 | ||||
-rw-r--r-- | qa/qa/page/dashboard/projects.rb | 11 | ||||
-rw-r--r-- | qa/qa/page/main/menu.rb | 5 | ||||
-rw-r--r-- | qa/qa/page/main/oauth.rb | 15 | ||||
-rw-r--r-- | qa/qa/page/project/show.rb | 4 | ||||
-rw-r--r-- | qa/qa/scenario/bootable.rb | 2 | ||||
-rw-r--r-- | qa/qa/scenario/gitlab/admin/hashed_storage.rb | 25 | ||||
-rw-r--r-- | qa/qa/shell/omnibus.rb | 39 |
11 files changed, 153 insertions, 4 deletions
@@ -49,6 +49,10 @@ module QA module Sandbox autoload :Prepare, 'qa/scenario/gitlab/sandbox/prepare' end + + module Admin + autoload :HashedStorage, 'qa/scenario/gitlab/admin/hashed_storage' + end end end @@ -64,9 +68,11 @@ module QA autoload :Entry, 'qa/page/main/entry' autoload :Login, 'qa/page/main/login' autoload :Menu, 'qa/page/main/menu' + autoload :OAuth, 'qa/page/main/oauth' end module Dashboard + autoload :Projects, 'qa/page/dashboard/projects' autoload :Groups, 'qa/page/dashboard/groups' end @@ -82,6 +88,7 @@ module QA module Admin autoload :Menu, 'qa/page/admin/menu' + autoload :Settings, 'qa/page/admin/settings' end module Mattermost @@ -98,6 +105,13 @@ module QA end ## + # Classes describing shell interaction with GitLab + # + module Shell + autoload :Omnibus, 'qa/shell/omnibus' + end + + ## # Classes that make it possible to execute features tests. # module Specs diff --git a/qa/qa/page/admin/menu.rb b/qa/qa/page/admin/menu.rb index baa06b1c75e..dd289ffe269 100644 --- a/qa/qa/page/admin/menu.rb +++ b/qa/qa/page/admin/menu.rb @@ -3,8 +3,11 @@ module QA module Admin class Menu < Page::Base def go_to_license - link = find_link 'License' - link.click + click_link 'License' + end + + def go_to_settings + click_link 'Settings' end end end diff --git a/qa/qa/page/admin/settings.rb b/qa/qa/page/admin/settings.rb new file mode 100644 index 00000000000..39e2f2062ad --- /dev/null +++ b/qa/qa/page/admin/settings.rb @@ -0,0 +1,18 @@ +module QA + module Page + module Admin + class Settings < Page::Base + def enable_hashed_storage + scroll_to 'legend', text: 'Repository Storage' + check 'Create new projects using hashed storage paths' + end + + def save_settings + scroll_to '.form-actions' do + click_button 'Save' + end + end + end + end + end +end diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index bdddfb877c5..f9a93ef051e 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -1,3 +1,5 @@ +require 'capybara/dsl' + module QA module Page class Base @@ -7,6 +9,21 @@ module QA def refresh visit current_url end + + def scroll_to(selector, text: nil) + page.execute_script <<~JS + var elements = Array.from(document.querySelectorAll('#{selector}')); + var text = '#{text}'; + + if (text.length > 0) { + elements.find(e => e.textContent === text).scrollIntoView(); + } else { + elements[0].scrollIntoView(); + } + JS + + page.within(selector) { yield } if block_given? + end end end end diff --git a/qa/qa/page/dashboard/projects.rb b/qa/qa/page/dashboard/projects.rb new file mode 100644 index 00000000000..7ed27da6d89 --- /dev/null +++ b/qa/qa/page/dashboard/projects.rb @@ -0,0 +1,11 @@ +module QA + module Page + module Dashboard + class Projects < Page::Base + def go_to_project(name) + find_link(text: name).click + end + end + end + end +end diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb index 178c5ea6930..bc9c4ec1215 100644 --- a/qa/qa/page/main/menu.rb +++ b/qa/qa/page/main/menu.rb @@ -7,7 +7,10 @@ module QA end def go_to_projects - within_top_menu { click_link 'Projects' } + within_top_menu do + click_link 'Projects' + click_link 'Your projects' + end end def go_to_admin_area diff --git a/qa/qa/page/main/oauth.rb b/qa/qa/page/main/oauth.rb new file mode 100644 index 00000000000..e746cff0a80 --- /dev/null +++ b/qa/qa/page/main/oauth.rb @@ -0,0 +1,15 @@ +module QA + module Page + module Main + class OAuth < Page::Base + def needs_authorization? + page.current_url.include?('/oauth') + end + + def authorize! + click_button 'Authorize' + end + end + end + end +end diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 68d9597c4d2..3b2bac84f3f 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -14,6 +14,10 @@ module QA find('#project_clone').value end + def project_name + find('.project-title').text + end + def wait_for_push sleep 5 end diff --git a/qa/qa/scenario/bootable.rb b/qa/qa/scenario/bootable.rb index cf8996cd597..d6de4d404c8 100644 --- a/qa/qa/scenario/bootable.rb +++ b/qa/qa/scenario/bootable.rb @@ -28,7 +28,7 @@ module QA private - def attribute(name, arg, desc) + def attribute(name, arg, desc = '') options.push(Option.new(name, arg, desc)) end diff --git a/qa/qa/scenario/gitlab/admin/hashed_storage.rb b/qa/qa/scenario/gitlab/admin/hashed_storage.rb new file mode 100644 index 00000000000..ac2cd549829 --- /dev/null +++ b/qa/qa/scenario/gitlab/admin/hashed_storage.rb @@ -0,0 +1,25 @@ +module QA + module Scenario + module Gitlab + module Admin + class HashedStorage < Scenario::Template + def perform(*traits) + raise ArgumentError unless traits.include?(:enabled) + + Page::Main::Entry.act { visit_login_page } + Page::Main::Login.act { sign_in_using_credentials } + Page::Main::Menu.act { go_to_admin_area } + Page::Admin::Menu.act { go_to_settings } + + Page::Admin::Settings.act do + enable_hashed_storage + save_settings + end + + QA::Page::Main::Menu.act { sign_out } + end + end + end + end + end +end diff --git a/qa/qa/shell/omnibus.rb b/qa/qa/shell/omnibus.rb new file mode 100644 index 00000000000..6b3628d3109 --- /dev/null +++ b/qa/qa/shell/omnibus.rb @@ -0,0 +1,39 @@ +require 'open3' + +module QA + module Shell + class Omnibus + include Scenario::Actable + + def initialize(container) + @name = container + end + + def gitlab_ctl(command, input: nil) + if input.nil? + shell "docker exec #{@name} gitlab-ctl #{command}" + else + shell "docker exec #{@name} bash -c '#{input} | gitlab-ctl #{command}'" + end + end + + private + + ## + # TODO, make it possible to use generic QA framework classes + # as a library - gitlab-org/gitlab-qa#94 + # + def shell(command) + puts "Executing `#{command}`" + + Open3.popen2e(command) do |_in, out, wait| + out.each { |line| puts line } + + if wait.value.exited? && wait.value.exitstatus.nonzero? + raise "Docker command `#{command}` failed!" + end + end + end + end + end +end |