diff options
Diffstat (limited to 'qa/qa/factory/resource')
-rw-r--r-- | qa/qa/factory/resource/group.rb | 22 | ||||
-rw-r--r-- | qa/qa/factory/resource/project.rb | 19 | ||||
-rw-r--r-- | qa/qa/factory/resource/sandbox.rb | 16 |
3 files changed, 33 insertions, 24 deletions
diff --git a/qa/qa/factory/resource/group.rb b/qa/qa/factory/resource/group.rb index a081cd94d39..9f13e26f35c 100644 --- a/qa/qa/factory/resource/group.rb +++ b/qa/qa/factory/resource/group.rb @@ -4,17 +4,29 @@ module QA class Group < Factory::Base attr_writer :path, :description + dependency Factory::Resource::Sandbox, as: :sandbox + def initialize @path = Runtime::Namespace.name @description = "QA test run at #{Runtime::Namespace.time}" end def fabricate! - Page::Group::New.perform do |group| - group.set_path(@path) - group.set_description(@description) - group.set_visibility('Private') - group.create + sandbox.visit! + + Page::Group::Show.perform do |page| + if page.has_subgroup?(@path) + page.go_to_subgroup(@path) + else + page.go_to_new_subgroup + + 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 diff --git a/qa/qa/factory/resource/project.rb b/qa/qa/factory/resource/project.rb index 64fcfb084bb..07c2e3086d1 100644 --- a/qa/qa/factory/resource/project.rb +++ b/qa/qa/factory/resource/project.rb @@ -6,26 +6,17 @@ module QA class Project < Factory::Base attr_writer :description + dependency Factory::Resource::Group, as: :group + def name=(name) @name = "#{name}-#{SecureRandom.hex(8)}" + @description = 'My awesome project' end def fabricate! - Factory::Resource::Sandbox.fabricate! - - Page::Group::Show.perform do |page| - if page.has_subgroup?(Runtime::Namespace.name) - page.go_to_subgroup(Runtime::Namespace.name) - else - page.go_to_new_subgroup + group.visit! - Factory::Resource::Group.fabricate! do |group| - group.path = Runtime::Namespace.name - end - end - - page.go_to_new_project - end + Page::Group::Show.act { go_to_new_project } Page::Project::New.perform do |page| page.choose_test_namespace diff --git a/qa/qa/factory/resource/sandbox.rb b/qa/qa/factory/resource/sandbox.rb index fd2177915c5..558da1c973b 100644 --- a/qa/qa/factory/resource/sandbox.rb +++ b/qa/qa/factory/resource/sandbox.rb @@ -6,18 +6,24 @@ module QA # creating it if it doesn't yet exist. # class Sandbox < Factory::Base + def initialize + @name = Runtime::Namespace.sandbox_name + end + def fabricate! 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) + if page.has_group?(@name) + page.go_to_group(@name) else page.go_to_new_group - Resource::Group.fabricate! do |group| - group.path = Runtime::Namespace.sandbox_name - group.description = 'GitLab QA Sandbox' + Page::Group::New.perform do |group| + group.set_path(@name) + group.set_description('GitLab QA Sandbox') + group.set_visibility('Private') + group.create end end end |