Commit 8ed259b0 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'rs-qa-sandbox-group' into 'master'

Make use of a `gitlab-qa-sandbox` group if available

See merge request gitlab-org/gitlab-ce!14682
parents d976941a 39582078
...@@ -31,9 +31,17 @@ module QA ...@@ -31,9 +31,17 @@ module QA
# GitLab instance scenarios. # GitLab instance scenarios.
# #
module Gitlab module Gitlab
module Group
autoload :Create, 'qa/scenario/gitlab/group/create'
end
module Project module Project
autoload :Create, 'qa/scenario/gitlab/project/create' autoload :Create, 'qa/scenario/gitlab/project/create'
end end
module Sandbox
autoload :Prepare, 'qa/scenario/gitlab/sandbox/prepare'
end
end end
end end
...@@ -55,6 +63,7 @@ module QA ...@@ -55,6 +63,7 @@ module QA
end end
module Group module Group
autoload :New, 'qa/page/group/new'
autoload :Show, 'qa/page/group/show' autoload :Show, 'qa/page/group/show'
end end
......
...@@ -2,19 +2,22 @@ module QA ...@@ -2,19 +2,22 @@ module QA
module Page module Page
module Dashboard module Dashboard
class Groups < Page::Base class Groups < Page::Base
def prepare_test_namespace def filter_by_name(name)
if page.has_content?(Runtime::Namespace.name) fill_in 'Filter by name...', with: name
return click_link(Runtime::Namespace.name) end
end
click_on 'New group' def has_group?(name)
filter_by_name(name)
page.has_link?(name)
end
fill_in 'group_path', with: Runtime::Namespace.name def go_to_group(name)
fill_in 'group_description', click_link name
with: "QA test run at #{Runtime::Namespace.time}" end
choose 'Private'
click_button 'Create group' def go_to_new_group
click_on 'New group'
end end
end end
end end
......
module QA
module Page
module Group
class New < Page::Base
def set_path(path)
fill_in 'group_path', with: path
end
def set_description(description)
fill_in 'group_description', with: description
end
def set_visibility(visibility)
choose visibility
end
def create
click_button 'Create group'
end
end
end
end
end
...@@ -2,8 +2,24 @@ module QA ...@@ -2,8 +2,24 @@ module QA
module Page module Page
module Group module Group
class Show < Page::Base class Show < Page::Base
def go_to_subgroups
click_link 'Subgroups'
end
def go_to_subgroup(name)
click_link name
end
def has_subgroup?(name)
page.has_link?(name)
end
def go_to_new_subgroup
click_on 'New Subgroup'
end
def go_to_new_project def go_to_new_project
click_link 'New Project' click_on 'New Project'
end end
end end
end end
......
...@@ -10,6 +10,10 @@ module QA ...@@ -10,6 +10,10 @@ module QA
def name def name
'qa_test_' + time.strftime('%d_%m_%Y_%H-%M-%S') 'qa_test_' + time.strftime('%d_%m_%Y_%H-%M-%S')
end end
def sandbox_name
'gitlab-qa-sandbox'
end
end end
end end
end end
require 'securerandom'
module QA
module Scenario
module Gitlab
module Group
class Create < Scenario::Template
attr_writer :path, :description
def initialize
@path = Runtime::Namespace.name
@description = "QA test run at #{Runtime::Namespace.time}"
end
def perform
Page::Group::New.perform do |group|
group.set_path(@path)
group.set_description(@description)
group.set_visibility('Private')
group.create
end
end
end
end
end
end
end
...@@ -12,9 +12,23 @@ module QA ...@@ -12,9 +12,23 @@ module QA
end end
def perform def perform
Page::Main::Menu.act { go_to_groups } Scenario::Gitlab::Sandbox::Prepare.perform
Page::Dashboard::Groups.act { prepare_test_namespace }
Page::Group::Show.act { go_to_new_project } Page::Group::Show.perform do |page|
page.go_to_subgroups
if page.has_subgroup?(Runtime::Namespace.name)
page.go_to_subgroup(Runtime::Namespace.name)
else
page.go_to_new_subgroup
Scenario::Gitlab::Group::Create.perform do |group|
group.path = Runtime::Namespace.name
end
end
page.go_to_new_project
end
Page::Project::New.perform do |page| Page::Project::New.perform do |page|
page.choose_test_namespace page.choose_test_namespace
......
module QA
module Scenario
module Gitlab
module Sandbox
# Ensure we're in our sandbox namespace, either by navigating to it or
# by creating it if it doesn't yet exist
class Prepare < Scenario::Template
def perform
Page::Main::Menu.act { go_to_groups }
Page::Dashboard::Groups.perform do |page|
if page.has_group?(Runtime::Namespace.sandbox_name)
page.go_to_group(Runtime::Namespace.sandbox_name)
else
page.go_to_new_group
Scenario::Gitlab::Group::Create.perform do |group|
group.path = Runtime::Namespace.sandbox_name
group.description = 'QA sandbox'
end
end
end
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