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
Léo-Paul Géneau
gitlab-ce
Commits
73e50395
Commit
73e50395
authored
Jan 26, 2018
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test merge request rebase
parent
8cfa5ccf
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
167 additions
and
14 deletions
+167
-14
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js
...uest_widget/components/states/mr_widget_ready_to_merge.js
+2
-1
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue
...rge_request_widget/components/states/mr_widget_rebase.vue
+1
-1
app/views/projects/_merge_request_fast_forward_settings.html.haml
...s/projects/_merge_request_fast_forward_settings.html.haml
+1
-1
app/views/projects/edit.html.haml
app/views/projects/edit.html.haml
+1
-1
qa/qa.rb
qa/qa.rb
+2
-0
qa/qa/factory/base.rb
qa/qa/factory/base.rb
+1
-1
qa/qa/factory/product.rb
qa/qa/factory/product.rb
+3
-3
qa/qa/factory/repository/push.rb
qa/qa/factory/repository/push.rb
+3
-1
qa/qa/factory/resource/merge_request.rb
qa/qa/factory/resource/merge_request.rb
+9
-0
qa/qa/git/repository.rb
qa/qa/git/repository.rb
+4
-0
qa/qa/page/merge_request/show.rb
qa/qa/page/merge_request/show.rb
+46
-0
qa/qa/page/project/settings/merge_request.rb
qa/qa/page/project/settings/merge_request.rb
+27
-0
qa/qa/specs/features/merge_request/rebase_spec.rb
qa/qa/specs/features/merge_request/rebase_spec.rb
+39
-0
qa/spec/factory/base_spec.rb
qa/spec/factory/base_spec.rb
+14
-3
qa/spec/factory/product_spec.rb
qa/spec/factory/product_spec.rb
+14
-2
No files found.
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js
View file @
73e50395
...
...
@@ -227,7 +227,8 @@ export default {
@click="handleMergeButtonClick()"
:disabled="isMergeButtonDisabled"
:class="mergeButtonClass"
type="button">
type="button"
class="qa-merge-button">
<i
v-if="isMakingRequest"
class="fa fa-spinner fa-spin"
...
...
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue
View file @
73e50395
...
...
@@ -110,7 +110,7 @@
js-toggle-container accept-action media space-children"
>
<button
type=
"button"
class=
"btn btn-sm btn-reopen btn-success"
class=
"btn btn-sm btn-reopen btn-success
qa-mr-rebase-button
"
:disabled=
"isMakingRequest"
@
click=
"rebase"
>
...
...
app/views/projects/_merge_request_fast_forward_settings.html.haml
View file @
73e50395
...
...
@@ -3,7 +3,7 @@
.radio
=
label_tag
:project_merge_method_ff
do
=
form
.
radio_button
:merge_method
,
:ff
,
class:
"js-merge-method-radio"
=
form
.
radio_button
:merge_method
,
:ff
,
class:
"js-merge-method-radio
qa-radio-button-merge-ff
"
%strong
Fast-forward merge
%br
%span
.descr
...
...
app/views/projects/edit.html.haml
View file @
73e50395
...
...
@@ -85,7 +85,7 @@
.settings-content
=
form_for
[
@project
.
namespace
.
becomes
(
Namespace
),
@project
],
remote:
true
,
html:
{
multipart:
true
,
class:
"merge-request-settings-form"
},
authenticity_token:
true
do
|
f
|
=
render
'merge_request_settings'
,
form:
f
=
f
.
submit
'Save changes'
,
class:
"btn btn-save"
=
f
.
submit
'Save changes'
,
class:
"btn btn-save
qa-save-merge-request-changes
"
=
render
'export'
,
project:
@project
...
...
qa/qa.rb
View file @
73e50395
...
...
@@ -130,6 +130,7 @@ module QA
autoload
:DeployKeys
,
'qa/page/project/settings/deploy_keys'
autoload
:SecretVariables
,
'qa/page/project/settings/secret_variables'
autoload
:Runners
,
'qa/page/project/settings/runners'
autoload
:MergeRequest
,
'qa/page/project/settings/merge_request'
end
module
Issue
...
...
@@ -145,6 +146,7 @@ module QA
module
MergeRequest
autoload
:New
,
'qa/page/merge_request/new'
autoload
:Show
,
'qa/page/merge_request/show'
end
module
Admin
...
...
qa/qa/factory/base.rb
View file @
73e50395
...
...
@@ -22,7 +22,7 @@ module QA
factory
.
fabricate!
(
*
args
)
return
Factory
::
Product
.
populate!
(
self
)
return
Factory
::
Product
.
populate!
(
factory
)
end
end
...
...
qa/qa/factory/product.rb
View file @
73e50395
...
...
@@ -17,9 +17,9 @@ module QA
def
self
.
populate!
(
factory
)
new
.
tap
do
|
product
|
factory
.
attributes
.
each_value
do
|
attribute
|
product
.
instance_exec
(
&
attribute
.
block
).
tap
do
|
value
|
product
.
define_singleton_method
(
attribute
.
name
)
{
value
}
factory
.
class
.
attributes
.
each_value
do
|
attribute
|
product
.
instance_exec
(
factory
,
attribute
.
block
)
do
|
factory
,
block
|
product
.
define_singleton_method
(
attribute
.
name
)
{
block
.
call
(
factory
)
}
end
end
end
...
...
qa/qa/factory/repository/push.rb
View file @
73e50395
...
...
@@ -2,7 +2,7 @@ module QA
module
Factory
module
Repository
class
Push
<
Factory
::
Base
attr_writer
:file_name
,
:file_content
,
:commit_message
,
:branch_name
attr_writer
:file_name
,
:file_content
,
:commit_message
,
:branch_name
,
:new_branch
dependency
Factory
::
Resource
::
Project
,
as: :project
do
|
project
|
project
.
name
=
'project-with-code'
...
...
@@ -14,6 +14,7 @@ module QA
@file_content
=
'# This is test project'
@commit_message
=
"Add
#{
@file_name
}
"
@branch_name
=
'master'
@new_branch
=
true
end
def
fabricate!
...
...
@@ -29,6 +30,7 @@ module QA
repository
.
clone
repository
.
configure_identity
(
'GitLab QA'
,
'root@gitlab.com'
)
repository
.
checkout
(
@branch_name
)
unless
@new_branch
repository
.
add_file
(
@file_name
,
@file_content
)
repository
.
commit
(
@commit_message
)
repository
.
push_changes
(
@branch_name
)
...
...
qa/qa/factory/resource/merge_request.rb
View file @
73e50395
...
...
@@ -9,11 +9,20 @@ module QA
:source_branch
,
:target_branch
product
:project
do
|
factory
|
factory
.
project
end
product
:source_branch
do
|
factory
|
factory
.
source_branch
end
dependency
Factory
::
Resource
::
Project
,
as: :project
do
|
project
|
project
.
name
=
'project-with-merge-request'
end
dependency
Factory
::
Repository
::
Push
,
as: :target
do
|
push
,
factory
|
factory
.
project
.
visit!
push
.
project
=
factory
.
project
push
.
branch_name
=
"master:
#{
factory
.
target_branch
}
"
end
...
...
qa/qa/git/repository.rb
View file @
73e50395
...
...
@@ -36,6 +36,10 @@ module QA
`git clone
#{
opts
}
#{
@uri
.
to_s
}
./
#{
suppress_output
}
`
end
def
checkout
(
branch_name
)
`git checkout "
#{
branch_name
}
"`
end
def
shallow_clone
clone
(
'--depth 1'
)
end
...
...
qa/qa/page/merge_request/show.rb
0 → 100644
View file @
73e50395
module
QA
module
Page
module
MergeRequest
class
Show
<
Page
::
Base
view
'app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js'
do
element
:merge_button
end
view
'app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merged.vue'
do
element
:merged_status
,
'The changes were merged into'
end
view
'app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue'
do
element
:mr_rebase_button
element
:fast_forward_nessage
,
"Fast-forward merge is not possible"
end
def
rebase!
wait
(
reload:
false
)
do
click_element
:mr_rebase_button
has_text?
(
"The source branch HEAD has recently changed."
)
end
end
def
fast_forward_possible?
!
page
.
has_text?
(
"Fast-forward merge is not possible"
)
end
def
has_merge_button?
refresh
has_selector?
(
'.accept-merge-request'
)
end
def
merge!
wait
(
reload:
false
)
do
click_element
:merge_button
has_text?
(
"The changes were merged into"
)
end
end
end
end
end
end
qa/qa/page/project/settings/merge_request.rb
0 → 100644
View file @
73e50395
module
QA
module
Page
module
Project
module
Settings
class
MergeRequest
<
QA
::
Page
::
Base
include
Common
view
'app/views/projects/_merge_request_fast_forward_settings.html.haml'
do
element
:radio_button_merge_ff
end
view
'app/views/projects/edit.html.haml'
do
element
:merge_request_settings
,
'Merge request settings'
element
:save_merge_request_changes
end
def
enable_ff_only
expand_section
(
'Merge request settings'
)
do
click_element
:radio_button_merge_ff
click_element
:save_merge_request_changes
end
end
end
end
end
end
end
qa/qa/specs/features/merge_request/rebase_spec.rb
0 → 100644
View file @
73e50395
module
QA
feature
'merge request rebase'
,
:core
do
scenario
'rebases source branch of merge request'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
act
{
sign_in_using_credentials
}
project
=
Factory
::
Resource
::
Project
.
fabricate!
do
|
project
|
project
.
name
=
"no-fast-forward"
end
Page
::
Menu
::
Side
.
act
{
go_to_settings
}
Page
::
Project
::
Settings
::
MergeRequest
.
act
{
enable_ff_only
}
merge_request
=
Factory
::
Resource
::
MergeRequest
.
fabricate!
do
|
merge_request
|
merge_request
.
project
=
project
merge_request
.
title
=
'Needs rebasing'
end
Factory
::
Repository
::
Push
.
fabricate!
do
|
push
|
push
.
project
=
project
push
.
file_name
=
"other.txt"
push
.
file_content
=
"New file added!"
end
merge_request
.
visit!
Page
::
MergeRequest
::
Show
.
perform
do
|
merge_request
|
expect
(
merge_request
).
to
have_content
(
'Needs rebasing'
)
expect
(
merge_request
).
not_to
be_fast_forward_possible
expect
(
merge_request
).
not_to
have_merge_button
merge_request
.
rebase!
expect
(
merge_request
).
to
have_merge_button
expect
(
merge_request
.
fast_forward_possible?
).
to
be_truthy
end
end
end
end
qa/spec/factory/base_spec.rb
View file @
73e50395
...
...
@@ -7,6 +7,7 @@ describe QA::Factory::Base do
before
do
allow
(
QA
::
Factory
::
Product
).
to
receive
(
:new
).
and_return
(
product
)
allow
(
QA
::
Factory
::
Product
).
to
receive
(
:populate!
).
and_return
(
product
)
end
it
'instantiates the factory and calls factory method'
do
...
...
@@ -76,6 +77,7 @@ describe QA::Factory::Base do
allow
(
subject
).
to
receive
(
:new
).
and_return
(
instance
)
allow
(
instance
).
to
receive
(
:mydep
).
and_return
(
nil
)
allow
(
QA
::
Factory
::
Product
).
to
receive
(
:new
)
allow
(
QA
::
Factory
::
Product
).
to
receive
(
:populate!
)
end
it
'builds all dependencies first'
do
...
...
@@ -89,8 +91,16 @@ describe QA::Factory::Base do
describe
'.product'
do
subject
do
Class
.
new
(
described_class
)
do
def
fabricate!
"any"
end
# Defined only to be stubbed
def
self
.
find_page
end
product
:token
do
page
.
do_something_on_page!
find_
page
.
do_something_on_page!
'resulting value'
end
end
...
...
@@ -105,16 +115,17 @@ describe QA::Factory::Base do
let
(
:page
)
{
spy
(
'page'
)
}
before
do
allow
(
subject
).
to
receive
(
:new
).
and_return
(
factory
)
allow
(
factory
).
to
receive
(
:class
).
and_return
(
subject
)
allow
(
QA
::
Factory
::
Product
).
to
receive
(
:new
).
and_return
(
product
)
allow
(
product
).
to
receive
(
:page
).
and_return
(
page
)
allow
(
subject
).
to
receive
(
:find_page
).
and_return
(
page
)
end
it
'populates product after fabrication'
do
subject
.
fabricate!
expect
(
page
).
to
have_received
(
:do_something_on_page!
)
expect
(
product
.
token
).
to
eq
'resulting value'
expect
(
page
).
to
have_received
(
:do_something_on_page!
)
end
end
end
...
...
qa/spec/factory/product_spec.rb
View file @
73e50395
describe
QA
::
Factory
::
Product
do
let
(
:factory
)
{
spy
(
'factory'
)
}
let
(
:factory
)
do
QA
::
Factory
::
Base
.
new
end
let
(
:attributes
)
do
{
test:
QA
::
Factory
::
Product
::
Attribute
.
new
(
:test
,
proc
{
'returned'
})
}
end
let
(
:product
)
{
spy
(
'product'
)
}
before
do
allow
(
QA
::
Factory
::
Base
).
to
receive
(
:attributes
).
and_return
(
attributes
)
end
describe
'.populate!'
do
it
'returns a fabrication product'
do
it
'returns a fabrication product
and define factory attributes as its methods
'
do
expect
(
described_class
).
to
receive
(
:new
).
and_return
(
product
)
result
=
described_class
.
populate!
(
factory
)
do
|
instance
|
...
...
@@ -11,6 +22,7 @@ describe QA::Factory::Product do
end
expect
(
result
).
to
be
product
expect
(
result
.
test
).
to
eq
(
'returned'
)
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