Commit ed799c04 authored by Andrejs Cunskis's avatar Andrejs Cunskis

Merge branch 'acunskis-group-import-improvements' into 'master'

E2E: Validate error presence for group imports

See merge request gitlab-org/gitlab!76085
parents 946c6482 fcb55244
......@@ -68,7 +68,8 @@ module QA
path: path,
name: path,
visibility: 'public',
require_two_factor_authentication: @require_two_factor_authentication
require_two_factor_authentication: @require_two_factor_authentication,
avatar: avatar
}
end
......
......@@ -7,7 +7,7 @@ module QA
class GroupBase < Base
include Members
attr_accessor :path
attr_accessor :path, :avatar
attributes :id,
:runners_token,
......
......@@ -69,7 +69,8 @@ module QA
{
path: path,
name: path,
visibility: 'public'
visibility: 'public',
avatar: avatar
}
end
......
......@@ -26,6 +26,7 @@ module QA
Resource::Sandbox.fabricate_via_api! do |group|
group.api_client = api_client
group.path = "source-group-for-import-#{SecureRandom.hex(4)}"
group.avatar = File.new('qa/fixtures/designs/tanuki.jpg', 'r')
end
end
......@@ -37,6 +38,10 @@ module QA
end
end
let(:import_failures) do
imported_group.import_details.sum([]) { |details| details[:failures] }
end
before do
sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER)
end
......@@ -73,6 +78,8 @@ module QA
label.group = subgroup
label.title = "subgroup-#{SecureRandom.hex(4)}"
end
imported_group # trigger import
end
it(
......@@ -87,6 +94,8 @@ module QA
expect(imported_subgroup.reload!).to eq(subgroup)
expect(imported_subgroup.labels).to include(*subgroup.labels)
expect(import_failures).to be_empty, "Expected no errors, received: #{import_failures}"
end
end
end
......@@ -108,6 +117,8 @@ module QA
badge.link_url = "http://example.com/badge"
badge.image_url = "http://shields.io/badge"
end
imported_group # trigger import
end
it(
......@@ -124,6 +135,8 @@ module QA
expect(imported_milestone.updated_at).to eq(source_milestone.updated_at)
expect(imported_group.badges).to eq(source_group.badges)
expect(import_failures).to be_empty, "Expected no errors, received: #{import_failures}"
end
end
end
......@@ -139,6 +152,8 @@ module QA
before do
member.set_public_email
source_group.add_member(member, Resource::Members::AccessLevel::DEVELOPER)
imported_group # trigger import
end
after do
......@@ -153,8 +168,11 @@ module QA
imported_member = imported_group.reload!.members.find { |usr| usr.username == member.username }
expect(imported_member).not_to be_nil
expect(imported_member.access_level).to eq(Resource::Members::AccessLevel::DEVELOPER)
aggregate_failures do
expect(imported_member).not_to be_nil
expect(imported_member.access_level).to eq(Resource::Members::AccessLevel::DEVELOPER)
expect(import_failures).to be_empty, "Expected no errors, received: #{import_failures}"
end
end
end
end
......
......@@ -33,6 +33,7 @@ module QA
Resource::Sandbox.fabricate_via_api! do |group|
group.api_client = api_client
group.path = "source-group-for-import-#{SecureRandom.hex(4)}"
group.avatar = File.new('qa/fixtures/designs/tanuki.jpg', 'r')
end
end
......@@ -54,6 +55,10 @@ module QA
end
end
let(:import_failures) do
imported_group.import_details.sum([]) { |details| details[:failures] }
end
# Find epic by title
#
# @param [Array] epics
......@@ -86,6 +91,8 @@ module QA
child_epic.award_emoji('thumbsdown')
source_iteration
imported_group # trigger import
end
after do
......@@ -115,6 +122,8 @@ module QA
expect(imported_iteration.iid).to eq(source_iteration.iid)
expect(imported_iteration.created_at).to eq(source_iteration.created_at)
expect(imported_iteration.updated_at).to eq(source_iteration.updated_at)
expect(import_failures).to be_empty, "Expected no errors, received: #{import_failures}"
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