BigW Consortium Gitlab

Commit 743fd67f by Rémy Coutable

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

Backport QA code that belongs to CE from EE Geo Closes #40344 See merge request gitlab-org/gitlab-ce!15536
parents c4de6ec4 dabd8588
......@@ -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
......
......@@ -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
......
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
......@@ -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
......@@ -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
......
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
......@@ -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
......
......@@ -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
......
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment