Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
5abcf1ec
Commit
5abcf1ec
authored
May 25, 2021
by
Andrejs Cunskis
Committed by
Sanad Liaquat
May 25, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E2E test: Implement group comparison
parent
78412844
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
220 additions
and
73 deletions
+220
-73
qa/qa.rb
qa/qa.rb
+3
-1
qa/qa/ee.rb
qa/qa/ee.rb
+0
-1
qa/qa/ee/resource/board/board_list/group/board_list.rb
qa/qa/ee/resource/board/board_list/group/board_list.rb
+1
-1
qa/qa/ee/resource/board/board_list/project/label_board_list.rb
.../ee/resource/board/board_list/project/label_board_list.rb
+2
-4
qa/qa/ee/resource/group_label.rb
qa/qa/ee/resource/group_label.rb
+0
-50
qa/qa/resource/group_base.rb
qa/qa/resource/group_base.rb
+23
-0
qa/qa/resource/group_label.rb
qa/qa/resource/group_label.rb
+25
-0
qa/qa/resource/label_base.rb
qa/qa/resource/label_base.rb
+88
-0
qa/qa/resource/project_label.rb
qa/qa/resource/project_label.rb
+28
-0
qa/qa/specs/features/browser_ui/1_manage/group/bulk_import_group_spec.rb
...tures/browser_ui/1_manage/group/bulk_import_group_spec.rb
+22
-3
qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb
...er_ui/3_create/merge_request/create_merge_request_spec.rb
+10
-3
qa/qa/specs/features/ee/browser_ui/2_plan/scoped_labels/editing_scoped_labels_spec.rb
...ser_ui/2_plan/scoped_labels/editing_scoped_labels_spec.rb
+13
-8
qa/qa/specs/features/ee/browser_ui/secure/project_security_dashboard_spec.rb
...s/ee/browser_ui/secure/project_security_dashboard_spec.rb
+5
-2
No files found.
qa/qa.rb
View file @
5abcf1ec
...
...
@@ -73,7 +73,9 @@ module QA
autoload
:Issue
,
'qa/resource/issue'
autoload
:ProjectIssueNote
,
'qa/resource/project_issue_note'
autoload
:Project
,
'qa/resource/project'
autoload
:Label
,
'qa/resource/label'
autoload
:LabelBase
,
'qa/resource/label_base'
autoload
:ProjectLabel
,
'qa/resource/project_label'
autoload
:GroupLabel
,
'qa/resource/group_label'
autoload
:MergeRequest
,
'qa/resource/merge_request'
autoload
:ProjectImportedFromGithub
,
'qa/resource/project_imported_from_github'
autoload
:MergeRequestFromFork
,
'qa/resource/merge_request_from_fork'
...
...
qa/qa/ee.rb
View file @
5abcf1ec
...
...
@@ -211,7 +211,6 @@ module QA
module
Resource
autoload
:License
,
'qa/ee/resource/license'
autoload
:Epic
,
'qa/ee/resource/epic'
autoload
:GroupLabel
,
'qa/ee/resource/group_label'
autoload
:GroupIteration
,
'qa/ee/resource/group_iteration'
autoload
:ImportRepoWithCICD
,
'qa/ee/resource/import_repo_with_ci_cd'
autoload
:PipelineSubscriptions
,
'qa/ee/resource/pipeline_subscriptions'
...
...
qa/qa/ee/resource/board/board_list/group/board_list.rb
View file @
5abcf1ec
...
...
@@ -22,7 +22,7 @@ module QA
end
attribute
:label
do
QA
::
EE
::
Resource
::
GroupLabel
.
fabricate_via_api!
do
|
group_label
|
QA
::
Resource
::
GroupLabel
.
fabricate_via_api!
do
|
group_label
|
group_label
.
group
=
board
.
group
group_label
.
title
=
label_title
end
...
...
qa/qa/ee/resource/board/board_list/project/label_board_list.rb
View file @
5abcf1ec
...
...
@@ -8,16 +8,14 @@ module QA
module
Project
class
LabelBoardList
<
BaseBoardList
attribute
:label
do
QA
::
Resource
::
Label
.
fabricate_via_api!
do
|
label
|
QA
::
Resource
::
Project
Label
.
fabricate_via_api!
do
|
label
|
label
.
project
=
board
.
project
label
.
title
=
'Testing'
end
end
def
api_post_body
super
.
merge
({
label_id:
label
.
id
})
super
.
merge
({
label_id:
label
.
id
})
end
end
end
...
...
qa/qa/ee/resource/group_label.rb
deleted
100644 → 0
View file @
78412844
# frozen_string_literal: true
require
'securerandom'
module
QA
module
EE
module
Resource
class
GroupLabel
<
Base
attr_accessor
:description
,
:color
attribute
:id
attribute
:title
attribute
:group
do
Group
.
fabricate_via_api!
do
|
resource
|
resource
.
name
=
'group-with-label'
end
end
def
initialize
@title
=
"qa-test-
#{
SecureRandom
.
hex
(
8
)
}
"
@description
=
'This is a test group label'
@color
=
'#6655FF'
end
def
resource_web_url
(
resource
)
super
rescue
ResourceURLMissingError
# this particular resource does not expose a web_url property
end
def
api_get_path
raise
NotImplementedError
,
"The Labels API doesn't expose a single-resource endpoint so this method cannot be properly implemented."
end
def
api_post_path
"/groups/
#{
group
.
id
}
/labels"
end
def
api_post_body
{
color:
@color
,
name:
@title
,
description:
@description
}
end
end
end
end
end
qa/qa/resource/group_base.rb
View file @
5abcf1ec
...
...
@@ -14,6 +14,29 @@ module QA
attribute
:name
attribute
:full_path
# Get group labels
#
# @return [Array<QA::Resource::GroupLabel>]
def
labels
parse_body
(
api_get_from
(
"
#{
api_get_path
}
/labels"
)).
map
do
|
label
|
GroupLabel
.
new
.
tap
do
|
resource
|
resource
.
api_client
=
api_client
resource
.
group
=
self
resource
.
id
=
label
[
:id
]
resource
.
title
=
label
[
:name
]
resource
.
description
=
label
[
:description
]
resource
.
color
=
label
[
:color
]
end
end
end
# API get path
#
# @return [String]
def
api_get_path
raise
NotImplementedError
end
# API post path
#
# @return [String]
...
...
qa/qa/resource/group_label.rb
0 → 100644
View file @
5abcf1ec
# frozen_string_literal: true
module
QA
module
Resource
class
GroupLabel
<
LabelBase
attribute
:group
do
Group
.
fabricate!
do
|
resource
|
resource
.
name
=
'group-with-label'
end
end
def
fabricate!
raise
NotImplementedError
end
def
api_post_path
"/groups/
#{
group
.
id
}
/labels"
end
def
api_get_path
"/groups/
#{
group
.
id
}
/labels/
#{
id
}
"
end
end
end
end
qa/qa/resource/label.rb
→
qa/qa/resource/label
_base
.rb
View file @
5abcf1ec
...
...
@@ -4,17 +4,15 @@ require 'securerandom'
module
QA
module
Resource
class
Label
<
Base
attr_accessor
:description
,
:color
# Base label class for GroupLabel and ProjectLabel
#
class
LabelBase
<
Base
attr_accessor
:title
,
:description
,
:color
attribute
:id
attribute
:title
attribute
:project
do
Project
.
fabricate!
do
|
resource
|
resource
.
name
=
'project-with-label'
end
end
attribute
:description_html
attribute
:text_color
attribute
:subscribed
def
initialize
@title
=
"qa-test-
#{
SecureRandom
.
hex
(
8
)
}
"
...
...
@@ -23,38 +21,67 @@ module QA
end
def
fabricate!
project
.
visit!
Page
::
Project
::
Menu
.
perform
(
&
:go_to_labels
)
Page
::
Label
::
Index
.
perform
(
&
:click_new_label_button
)
Page
::
Label
::
New
.
perform
do
|
new_page
|
new_page
.
fill_title
(
@
title
)
new_page
.
fill_description
(
@
description
)
new_page
.
fill_color
(
@
color
)
new_page
.
fill_title
(
title
)
new_page
.
fill_description
(
description
)
new_page
.
fill_color
(
color
)
new_page
.
click_label_create_button
end
end
# Resource web url
#
# @param [Hash] resource
# @return [String]
def
resource_web_url
(
resource
)
super
rescue
ResourceURLMissingError
# this particular resource does not expose a web_url property
end
def
api_get_path
raise
NotImplementedError
,
"The Labels API doesn't expose a single-resource endpoint so this method cannot be properly implemented."
# Params for label creation
#
# @return [Hash]
def
api_post_body
{
name:
title
,
color:
color
,
description:
description
}
end
def
api_post_path
"/projects/
#{
project
.
id
}
/labels"
# Object comparison
#
# @param [QA::Resource::GroupBase] other
# @return [Boolean]
def
==
(
other
)
other
.
is_a?
(
LabelBase
)
&&
comparable_label
==
other
.
comparable_label
end
def
api_post_body
{
color:
@color
,
name:
@title
}
# Override inspect for a better rspec failure diff output
#
# @return [String]
def
inspect
JSON
.
pretty_generate
(
comparable_label
)
end
# protected
# Return subset of fields for comparing groups
#
# @return [Hash]
def
comparable_label
reload!
unless
api_response
api_response
.
slice
(
:name
,
:description
,
:description_html
,
:color
,
:text_color
,
:subscribed
)
end
end
end
...
...
qa/qa/resource/project_label.rb
0 → 100644
View file @
5abcf1ec
# frozen_string_literal: true
module
QA
module
Resource
class
ProjectLabel
<
LabelBase
attribute
:project
do
Project
.
fabricate!
do
|
resource
|
resource
.
name
=
'project-with-label'
end
end
def
fabricate!
project
.
visit!
Page
::
Project
::
Menu
.
perform
(
&
:go_to_labels
)
super
end
def
api_post_path
"/projects/
#{
project
.
id
}
/labels"
end
def
api_get_path
"/projects/
#{
project
.
id
}
/labels/
#{
id
}
"
end
end
end
end
qa/qa/specs/features/browser_ui/1_manage/group/bulk_import_group_spec.rb
View file @
5abcf1ec
...
...
@@ -37,8 +37,9 @@ module QA
let
(
:imported_group
)
do
Resource
::
Group
.
new
.
tap
do
|
group
|
group
.
api_client
=
api_client
group
.
sandbox
=
sandbox
group
.
path
=
source_group
.
path
end
end
.
reload!
end
let
(
:imported_subgroup
)
do
...
...
@@ -46,7 +47,7 @@ module QA
group
.
api_client
=
api_client
group
.
sandbox
=
imported_group
group
.
path
=
subgroup
.
path
end
end
.
reload!
end
def
staging?
...
...
@@ -59,6 +60,17 @@ module QA
end
before
do
Resource
::
GroupLabel
.
fabricate_via_api!
do
|
label
|
label
.
api_client
=
api_client
label
.
group
=
source_group
label
.
title
=
"source-group-
#{
SecureRandom
.
hex
(
4
)
}
"
end
Resource
::
GroupLabel
.
fabricate_via_api!
do
|
label
|
label
.
api_client
=
api_client
label
.
group
=
subgroup
label
.
title
=
"subgroup-
#{
SecureRandom
.
hex
(
4
)
}
"
end
sandbox
.
add_member
(
user
,
Resource
::
Members
::
AccessLevel
::
MAINTAINER
)
source_group
.
add_member
(
user
,
Resource
::
Members
::
AccessLevel
::
MAINTAINER
)
...
...
@@ -72,15 +84,22 @@ module QA
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1785'
,
exclude:
{
job:
[
'ce:relative_url'
,
'ee:relative_url'
]
},
issue_1:
"https://gitlab.com/gitlab-org/gitlab/-/issues/330344"
,
issue_2:
"https://gitlab.com/gitlab-org/gitlab/-/issues/331252"
issue_2:
"https://gitlab.com/gitlab-org/gitlab/-/issues/331252"
,
issue_3:
"https://gitlab.com/gitlab-org/gitlab/-/issues/331704"
)
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
).
to
eq
(
source_group
)
expect
(
imported_subgroup
).
to
eq
(
subgroup
)
# TODO: Improve validation logic with some potential retry mechanism built in to custom rspec matcher
# https://gitlab.com/gitlab-org/gitlab/-/issues/331704
# expect(imported_group.labels).to include(*source_group.labels)
expect
(
imported_subgroup
.
labels
).
to
include
(
*
subgroup
.
labels
)
end
end
end
...
...
qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb
View file @
5abcf1ec
...
...
@@ -16,7 +16,11 @@ module QA
Flow
::
Login
.
sign_in
end
it
'creates a basic merge request'
,
:smoke
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1850'
do
it
(
'creates a basic merge request'
,
:smoke
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1850'
)
do
Resource
::
MergeRequest
.
fabricate_via_browser_ui!
do
|
merge_request
|
merge_request
.
project
=
project
merge_request
.
title
=
merge_request_title
...
...
@@ -29,14 +33,17 @@ module QA
end
end
it
'creates a merge request with a milestone and label'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/514'
do
it
(
'creates a merge request with a milestone and label'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/514'
)
do
gitlab_account_username
=
"@
#{
Runtime
::
User
.
username
}
"
milestone
=
Resource
::
ProjectMilestone
.
fabricate_via_api!
do
|
milestone
|
milestone
.
project
=
project
end
label
=
Resource
::
Label
.
fabricate_via_api!
do
|
label
|
label
=
Resource
::
Project
Label
.
fabricate_via_api!
do
|
label
|
label
.
project
=
project
label
.
title
=
'label'
end
...
...
qa/qa/specs/features/ee/browser_ui/2_plan/scoped_labels/editing_scoped_labels_spec.rb
View file @
5abcf1ec
...
...
@@ -24,7 +24,7 @@ module QA
new_label_same_scope_multi_colon
,
new_label_different_scope_multi_colon
].
each
do
|
label
|
Resource
::
Label
.
fabricate_via_api!
do
|
l
|
Resource
::
Project
Label
.
fabricate_via_api!
do
|
l
|
l
.
project
=
issue
.
project
l
.
title
=
label
end
...
...
@@ -33,14 +33,19 @@ module QA
issue
.
visit!
end
it
'correctly applies simple and multiple colon scoped pairs labels'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1171'
do
it
(
'correctly applies simple and multiple colon scoped pairs labels'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1171'
)
do
Page
::
Project
::
Issue
::
Show
.
perform
do
|
show
|
show
.
select_labels_and_refresh
([
show
.
select_labels_and_refresh
(
[
new_label_same_scope
,
new_label_different_scope
,
new_label_same_scope_multi_colon
,
new_label_different_scope_multi_colon
])
]
)
aggregate_failures
do
expect
(
show
).
to
have_label
(
new_label_same_scope
)
...
...
qa/qa/specs/features/ee/browser_ui/secure/project_security_dashboard_spec.rb
View file @
5abcf1ec
...
...
@@ -54,7 +54,7 @@ module QA
end
Flow
::
Pipeline
.
wait_for_latest_pipeline
(
pipeline_condition:
'succeeded'
)
@label
=
Resource
::
Label
.
fabricate_via_api!
do
|
new_label
|
@label
=
Resource
::
Project
Label
.
fabricate_via_api!
do
|
new_label
|
new_label
.
project
=
@project
new_label
.
title
=
"test severity 3"
end
...
...
@@ -88,7 +88,10 @@ module QA
end
end
it
'creates an issue from vulnerability details'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1228'
do
it
(
'creates an issue from vulnerability details'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1228'
)
do
Page
::
Project
::
Menu
.
perform
(
&
:click_on_vulnerability_report
)
EE
::
Page
::
Project
::
Secure
::
SecurityDashboard
.
perform
do
|
security_dashboard
|
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment