diff options
author | Rémy Coutable <remy@rymai.me> | 2018-10-17 18:08:20 +0000 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2018-10-17 18:08:20 +0000 |
commit | b6f2f738c73b1dfe66be61e1b37ca21fa698cf1c (patch) | |
tree | b6b520d12c2051a6a1cdaa5741f48f6583e0cce8 /qa/qa/factory/resource/sandbox.rb | |
parent | ab9cf561c230f1b6ec630215a9a9def53e14d764 (diff) | |
download | gitlab-ce-b6f2f738c73b1dfe66be61e1b37ca21fa698cf1c.tar.gz |
First iteration to allow creating QA resources using the API
Diffstat (limited to 'qa/qa/factory/resource/sandbox.rb')
-rw-r--r-- | qa/qa/factory/resource/sandbox.rb | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/qa/qa/factory/resource/sandbox.rb b/qa/qa/factory/resource/sandbox.rb index 5249e1755a6..e592f4e0dd2 100644 --- a/qa/qa/factory/resource/sandbox.rb +++ b/qa/qa/factory/resource/sandbox.rb @@ -6,21 +6,28 @@ module QA # creating it if it doesn't yet exist. # class Sandbox < Factory::Base + attr_reader :path + + product :id do + true # We don't retrieve the Group ID when using the Browser UI + end + product :path + def initialize - @name = Runtime::Namespace.sandbox_name + @path = Runtime::Namespace.sandbox_name end def fabricate! Page::Main::Menu.act { go_to_groups } Page::Dashboard::Groups.perform do |page| - if page.has_group?(@name) - page.go_to_group(@name) + if page.has_group?(path) + page.go_to_group(path) else page.go_to_new_group Page::Group::New.perform do |group| - group.set_path(@name) + group.set_path(path) group.set_description('GitLab QA Sandbox Group') group.set_visibility('Public') group.create @@ -28,6 +35,28 @@ module QA end end end + + def fabricate_via_api! + resource_web_url(api_get) + rescue ResourceNotFoundError + super + end + + def api_get_path + "/groups/#{path}" + end + + def api_post_path + '/groups' + end + + def api_post_body + { + path: path, + name: path, + visibility: 'public' + } + end end end end |