Commit 2e8cd2ed authored by Dan Davison's avatar Dan Davison

Merge branch 'acunskis-top-level-group-fix' into 'master'

E2E: Remove use of create_top_level_group feature toggle in import specs

See merge request gitlab-org/gitlab!74167
parents 7f9a6419 a4b06f39
......@@ -23,6 +23,7 @@ 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
......
# frozen_string_literal: true
module QA
RSpec.describe 'Manage', :requires_admin do
# run only base UI validation on staging because test requires top level group creation which is problematic
# on staging environment
RSpec.describe 'Manage', :requires_admin, except: { subdomain: :staging } do
describe 'Bulk group import' do
let!(:staging?) { Runtime::Scenario.gitlab_address.include?('staging.gitlab.com') }
let(:import_wait_duration) { { max_duration: 300, sleep_interval: 2 } }
let(:admin_api_client) { Runtime::API::Client.as_admin }
let(:user) do
......@@ -38,15 +38,11 @@ module QA
end
before do
Runtime::Feature.enable(:top_level_group_creation_enabled) if staging?
sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER)
end
after do
user.remove_via_api!
ensure
Runtime::Feature.disable(:top_level_group_creation_enabled) if staging?
end
context 'with subgroups and labels' do
......
# frozen_string_literal: true
module QA
RSpec.describe 'Manage', :requires_admin do
# run only base UI validation on staging because test requires top level group creation which is problematic
# on staging environment
RSpec.describe 'Manage', :requires_admin, except: { subdomain: :staging } do
describe 'Bulk project import' do
let!(:staging?) { Runtime::Scenario.gitlab_address.include?('staging.gitlab.com') }
let(:import_wait_duration) { { max_duration: 300, sleep_interval: 2 } }
let(:admin_api_client) { Runtime::API::Client.as_admin }
let(:user) do
......@@ -57,7 +57,6 @@ module QA
before do
Runtime::Feature.enable(:bulk_import_projects)
Runtime::Feature.enable(:top_level_group_creation_enabled) if staging?
sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER)
......@@ -68,7 +67,6 @@ module QA
user.remove_via_api!
ensure
Runtime::Feature.disable(:bulk_import_projects)
Runtime::Feature.disable(:top_level_group_creation_enabled) if staging?
end
context 'with project' do
......
......@@ -4,17 +4,16 @@ module QA
RSpec.describe 'Manage', :requires_admin do
describe 'Bulk group import' do
let!(:staging?) { Runtime::Scenario.gitlab_address.include?('staging.gitlab.com') }
let(:admin_api_client) { Runtime::API::Client.as_admin }
let(:user) do
let!(:admin_api_client) { Runtime::API::Client.as_admin }
let!(:user) do
Resource::User.fabricate_via_api! do |usr|
usr.api_client = admin_api_client
usr.hard_delete_on_api_removal = true
end
end
let(:api_client) { Runtime::API::Client.new(user: user) }
let(:personal_access_token) { api_client.personal_access_token }
let!(:api_client) { Runtime::API::Client.new(user: user) }
let!(:personal_access_token) { api_client.personal_access_token }
let(:sandbox) do
Resource::Sandbox.fabricate_via_api! do |group|
......@@ -23,7 +22,9 @@ module QA
end
let(:source_group) do
Resource::Sandbox.fabricate_via_api! do |group|
# 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|
group.api_client = api_client
group.path = "source-group-for-import-#{SecureRandom.hex(4)}"
end
......@@ -38,14 +39,12 @@ module QA
end
before do
Runtime::Feature.enable(:top_level_group_creation_enabled) if staging?
sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER)
# create groups explicitly before connecting gitlab instance
Flow::Login.sign_in(as: user)
source_group
Flow::Login.sign_in(as: user)
Page::Main::Menu.perform(&:go_to_create_group)
Page::Group::New.perform do |group|
group.switch_to_import_tab
......@@ -53,6 +52,10 @@ module QA
end
end
after do
user.remove_via_api!
end
it(
'imports group from UI',
testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1806',
......@@ -72,12 +75,6 @@ module QA
end
end
end
after do
user.remove_via_api!
ensure
Runtime::Feature.disable(:top_level_group_creation_enabled) if staging?
end
end
end
end
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