diff options
Diffstat (limited to 'qa/qa/specs/features/browser_ui/1_manage/group/bulk_import_group_spec.rb')
-rw-r--r-- | qa/qa/specs/features/browser_ui/1_manage/group/bulk_import_group_spec.rb | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/qa/qa/specs/features/browser_ui/1_manage/group/bulk_import_group_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/group/bulk_import_group_spec.rb index d4c4ec5611a..6c2ff005f49 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/group/bulk_import_group_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/group/bulk_import_group_spec.rb @@ -3,31 +3,33 @@ module QA RSpec.describe 'Manage', :requires_admin do describe 'Bulk group import' do - let!(:admin_api_client) { Runtime::API::Client.as_admin } - let!(:user) do + let!(:staging?) { Runtime::Scenario.gitlab_address.include?('staging.gitlab.com') } + + 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 + let(:sandbox) do Resource::Sandbox.fabricate_via_api! do |group| group.api_client = admin_api_client end end - let!(:source_group) do + let(:source_group) do Resource::Sandbox.fabricate_via_api! do |group| group.api_client = api_client group.path = "source-group-for-import-#{SecureRandom.hex(4)}" end end - let!(:subgroup) do + let(:subgroup) do Resource::Group.fabricate_via_api! do |group| group.api_client = api_client group.sandbox = source_group @@ -36,7 +38,7 @@ module QA end let(:imported_group) do - Resource::Group.new.tap do |group| + Resource::Group.init do |group| group.api_client = api_client group.sandbox = sandbox group.path = source_group.path @@ -44,25 +46,23 @@ module QA end let(:imported_subgroup) do - Resource::Group.new.tap do |group| + Resource::Group.init do |group| group.api_client = api_client group.sandbox = imported_group group.path = subgroup.path end end - def staging? - Runtime::Scenario.gitlab_address.include?('staging.gitlab.com') - end - - before(:all) do + before do Runtime::Feature.enable(:bulk_import) unless staging? Runtime::Feature.enable(:top_level_group_creation_enabled) if staging? - end - before do sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER) + # create groups explicitly before connecting gitlab instance + source_group + subgroup + Flow::Login.sign_in(as: user) Page::Main::Menu.perform(&:go_to_create_group) Page::Group::New.perform do |group| @@ -73,14 +73,10 @@ module QA # Non blocking issues: # https://gitlab.com/gitlab-org/gitlab/-/issues/331252 + # https://gitlab.com/gitlab-org/gitlab/-/issues/333678 <- can cause 500 when creating user and group back to back it( 'imports group with subgroups and labels', - testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1785', - quarantine: { - only: { job: 'relative_url' }, - issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/330344', - type: :bug - } + testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1785' ) do Resource::GroupLabel.fabricate_via_api! do |label| label.api_client = api_client @@ -96,9 +92,9 @@ module QA Page::Group::BulkImport.perform do |import_page| import_page.import_group(source_group.path, sandbox.path) - aggregate_failures do - expect(import_page).to have_imported_group(source_group.path, wait: 180) + expect(import_page).to have_imported_group(source_group.path, wait: 180) + aggregate_failures do expect { imported_group.reload! }.to eventually_eq(source_group).within(duration: 10) expect { imported_group.labels }.to eventually_include(*source_group.labels).within(duration: 10) @@ -111,9 +107,7 @@ module QA after do user.remove_via_api! - end - - after(:all) do + ensure Runtime::Feature.disable(:bulk_import) unless staging? Runtime::Feature.disable(:top_level_group_creation_enabled) if staging? end |