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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
3a1e06d6
Commit
3a1e06d6
authored
Dec 15, 2017
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create merge request spec
parent
af95ba2f
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
137 additions
and
9 deletions
+137
-9
app/views/projects/_last_push.html.haml
app/views/projects/_last_push.html.haml
+1
-1
app/views/shared/form_elements/_description.html.haml
app/views/shared/form_elements/_description.html.haml
+1
-1
app/views/shared/issuable/_form.html.haml
app/views/shared/issuable/_form.html.haml
+1
-1
app/views/shared/issuable/form/_title.html.haml
app/views/shared/issuable/form/_title.html.haml
+1
-1
qa/qa.rb
qa/qa.rb
+5
-0
qa/qa/factory/dependency.rb
qa/qa/factory/dependency.rb
+4
-3
qa/qa/factory/resource/merge_request.rb
qa/qa/factory/resource/merge_request.rb
+49
-0
qa/qa/page/base.rb
qa/qa/page/base.rb
+6
-2
qa/qa/page/merge_request/new.rb
qa/qa/page/merge_request/new.rb
+31
-0
qa/qa/page/project/show.rb
qa/qa/page/project/show.rb
+8
-0
qa/qa/specs/features/merge_request/create_spec.rb
qa/qa/specs/features/merge_request/create_spec.rb
+17
-0
qa/spec/factory/dependency_spec.rb
qa/spec/factory/dependency_spec.rb
+13
-0
No files found.
app/views/projects/_last_push.html.haml
View file @
3a1e06d6
...
@@ -14,5 +14,5 @@
...
@@ -14,5 +14,5 @@
#{
time_ago_with_tooltip
(
event
.
created_at
)
}
#{
time_ago_with_tooltip
(
event
.
created_at
)
}
.pull-right
.pull-right
=
link_to
new_mr_path_from_push_event
(
event
),
title:
_
(
"New merge request"
),
class:
"btn btn-info btn-sm"
do
=
link_to
new_mr_path_from_push_event
(
event
),
title:
_
(
"New merge request"
),
class:
"btn btn-info btn-sm
qa-create-merge-request
"
do
#{
_
(
'Create merge request'
)
}
#{
_
(
'Create merge request'
)
}
app/views/shared/form_elements/_description.html.haml
View file @
3a1e06d6
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
=
render
layout:
'projects/md_preview'
,
locals:
{
url:
preview_url
,
referenced_users:
true
}
do
=
render
layout:
'projects/md_preview'
,
locals:
{
url:
preview_url
,
referenced_users:
true
}
do
=
render
'projects/zen'
,
f:
form
,
attr: :description
,
=
render
'projects/zen'
,
f:
form
,
attr: :description
,
classes:
'note-textarea'
,
classes:
'note-textarea
qa-issuable-form-description
'
,
placeholder:
"Write a comment or drag your files here..."
,
placeholder:
"Write a comment or drag your files here..."
,
supports_quick_actions:
supports_quick_actions
supports_quick_actions:
supports_quick_actions
=
render
'shared/notes/hints'
,
supports_quick_actions:
supports_quick_actions
=
render
'shared/notes/hints'
,
supports_quick_actions:
supports_quick_actions
...
...
app/views/shared/issuable/_form.html.haml
View file @
3a1e06d6
...
@@ -65,7 +65,7 @@
...
@@ -65,7 +65,7 @@
%span
.append-right-10
%span
.append-right-10
-
if
issuable
.
new_record?
-
if
issuable
.
new_record?
=
form
.
submit
"Submit
#{
issuable
.
class
.
model_name
.
human
.
downcase
}
"
,
class:
'btn btn-create'
=
form
.
submit
"Submit
#{
issuable
.
class
.
model_name
.
human
.
downcase
}
"
,
class:
'btn btn-create
qa-issuable-create-button
'
-
else
-
else
=
form
.
submit
'Save changes'
,
class:
'btn btn-save'
=
form
.
submit
'Save changes'
,
class:
'btn btn-save'
...
...
app/views/shared/issuable/form/_title.html.haml
View file @
3a1e06d6
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
%div
{
class:
div_class
}
%div
{
class:
div_class
}
=
form
.
text_field
:title
,
required:
true
,
maxlength:
255
,
autofocus:
true
,
=
form
.
text_field
:title
,
required:
true
,
maxlength:
255
,
autofocus:
true
,
autocomplete:
'off'
,
class:
'form-control pad'
autocomplete:
'off'
,
class:
'form-control pad
qa-issuable-form-title
'
-
if
issuable
.
respond_to?
(
:work_in_progress?
)
-
if
issuable
.
respond_to?
(
:work_in_progress?
)
%p
.help-block
%p
.help-block
...
...
qa/qa.rb
View file @
3a1e06d6
...
@@ -28,6 +28,7 @@ module QA
...
@@ -28,6 +28,7 @@ module QA
autoload
:Sandbox
,
'qa/factory/resource/sandbox'
autoload
:Sandbox
,
'qa/factory/resource/sandbox'
autoload
:Group
,
'qa/factory/resource/group'
autoload
:Group
,
'qa/factory/resource/group'
autoload
:Project
,
'qa/factory/resource/project'
autoload
:Project
,
'qa/factory/resource/project'
autoload
:MergeRequest
,
'qa/factory/resource/merge_request'
autoload
:DeployKey
,
'qa/factory/resource/deploy_key'
autoload
:DeployKey
,
'qa/factory/resource/deploy_key'
autoload
:Runner
,
'qa/factory/resource/runner'
autoload
:Runner
,
'qa/factory/resource/runner'
autoload
:PersonalAccessToken
,
'qa/factory/resource/personal_access_token'
autoload
:PersonalAccessToken
,
'qa/factory/resource/personal_access_token'
...
@@ -125,6 +126,10 @@ module QA
...
@@ -125,6 +126,10 @@ module QA
autoload
:PersonalAccessTokens
,
'qa/page/profile/personal_access_tokens'
autoload
:PersonalAccessTokens
,
'qa/page/profile/personal_access_tokens'
end
end
module
MergeRequest
autoload
:New
,
'qa/page/merge_request/new'
end
module
Admin
module
Admin
autoload
:Settings
,
'qa/page/admin/settings'
autoload
:Settings
,
'qa/page/admin/settings'
end
end
...
...
qa/qa/factory/dependency.rb
View file @
3a1e06d6
...
@@ -16,20 +16,21 @@ module QA
...
@@ -16,20 +16,21 @@ module QA
def
build!
def
build!
return
if
overridden?
return
if
overridden?
Builder
.
new
(
@signature
).
fabricate!
.
tap
do
|
product
|
Builder
.
new
(
@signature
,
@factory
).
fabricate!
.
tap
do
|
product
|
@factory
.
public_send
(
"
#{
@name
}
="
,
product
)
@factory
.
public_send
(
"
#{
@name
}
="
,
product
)
end
end
end
end
class
Builder
class
Builder
def
initialize
(
signature
)
def
initialize
(
signature
,
caller_factory
)
@factory
=
signature
.
factory
@factory
=
signature
.
factory
@block
=
signature
.
block
@block
=
signature
.
block
@caller_factory
=
caller_factory
end
end
def
fabricate!
def
fabricate!
@factory
.
fabricate!
do
|
factory
|
@factory
.
fabricate!
do
|
factory
|
@block
&
.
call
(
factory
)
@block
&
.
call
(
factory
,
@caller_factory
)
end
end
end
end
end
end
...
...
qa/qa/factory/resource/merge_request.rb
0 → 100644
View file @
3a1e06d6
require
'securerandom'
module
QA
module
Factory
module
Resource
class
MergeRequest
<
Factory
::
Base
attr_accessor
:title
,
:description
,
:source_branch
,
:target_branch
dependency
Factory
::
Resource
::
Project
,
as: :project
do
|
project
|
project
.
name
=
'project-with-merge-request'
end
dependency
Factory
::
Repository
::
Push
,
as: :target
do
|
push
,
factory
|
push
.
project
=
factory
.
project
push
.
branch_name
=
"master:
#{
factory
.
target_branch
}
"
end
dependency
Factory
::
Repository
::
Push
,
as: :source
do
|
push
,
factory
|
push
.
project
=
factory
.
project
push
.
branch_name
=
"
#{
factory
.
target_branch
}
:
#{
factory
.
source_branch
}
"
push
.
file_name
=
"added_file.txt"
push
.
file_content
=
"File Added"
end
def
initialize
@title
=
'QA test - merge request'
@description
=
'This is a test merge request'
@source_branch
=
"qa-test-feature-
#{
SecureRandom
.
hex
(
8
)
}
"
@target_branch
=
"master"
end
def
fabricate!
project
.
visit!
Page
::
Project
::
Show
.
act
{
new_merge_request
}
Page
::
MergeRequest
::
New
.
perform
do
|
page
|
page
.
fill_title
(
@title
)
page
.
fill_description
(
@description
)
page
.
create_merge_request
end
end
end
end
end
end
qa/qa/page/base.rb
View file @
3a1e06d6
...
@@ -40,12 +40,16 @@ module QA
...
@@ -40,12 +40,16 @@ module QA
page
.
within
(
selector
)
{
yield
}
if
block_given?
page
.
within
(
selector
)
{
yield
}
if
block_given?
end
end
def
find_element
(
name
)
find
(
element_selector_css
(
name
))
end
def
click_element
(
name
)
def
click_element
(
name
)
find_element
(
name
).
click
find_element
(
name
).
click
end
end
def
fi
nd_element
(
name
)
def
fi
ll_element
(
name
,
content
)
find
(
element_selector_css
(
name
)
)
find
_element
(
name
).
set
(
content
)
end
end
def
within_element
(
name
)
def
within_element
(
name
)
...
...
qa/qa/page/merge_request/new.rb
0 → 100644
View file @
3a1e06d6
module
QA
module
Page
module
MergeRequest
class
New
<
Page
::
Base
view
'app/views/shared/issuable/_form.html.haml'
do
element
:issuable_create_button
end
view
'app/views/shared/issuable/form/_title.html.haml'
do
element
:issuable_form_title
end
view
'app/views/shared/form_elements/_description.html.haml'
do
element
:issuable_form_description
end
def
create_merge_request
click_element
:issuable_create_button
end
def
fill_title
(
title
)
fill_element
:issuable_form_title
,
title
end
def
fill_description
(
description
)
fill_element
:issuable_form_description
,
description
end
end
end
end
end
qa/qa/page/project/show.rb
View file @
3a1e06d6
...
@@ -11,6 +11,10 @@ module QA
...
@@ -11,6 +11,10 @@ module QA
element
:project_repository_location
,
'text_field_tag :project_clone'
element
:project_repository_location
,
'text_field_tag :project_clone'
end
end
view
'app/views/projects/_last_push.html.haml'
do
element
:create_merge_request
end
view
'app/views/projects/_home_panel.html.haml'
do
view
'app/views/projects/_home_panel.html.haml'
do
element
:project_name
element
:project_name
end
end
...
@@ -31,6 +35,10 @@ module QA
...
@@ -31,6 +35,10 @@ module QA
find
(
'.qa-project-name'
).
text
find
(
'.qa-project-name'
).
text
end
end
def
new_merge_request
click_element
:create_merge_request
end
def
wait_for_push
def
wait_for_push
sleep
5
sleep
5
refresh
refresh
...
...
qa/qa/specs/features/merge_request/create_spec.rb
0 → 100644
View file @
3a1e06d6
module
QA
feature
'creates a merge request'
,
:core
do
scenario
'user creates a new merge request'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
Factory
::
Resource
::
MergeRequest
.
fabricate!
do
|
merge_request
|
merge_request
.
title
=
'This is a merge request'
merge_request
.
description
=
'Great feature'
end
expect
(
page
).
to
have_content
(
'This is a merge request'
)
expect
(
page
).
to
have_content
(
'Great feature'
)
expect
(
page
).
to
have_content
(
'Opened less than a minute ago'
)
end
end
end
qa/spec/factory/dependency_spec.rb
View file @
3a1e06d6
...
@@ -54,6 +54,19 @@ describe QA::Factory::Dependency do
...
@@ -54,6 +54,19 @@ describe QA::Factory::Dependency do
expect
(
factory
).
to
have_received
(
:mydep
=
).
with
(
dependency
)
expect
(
factory
).
to
have_received
(
:mydep
=
).
with
(
dependency
)
end
end
context
'when receives a caller factory as block argument'
do
let
(
:dependency
)
{
QA
::
Factory
::
Base
}
it
'calls given block with dependency factory and caller factory'
do
allow_any_instance_of
(
QA
::
Factory
::
Base
).
to
receive
(
:fabricate!
).
and_return
(
factory
)
allow
(
QA
::
Factory
::
Product
).
to
receive
(
:populate!
).
and_return
(
spy
(
'any'
))
subject
.
build!
expect
(
block
).
to
have_received
(
:call
).
with
(
an_instance_of
(
QA
::
Factory
::
Base
),
factory
)
end
end
end
end
end
end
end
end
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