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
88b727d7
Commit
88b727d7
authored
Aug 29, 2019
by
Mark Lapierre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CE backport of EE MR approvals E2E test
Includes API methods to add members to projects and groups
parent
34357e03
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
8 deletions
+45
-8
doc/development/testing_guide/end_to_end/page_objects.md
doc/development/testing_guide/end_to_end/page_objects.md
+12
-0
qa/qa/page/main/menu.rb
qa/qa/page/main/menu.rb
+4
-0
qa/qa/page/merge_request/new.rb
qa/qa/page/merge_request/new.rb
+2
-0
qa/qa/resource/group.rb
qa/qa/resource/group.rb
+6
-0
qa/qa/resource/merge_request.rb
qa/qa/resource/merge_request.rb
+11
-8
qa/qa/resource/project.rb
qa/qa/resource/project.rb
+9
-0
qa/qa/resource/user.rb
qa/qa/resource/user.rb
+1
-0
No files found.
doc/development/testing_guide/end_to_end/page_objects.md
View file @
88b727d7
...
...
@@ -167,6 +167,18 @@ There are two supported methods of defining elements within a view.
Any existing
`.qa-selector`
class should be considered deprecated
and we should prefer the
`data-qa-selector`
method of definition.
### Exceptions
In some cases it might not be possible or worthwhile to add a selector.
Some UI components use external libraries, including some maintained by third parties.
Even if a library is maintained by GitLab, the selector sanity test only runs
on code within the GitLab project, so it's not possible to specify the path for
the view for code in a library.
In such rare cases it's reasonable to use CSS selectors in page object methods,
with a comment explaining why an
`element`
can't be added.
## Running the test locally
During development, you can run the
`qa:selectors`
test by running
...
...
qa/qa/page/main/menu.rb
View file @
88b727d7
...
...
@@ -61,6 +61,10 @@ module QA
end
end
def
sign_out_if_signed_in
sign_out
if
has_personal_area?
(
wait:
0
)
end
def
click_settings_link
retry_until
(
reload:
false
)
do
within_user_menu
do
...
...
qa/qa/page/merge_request/new.rb
View file @
88b727d7
...
...
@@ -64,3 +64,5 @@ module QA
end
end
end
QA
::
Page
::
MergeRequest
::
New
.
prepend_if_ee
(
'QA::EE::Page::MergeRequest::New'
)
qa/qa/resource/group.rb
View file @
88b727d7
...
...
@@ -10,6 +10,7 @@ module QA
end
attribute
:id
attribute
:name
def
initialize
@path
=
Runtime
::
Namespace
.
name
...
...
@@ -47,6 +48,11 @@ module QA
super
end
def
add_member
(
user
,
access_level
=
'30'
)
# 30 = developer access
post
Runtime
::
API
::
Request
.
new
(
api_client
,
api_members_path
).
url
,
{
user_id:
user
.
id
,
access_level:
access_level
}
end
def
api_get_path
"/groups/
#{
CGI
.
escape
(
"
#{
sandbox
.
path
}
/
#{
path
}
"
)
}
"
end
...
...
qa/qa/resource/merge_request.rb
View file @
88b727d7
...
...
@@ -5,7 +5,8 @@ require 'securerandom'
module
QA
module
Resource
class
MergeRequest
<
Base
attr_accessor
:id
,
attr_accessor
:approval_rules
,
:id
,
:title
,
:description
,
:source_branch
,
...
...
@@ -46,6 +47,7 @@ module QA
end
def
initialize
@approval_rules
=
nil
@title
=
'QA test - merge request'
@description
=
'This is a test merge request'
@source_branch
=
"qa-test-feature-
#{
SecureRandom
.
hex
(
8
)
}
"
...
...
@@ -63,16 +65,17 @@ module QA
project
.
visit!
Page
::
Project
::
Show
.
perform
(
&
:new_merge_request
)
Page
::
MergeRequest
::
New
.
perform
do
|
page
|
page
.
fill_title
(
@title
)
page
.
fill_description
(
@description
)
page
.
choose_milestone
(
@milestone
)
if
@milestone
page
.
assign_to_me
if
@assignee
==
'me'
Page
::
MergeRequest
::
New
.
perform
do
|
new
|
new
.
fill_title
(
@title
)
new
.
fill_description
(
@description
)
new
.
choose_milestone
(
@milestone
)
if
@milestone
new
.
assign_to_me
if
@assignee
==
'me'
labels
.
each
do
|
label
|
page
.
select_label
(
label
)
new
.
select_label
(
label
)
end
new
.
add_approval_rules
(
approval_rules
)
if
approval_rules
page
.
create_merge_request
new
.
create_merge_request
end
end
...
...
qa/qa/resource/project.rb
View file @
88b727d7
...
...
@@ -75,6 +75,11 @@ module QA
super
end
def
add_member
(
user
,
access_level
=
'30'
)
# 30 = developer access
post
Runtime
::
API
::
Request
.
new
(
api_client
,
api_members_path
).
url
,
{
user_id:
user
.
id
,
access_level:
access_level
}
end
def
api_get_path
"/projects/
#{
CGI
.
escape
(
path_with_namespace
)
}
"
end
...
...
@@ -83,6 +88,10 @@ module QA
"
#{
api_get_path
}
/repository/archive.
#{
type
}
"
end
def
api_members_path
"
#{
api_get_path
}
/members"
end
def
api_post_path
'/projects'
end
...
...
qa/qa/resource/user.rb
View file @
88b727d7
...
...
@@ -9,6 +9,7 @@ module QA
attr_writer
:username
,
:password
attr_accessor
:provider
,
:extern_uid
attribute
:id
attribute
:name
attribute
:email
...
...
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