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
1ada89d5
Commit
1ada89d5
authored
Sep 10, 2019
by
Tomislav Nikic
Committed by
Mark Lapierre
Sep 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport for EE 15582
This is a back-port for all CE related files.
parent
564d78da
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
95 additions
and
2 deletions
+95
-2
qa/qa.rb
qa/qa.rb
+1
-0
qa/qa/git/repository.rb
qa/qa/git/repository.rb
+2
-0
qa/qa/page/main/login.rb
qa/qa/page/main/login.rb
+6
-0
qa/qa/page/merge_request/show.rb
qa/qa/page/merge_request/show.rb
+5
-1
qa/qa/page/project/sub_menus/repository.rb
qa/qa/page/project/sub_menus/repository.rb
+2
-0
qa/qa/resource/api_fabricator.rb
qa/qa/resource/api_fabricator.rb
+16
-0
qa/qa/resource/base.rb
qa/qa/resource/base.rb
+12
-0
qa/qa/resource/branch.rb
qa/qa/resource/branch.rb
+12
-0
qa/qa/resource/merge_request.rb
qa/qa/resource/merge_request.rb
+3
-1
qa/qa/resource/project_member.rb
qa/qa/resource/project_member.rb
+35
-0
qa/qa/support/api.rb
qa/qa/support/api.rb
+1
-0
No files found.
qa/qa.rb
View file @
1ada89d5
...
...
@@ -66,6 +66,7 @@ module QA
autoload
:Fork
,
'qa/resource/fork'
autoload
:SSHKey
,
'qa/resource/ssh_key'
autoload
:Snippet
,
'qa/resource/snippet'
autoload
:ProjectMember
,
'qa/resource/project_member'
module
Events
autoload
:Base
,
'qa/resource/events/base'
...
...
qa/qa/git/repository.rb
View file @
1ada89d5
...
...
@@ -85,6 +85,8 @@ module QA
end
def
add_file
(
name
,
contents
)
FileUtils
.
mkdir_p
(
::
File
.
dirname
(
name
))
::
File
.
write
(
name
,
contents
)
if
use_lfs?
...
...
qa/qa/page/main/login.rb
View file @
1ada89d5
...
...
@@ -148,6 +148,12 @@ module QA
click_element
:saml_login_button
end
def
sign_out_and_sign_in_as
(
user
:)
Menu
.
perform
(
&
:sign_out
)
has_sign_in_tab?
sign_in_using_credentials
(
user
)
end
private
def
sign_in_using_gitlab_credentials
(
user
)
...
...
qa/qa/page/merge_request/show.rb
View file @
1ada89d5
...
...
@@ -119,7 +119,7 @@ module QA
has_element?
(
:description
,
text:
description
)
end
def
merge!
def
try_to_
merge!
# The merge button is disabled on load
wait
do
has_element?
(
:merge_button
)
...
...
@@ -131,6 +131,10 @@ module QA
end
merge_immediately
end
def
merge!
try_to_merge!
success
=
wait
do
has_text?
(
'The changes were merged into'
)
...
...
qa/qa/page/project/sub_menus/repository.rb
View file @
1ada89d5
...
...
@@ -44,3 +44,5 @@ module QA
end
end
end
QA
::
Page
::
Project
::
SubMenus
::
Repository
.
prepend_if_ee
(
'QA::EE::Page::Project::SubMenus::Repository'
)
qa/qa/resource/api_fabricator.rb
View file @
1ada89d5
...
...
@@ -11,6 +11,7 @@ module QA
ResourceNotFoundError
=
Class
.
new
(
RuntimeError
)
ResourceFabricationFailedError
=
Class
.
new
(
RuntimeError
)
ResourceURLMissingError
=
Class
.
new
(
RuntimeError
)
ResourceNotDeletedError
=
Class
.
new
(
RuntimeError
)
attr_reader
:api_resource
,
:api_response
attr_writer
:api_client
...
...
@@ -30,6 +31,10 @@ module QA
resource_web_url
(
api_post
)
end
def
remove_via_api!
api_delete
end
def
eager_load_api_client!
return
unless
api_client
.
nil?
...
...
@@ -79,6 +84,17 @@ module QA
process_api_response
(
parse_body
(
response
))
end
def
api_delete
url
=
Runtime
::
API
::
Request
.
new
(
api_client
,
api_delete_path
).
url
response
=
delete
(
url
)
unless
response
.
code
==
HTTP_STATUS_NO_CONTENT
raise
ResourceNotDeletedError
,
"Resource at
#{
url
}
could not be deleted (
#{
response
.
code
}
): `
#{
response
}
`."
end
response
end
def
api_client
@api_client
||=
begin
Runtime
::
API
::
Client
.
new
(
:gitlab
,
is_new_session:
!
current_url
.
start_with?
(
'http'
),
user:
user
)
...
...
qa/qa/resource/base.rb
View file @
1ada89d5
...
...
@@ -47,6 +47,18 @@ module QA
end
end
def
self
.
remove_via_api!
(
*
args
,
&
prepare_block
)
options
=
args
.
extract_options!
resource
=
options
.
fetch
(
:resource
)
{
new
}
parents
=
options
.
fetch
(
:parents
)
{
[]
}
resource
.
eager_load_api_client!
do_fabricate!
(
resource:
resource
,
prepare_block:
prepare_block
,
parents:
parents
)
do
log_fabrication
(
:api
,
resource
,
parents
,
args
)
{
resource
.
remove_via_api!
}
end
end
def
fabricate!
(
*
_args
)
raise
NotImplementedError
end
...
...
qa/qa/resource/branch.rb
View file @
1ada89d5
...
...
@@ -72,6 +72,18 @@ module QA
end
end
end
def
self
.
unprotect_via_api!
(
&
block
)
self
.
remove_via_api!
(
&
block
)
end
def
api_get_path
"/projects/
#{
@project
.
api_resource
[
:id
]
}
/protected_branches/
#{
@branch_name
}
"
end
def
api_delete_path
"/projects/
#{
@project
.
api_resource
[
:id
]
}
/protected_branches/
#{
@branch_name
}
"
end
end
end
end
qa/qa/resource/merge_request.rb
View file @
1ada89d5
...
...
@@ -17,6 +17,7 @@ module QA
:labels
,
:file_name
,
:file_content
attr_writer
:no_preparation
attribute
:project
do
Project
.
fabricate!
do
|
resource
|
...
...
@@ -58,6 +59,7 @@ module QA
@file_name
=
"added_file.txt"
@file_content
=
"File Added"
@target_new_branch
=
true
@no_preparation
=
false
end
def
fabricate!
...
...
@@ -80,7 +82,7 @@ module QA
end
def
fabricate_via_api!
populate
(
:target
,
:source
)
populate
(
:target
,
:source
)
unless
@no_preparation
super
end
...
...
qa/qa/resource/project_member.rb
0 → 100644
View file @
1ada89d5
# frozen_string_literal: true
module
QA
module
Resource
class
ProjectMember
<
Base
attr_accessor
:user
,
:project
,
:access_level
attr_reader
:level
def
initialize
@level
=
{
guest:
10
,
reporter:
20
,
developer:
30
,
maintainer:
40
,
owner:
50
}
end
def
api_get_path
"/projects/
#{
project
.
api_resource
[
:id
]
}
/members/
#{
user
.
api_resource
[
:id
]
}
"
end
def
api_post_path
"/projects/
#{
project
.
api_resource
[
:id
]
}
/members"
end
def
api_post_body
{
user_id:
user
.
api_resource
[
:id
],
access_level:
access_level
}
end
end
end
end
qa/qa/support/api.rb
View file @
1ada89d5
...
...
@@ -5,6 +5,7 @@ module QA
module
Api
HTTP_STATUS_OK
=
200
HTTP_STATUS_CREATED
=
201
HTTP_STATUS_NO_CONTENT
=
204
def
post
(
url
,
payload
)
RestClient
::
Request
.
execute
(
...
...
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