Открыть боковую панель
nt_test133
nt_project_uxpg8lvcuq8w
Коммиты
1ada89d5
Коммит
1ada89d5
создал
Сен 10, 2019
по автору
Tomislav Nikic
Зафиксировано автором
Mark Lapierre
Сен 10, 2019
Просмотр файлов
Backport for EE 15582
This is a back-port for all CE related files.
владелец
564d78da
Изменения
11
Скрыть пробелы
Построчно
Рядом
qa/qa.rb
Просмотр файла @
1ada89d5
...
...
@@ -66,6 +66,7 @@ module Resource
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
Просмотр файла @
1ada89d5
...
...
@@ -85,6 +85,8 @@ def commit_file(name, contents, message)
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
Просмотр файла @
1ada89d5
...
...
@@ -148,6 +148,12 @@ def sign_in_with_saml
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
Просмотр файла @
1ada89d5
...
...
@@ -119,7 +119,7 @@ def has_description?(description)
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 @@ def merge!
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
Просмотр файла @
1ada89d5
...
...
@@ -44,3 +44,5 @@ def hover_repository
end
end
end
QA
::
Page
::
Project
::
SubMenus
::
Repository
.
prepend_if_ee
(
'QA::EE::Page::Project::SubMenus::Repository'
)
qa/qa/resource/api_fabricator.rb
Просмотр файла @
1ada89d5
...
...
@@ -11,6 +11,7 @@ module ApiFabricator
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 @@ def fabricate_via_api!
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 @@ def api_post
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
Просмотр файла @
1ada89d5
...
...
@@ -47,6 +47,18 @@ def self.fabricate_via_api!(*args, &prepare_block)
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
Просмотр файла @
1ada89d5
...
...
@@ -72,6 +72,18 @@ def fabricate!
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
Просмотр файла @
1ada89d5
...
...
@@ -17,6 +17,7 @@ class MergeRequest < Base
:labels
,
:file_name
,
:file_content
attr_writer
:no_preparation
attribute
:project
do
Project
.
fabricate!
do
|
resource
|
...
...
@@ -58,6 +59,7 @@ def initialize
@file_name
=
"added_file.txt"
@file_content
=
"File Added"
@target_new_branch
=
true
@no_preparation
=
false
end
def
fabricate!
...
...
@@ -80,7 +82,7 @@ def fabricate!
end
def
fabricate_via_api!
populate
(
:target
,
:source
)
populate
(
:target
,
:source
)
unless
@no_preparation
super
end
...
...
qa/qa/resource/project_member.rb
0 → 100644
Просмотр файла @
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
Просмотр файла @
1ada89d5
...
...
@@ -5,6 +5,7 @@ module Support
module
Api
HTTP_STATUS_OK
=
200
HTTP_STATUS_CREATED
=
201
HTTP_STATUS_NO_CONTENT
=
204
def
post
(
url
,
payload
)
RestClient
::
Request
.
execute
(
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать