summaryrefslogtreecommitdiff
path: root/qa/qa/resource/sandbox.rb
diff options
context:
space:
mode:
Diffstat (limited to 'qa/qa/resource/sandbox.rb')
-rw-r--r--qa/qa/resource/sandbox.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/qa/qa/resource/sandbox.rb b/qa/qa/resource/sandbox.rb
index b351d78a184..385e0fa4f7e 100644
--- a/qa/qa/resource/sandbox.rb
+++ b/qa/qa/resource/sandbox.rb
@@ -7,6 +7,17 @@ module QA
# creating it if it doesn't yet exist.
#
class Sandbox < GroupBase
+ class << self
+ # Force top level group creation via UI if test is executed on dot_com environment
+ def fabricate!(*args, &prepare_block)
+ return fabricate_via_browser_ui!(*args, &prepare_block) if Specs::Helpers::ContextSelector.dot_com?
+
+ fabricate_via_api!(*args, &prepare_block)
+ rescue NotImplementedError
+ fabricate_via_browser_ui!(*args, &prepare_block)
+ end
+ end
+
def initialize
@path = Runtime::Namespace.sandbox_name
end
@@ -14,6 +25,8 @@ module QA
alias_method :full_path, :path
def fabricate!
+ Flow::Login.sign_in_unless_signed_in
+
Page::Main::Menu.perform(&:go_to_groups)
Page::Dashboard::Groups.perform do |groups_page|
@@ -23,10 +36,13 @@ module QA
groups_page.click_new_group
Page::Group::New.perform do |group|
+ group.click_create_group
group.set_path(path)
group.set_visibility('Public')
group.create
end
+
+ @id = Page::Group::Show.perform(&:group_id)
end
end
end