Commit e7405d7e authored by Andrejs Cunskis's avatar Andrejs Cunskis Committed by Mark Lapierre

E2E: Create top level group via UI on dot_com environment

parent e10e31d5
......@@ -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
......
......@@ -22,9 +22,7 @@ module QA
end
let(:source_group) do
# top level group can't be created on staging via api, create via UI
fabricate_method = staging? ? :fabricate_via_browser_ui! : :fabricate_via_api!
Resource::Sandbox.send(fabricate_method) do |group|
Resource::Sandbox.fabricate! do |group|
group.api_client = api_client
group.path = "source-group-for-import-#{SecureRandom.hex(4)}"
end
......
# frozen_string_literal: true
module QA
# This test is disabled on staging and production due to `top_level_group_creation_enabled` set to false.
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/324808#note_531060031
RSpec.describe 'Manage', quarantine: { only: [:staging, :production], issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/324808', type: :waiting_on } do
RSpec.describe 'Manage' do
describe 'prevent forking outside group' do
let!(:group_for_fork) do
Resource::Sandbox.fabricate_via_api! do |sandbox_group|
Resource::Sandbox.fabricate! do |sandbox_group|
sandbox_group.path = "group_for_fork_#{SecureRandom.hex(8)}"
end
end
......
# frozen_string_literal: true
module QA
# This test is disabled on staging and production due to `top_level_group_creation_enabled` set to false.
# See: https://gitlab.com/gitlab-org/gitlab/-/issues/342329#note_696599160
# When FF enabled, the test is failing with https://gitlab.com/gitlab-org/gitlab/-/issues/342523
RSpec.describe 'Package', :orchestrated, :group_saml, :requires_admin, quarantine: { only: [:staging, :production], issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/342523', type: :investigating } do
RSpec.describe 'Package', :orchestrated, :group_saml, :requires_admin do
describe 'Dependency Proxy Group SSO' do
include Support::API
let!(:group) do
Resource::Sandbox.fabricate_via_api! do |sandbox_group|
Resource::Sandbox.fabricate! do |sandbox_group|
sandbox_group.path = "saml_sso_group_with_dependency_proxy_#{SecureRandom.hex(8)}"
end
end
......@@ -81,12 +78,12 @@ module QA
commit.project = project
commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files([{
file_path: '.gitlab-ci.yml',
content:
file_path: '.gitlab-ci.yml',
content:
<<~YAML
dependency-proxy-pull-test:
image: "docker:stable"
services:
services:
- name: "docker:stable-dind"
command: ["--insecure-registry=#{gitlab_host_with_port}"]
before_script:
......@@ -101,7 +98,7 @@ module QA
tags:
- "runner-for-#{project.name}"
YAML
}])
}])
end
project.visit!
......@@ -127,7 +124,7 @@ module QA
end
def visit_group_sso_url
Runtime::Logger.debug(%Q[Visiting managed_group_url at "#{group_sso_url}"])
Runtime::Logger.debug(%(Visiting managed_group_url at "#{group_sso_url}"))
page.visit group_sso_url
Support::Waiter.wait_until { current_url == group_sso_url }
......
......@@ -15,7 +15,7 @@ module QA
end
let(:group) do
Resource::Sandbox.fabricate_via_api! do |sandbox|
Resource::Sandbox.fabricate! do |sandbox|
sandbox.path = "gitlab-qa-group-#{hash}"
sandbox.api_client = Runtime::API::Client.as_admin
end
......
......@@ -17,15 +17,13 @@ module QA
# after the test runs since GitLab will not allow deletion of a group
# that has a Subscription attached
let(:group) do
Resource::Sandbox.fabricate_via_api! do |sandbox|
Resource::Sandbox.fabricate! do |sandbox|
sandbox.path = "gitlab-qa-group-#{hash}"
sandbox.api_client = Runtime::API::Client.as_admin
end
end
before do
Runtime::Feature.enable(:top_level_group_creation_enabled)
group.add_member(user, Resource::Members::AccessLevel::OWNER)
Flow::Login.sign_in(as: user)
......@@ -34,8 +32,6 @@ module QA
after do
user.remove_via_api!
Runtime::Feature.disable(:top_level_group_creation_enabled)
end
it 'upgrades from free to ultimate', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1882' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment