diff options
Diffstat (limited to 'qa/qa/factory/resource/group.rb')
-rw-r--r-- | qa/qa/factory/resource/group.rb | 22 |
1 files changed, 17 insertions, 5 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 |