Commit a4b06f39 authored by Andrejs Cunskis's avatar Andrejs Cunskis Committed by Dan Davison

E2E: Remove use of create_top_level_group feature toggle in import specs

parent be3e9d52
...@@ -23,6 +23,7 @@ module QA ...@@ -23,6 +23,7 @@ module QA
groups_page.click_new_group groups_page.click_new_group
Page::Group::New.perform do |group| Page::Group::New.perform do |group|
group.click_create_group
group.set_path(path) group.set_path(path)
group.set_visibility('Public') group.set_visibility('Public')
group.create group.create
......
# frozen_string_literal: true # frozen_string_literal: true
module QA 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 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(:import_wait_duration) { { max_duration: 300, sleep_interval: 2 } }
let(:admin_api_client) { Runtime::API::Client.as_admin } let(:admin_api_client) { Runtime::API::Client.as_admin }
let(:user) do let(:user) do
...@@ -38,15 +38,11 @@ module QA ...@@ -38,15 +38,11 @@ module QA
end end
before do before do
Runtime::Feature.enable(:top_level_group_creation_enabled) if staging?
sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER) sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER)
end end
after do after do
user.remove_via_api! user.remove_via_api!
ensure
Runtime::Feature.disable(:top_level_group_creation_enabled) if staging?
end end
context 'with subgroups and labels' do context 'with subgroups and labels' do
......
# frozen_string_literal: true # frozen_string_literal: true
module QA 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 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(:import_wait_duration) { { max_duration: 300, sleep_interval: 2 } }
let(:admin_api_client) { Runtime::API::Client.as_admin } let(:admin_api_client) { Runtime::API::Client.as_admin }
let(:user) do let(:user) do
...@@ -56,7 +56,6 @@ module QA ...@@ -56,7 +56,6 @@ module QA
before do before do
Runtime::Feature.enable(:bulk_import_projects) Runtime::Feature.enable(:bulk_import_projects)
Runtime::Feature.enable(:top_level_group_creation_enabled) if staging?
sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER) sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER)
...@@ -67,7 +66,6 @@ module QA ...@@ -67,7 +66,6 @@ module QA
user.remove_via_api! user.remove_via_api!
ensure ensure
Runtime::Feature.disable(:bulk_import_projects) Runtime::Feature.disable(:bulk_import_projects)
Runtime::Feature.disable(:top_level_group_creation_enabled) if staging?
end end
context 'with project' do context 'with project' do
......
...@@ -4,17 +4,16 @@ module QA ...@@ -4,17 +4,16 @@ module QA
RSpec.describe 'Manage', :requires_admin do RSpec.describe 'Manage', :requires_admin do
describe 'Bulk group import' do describe 'Bulk group import' do
let!(:staging?) { Runtime::Scenario.gitlab_address.include?('staging.gitlab.com') } let!(:staging?) { Runtime::Scenario.gitlab_address.include?('staging.gitlab.com') }
let!(:admin_api_client) { Runtime::API::Client.as_admin }
let(:admin_api_client) { Runtime::API::Client.as_admin } let!(:user) do
let(:user) do
Resource::User.fabricate_via_api! do |usr| Resource::User.fabricate_via_api! do |usr|
usr.api_client = admin_api_client usr.api_client = admin_api_client
usr.hard_delete_on_api_removal = true usr.hard_delete_on_api_removal = true
end end
end end
let(:api_client) { Runtime::API::Client.new(user: user) } let!(:api_client) { Runtime::API::Client.new(user: user) }
let(:personal_access_token) { api_client.personal_access_token } let!(:personal_access_token) { api_client.personal_access_token }
let(:sandbox) do let(:sandbox) do
Resource::Sandbox.fabricate_via_api! do |group| Resource::Sandbox.fabricate_via_api! do |group|
...@@ -23,7 +22,9 @@ module QA ...@@ -23,7 +22,9 @@ module QA
end end
let(:source_group) do 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.api_client = api_client
group.path = "source-group-for-import-#{SecureRandom.hex(4)}" group.path = "source-group-for-import-#{SecureRandom.hex(4)}"
end end
...@@ -38,14 +39,12 @@ module QA ...@@ -38,14 +39,12 @@ module QA
end end
before do before do
Runtime::Feature.enable(:top_level_group_creation_enabled) if staging?
sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER) sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER)
# create groups explicitly before connecting gitlab instance Flow::Login.sign_in(as: user)
source_group source_group
Flow::Login.sign_in(as: user)
Page::Main::Menu.perform(&:go_to_create_group) Page::Main::Menu.perform(&:go_to_create_group)
Page::Group::New.perform do |group| Page::Group::New.perform do |group|
group.switch_to_import_tab group.switch_to_import_tab
...@@ -53,6 +52,10 @@ module QA ...@@ -53,6 +52,10 @@ module QA
end end
end end
after do
user.remove_via_api!
end
it( it(
'imports group from UI', 'imports group from UI',
testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1806', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1806',
...@@ -72,12 +75,6 @@ module QA ...@@ -72,12 +75,6 @@ module QA
end end
end end
end end
after do
user.remove_via_api!
ensure
Runtime::Feature.disable(:top_level_group_creation_enabled) if staging?
end
end end
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