Skip to content
Snippets Groups Projects
Commit dabd8588 authored by Rémy Coutable's avatar Rémy Coutable Committed by Grzegorz Bizon
Browse files

Backport QA code that belongs to CE from EE Geo

Merge branch 'qa/gb/add-geo-integration-tests' into 'master'

See merge request gitlab-org/gitlab-ee!3294
parent 6369db01
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
 
Loading
Loading
@@ -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
 
Loading
Loading
@@ -82,6 +88,7 @@ module QA
 
module Admin
autoload :Menu, 'qa/page/admin/menu'
autoload :Settings, 'qa/page/admin/settings'
end
 
module Mattermost
Loading
Loading
@@ -97,6 +104,13 @@ module QA
autoload :Repository, 'qa/git/repository'
end
 
##
# Classes describing shell interaction with GitLab
#
module Shell
autoload :Omnibus, 'qa/shell/omnibus'
end
##
# Classes that make it possible to execute features tests.
#
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
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
require 'capybara/dsl'
module QA
module Page
class Base
Loading
Loading
@@ -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
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
Loading
Loading
@@ -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
Loading
Loading
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
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
 
Loading
Loading
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
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment