summaryrefslogtreecommitdiff
path: root/qa/qa/factory/resource/sandbox.rb
blob: ad376988e82daf12ce66dfe5b569e73059421efc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module QA
  module Factory
    module Resource
      ##
      # Ensure we're in our sandbox namespace, either by navigating to it or by
      # creating it if it doesn't yet exist.
      #
      class Sandbox < Factory::Base
        def initialize
          @name = Runtime::Namespace.sandbox_name
        end

        def fabricate!
          Page::Menu::Main.act { go_to_groups }

          Page::Dashboard::Groups.perform do |page|
            if page.has_group?(@name)
              page.go_to_group(@name)
            else
              page.go_to_new_group

              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
        end
      end
    end
  end
end