Commit 39200f9a authored by Mark Lapierre's avatar Mark Lapierre

Merge branch 'labels-import-fix' into 'master'

E2E: Move label migration validation in to existing spec

See merge request gitlab-org/gitlab!62994
parents 97ae96a3 78f32f6f
...@@ -52,6 +52,9 @@ module QA ...@@ -52,6 +52,9 @@ module QA
# @param [String] gitlab_token # @param [String] gitlab_token
# @return [void] # @return [void]
def connect_gitlab_instance(gitlab_url, gitlab_token) def connect_gitlab_instance(gitlab_url, gitlab_token)
# Wait until element is present and refresh if not in case feature flag did not kick in
wait_until(max_duration: 10) { has_element?(:import_gitlab_url, wait: 1) }
set_gitlab_url(gitlab_url) set_gitlab_url(gitlab_url)
set_gitlab_token(gitlab_token) set_gitlab_token(gitlab_token)
......
...@@ -3,19 +3,20 @@ ...@@ -3,19 +3,20 @@
module QA 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!(: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 = 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!(:personal_access_token) { Runtime::API::Client.new(user: user).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| Resource::Sandbox.fabricate_via_api! do |group|
group.api_client = api_client group.api_client = admin_api_client
end end
end end
...@@ -61,7 +62,6 @@ module QA ...@@ -61,7 +62,6 @@ module QA
before do before do
sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER) sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER)
source_group.add_member(user, Resource::Members::AccessLevel::MAINTAINER)
Flow::Login.sign_in(as: user) Flow::Login.sign_in(as: user)
Page::Main::Menu.new.go_to_import_group Page::Main::Menu.new.go_to_import_group
...@@ -71,30 +71,13 @@ module QA ...@@ -71,30 +71,13 @@ module QA
# Non blocking issues: # Non blocking issues:
# https://gitlab.com/gitlab-org/gitlab/-/issues/331252 # https://gitlab.com/gitlab-org/gitlab/-/issues/331252
it( it(
'imports group with subgroups', 'imports group with subgroups and labels',
testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1785', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1785',
quarantine: { quarantine: {
only: { job: 'relative_url' }, only: { job: 'relative_url' },
issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/330344', issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/330344',
type: :bug type: :bug
} }
) do
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: 120)
expect { imported_group.reload! }.to eventually_eq(source_group).within(duration: 30)
expect { imported_subgroup.reload! }.to eventually_eq(subgroup).within(duration: 30)
end
end
end
it(
'imports group labels',
testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1785',
quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/331704', type: :bug }
) do ) do
Resource::GroupLabel.fabricate_via_api! do |label| Resource::GroupLabel.fabricate_via_api! do |label|
label.api_client = api_client label.api_client = api_client
...@@ -113,6 +96,9 @@ module QA ...@@ -113,6 +96,9 @@ module QA
aggregate_failures do aggregate_failures do
expect(import_page).to have_imported_group(source_group.path, wait: 120) expect(import_page).to have_imported_group(source_group.path, wait: 120)
expect { imported_group.reload! }.to eventually_eq(source_group).within(duration: 10)
expect { imported_subgroup.reload! }.to eventually_eq(subgroup).within(duration: 10)
expect { imported_group.labels }.to eventually_include(*source_group.labels).within(duration: 10) expect { imported_group.labels }.to eventually_include(*source_group.labels).within(duration: 10)
expect { imported_subgroup.labels }.to eventually_include(*subgroup.labels).within(duration: 10) expect { imported_subgroup.labels }.to eventually_include(*subgroup.labels).within(duration: 10)
end end
...@@ -121,7 +107,6 @@ module QA ...@@ -121,7 +107,6 @@ module QA
after do after do
user.remove_via_api! user.remove_via_api!
source_group.remove_via_api!
end end
after(:all) do after(:all) 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