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
e7dc3bc5
Commit
e7dc3bc5
authored
May 14, 2018
by
blackst0ne
Committed by
Rémy Coutable
May 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace the `project/forked_merge_requests.feature` spinach test with an rspec analog
parent
03401338
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
215 deletions
+71
-215
changelogs/unreleased/blackst0ne-replace-spinach-project-forked-merge-requests-feature.yml
...replace-spinach-project-forked-merge-requests-feature.yml
+5
-0
features/project/forked_merge_requests.feature
features/project/forked_merge_requests.feature
+0
-51
features/steps/project/forked_merge_requests.rb
features/steps/project/forked_merge_requests.rb
+0
-139
features/steps/shared/authentication.rb
features/steps/shared/authentication.rb
+0
-7
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+0
-4
spec/features/projects/merge_requests/user_creates_merge_request_spec.rb
...rojects/merge_requests/user_creates_merge_request_spec.rb
+66
-14
No files found.
changelogs/unreleased/blackst0ne-replace-spinach-project-forked-merge-requests-feature.yml
0 → 100644
View file @
e7dc3bc5
---
title
:
'
Replace
the
`project/forked_merge_requests.feature`
spinach
test
with
an
rspec
analog'
merge_request
:
18867
author
:
'
@blackst0ne'
type
:
other
features/project/forked_merge_requests.feature
deleted
100644 → 0
View file @
03401338
Feature
:
Project Forked Merge Requests
Background
:
Given
I sign in as a user
And
I am a member of project
"Shop"
And
I have a project forked off of
"Shop"
called
"Forked Shop"
@javascript
Scenario
:
I
submit new unassigned merge request to a forked project
Given
I visit project
"Forked Shop"
merge requests page
And
I click link
"New Merge Request"
And
I fill out a
"Merge Request On Forked Project"
merge request
And
I submit the merge request
Then
I should see merge request
"Merge Request On Forked Project"
# TODO: Improve it so it does not fail randomly
#
#@javascript
#Scenario: I can edit a forked merge request
#Given I visit project "Forked Shop" merge requests page
#And I click link "New Merge Request"
#And I fill out a "Merge Request On Forked Project" merge request
#And I submit the merge request
#And I should see merge request "Merge Request On Forked Project"
#And I click link edit "Merge Request On Forked Project"
#Then I see the edit page prefilled for "Merge Request On Forked Project"
#And I update the merge request title
#And I save the merge request
#Then I should see the edited merge request
Scenario
:
I
cannot submit an invalid merge request
Given
I visit project
"Forked Shop"
merge requests page
And
I click link
"New Merge Request"
And
I fill out an invalid
"Merge Request On Forked Project"
merge request
Then
I should see validation errors
@javascript
Scenario
:
Merge request should target fork repository by default
Given
I visit project
"Forked Shop"
merge requests page
And
I click link
"New Merge Request"
Then
the target repository should be the original repository
@javascript
Scenario
:
I
see the users in the target project for a new merge request
Given
I sign in as an admin
And
I have a project forked off of
"Shop"
called
"Forked Shop"
Then
I visit project
"Forked Shop"
merge requests page
And
I click link
"New Merge Request"
And
I fill out a
"Merge Request On Forked Project"
merge request
When
I click
"Assign to"
dropdown"
Then
I should see the target project ID in the input selector
And
I should see the users from the target project ID
features/steps/project/forked_merge_requests.rb
deleted
100644 → 0
View file @
03401338
class
Spinach::Features::ProjectForkedMergeRequests
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedProject
include
SharedNote
include
SharedPaths
include
Select2Helper
include
WaitForRequests
include
ProjectForksHelper
step
'I am a member of project "Shop"'
do
@project
=
::
Project
.
find_by
(
name:
"Shop"
)
@project
||=
create
(
:project
,
:repository
,
name:
"Shop"
)
@project
.
add_reporter
(
@user
)
end
step
'I have a project forked off of "Shop" called "Forked Shop"'
do
@forked_project
=
fork_project
(
@project
,
@user
,
namespace:
@user
.
namespace
,
repository:
true
)
end
step
'I click link "New Merge Request"'
do
page
.
within
'#content-body'
do
page
.
has_link?
(
'New Merge Request'
)
?
click_link
(
"New Merge Request"
)
:
click_link
(
'New merge request'
)
end
end
step
'I should see merge request "Merge Request On Forked Project"'
do
expect
(
@project
.
merge_requests
.
size
).
to
be
>=
1
@merge_request
=
@project
.
merge_requests
.
last
expect
(
current_path
).
to
eq
project_merge_request_path
(
@project
,
@merge_request
)
expect
(
@merge_request
.
title
).
to
eq
"Merge Request On Forked Project"
expect
(
@merge_request
.
source_project
).
to
eq
@forked_project
expect
(
@merge_request
.
source_branch
).
to
eq
"fix"
expect
(
@merge_request
.
target_branch
).
to
eq
"master"
expect
(
page
).
to
have_content
@forked_project
.
full_path
expect
(
page
).
to
have_content
@project
.
full_path
expect
(
page
).
to
have_content
@merge_request
.
source_branch
expect
(
page
).
to
have_content
@merge_request
.
target_branch
wait_for_requests
end
step
'I fill out a "Merge Request On Forked Project" merge request'
do
expect
(
page
).
to
have_content
(
'Source branch'
)
expect
(
page
).
to
have_content
(
'Target branch'
)
first
(
'.js-source-project'
).
click
first
(
'.dropdown-source-project a'
,
text:
@forked_project
.
full_path
)
first
(
'.js-target-project'
).
click
first
(
'.dropdown-target-project a'
,
text:
@project
.
full_path
)
first
(
'.js-source-branch'
).
click
wait_for_requests
first
(
'.js-source-branch-dropdown .dropdown-content a'
,
text:
'fix'
).
click
click_button
"Compare branches and continue"
expect
(
page
).
to
have_css
(
"h3.page-title"
,
text:
"New Merge Request"
)
page
.
within
'form#new_merge_request'
do
fill_in
"merge_request_title"
,
with:
"Merge Request On Forked Project"
end
end
step
'I submit the merge request'
do
click_button
"Submit merge request"
end
step
'I update the merge request title'
do
fill_in
"merge_request_title"
,
with:
"An Edited Forked Merge Request"
end
step
'I save the merge request'
do
click_button
"Save changes"
end
step
'I should see the edited merge request'
do
expect
(
page
).
to
have_content
"An Edited Forked Merge Request"
expect
(
@project
.
merge_requests
.
size
).
to
be
>=
1
@merge_request
=
@project
.
merge_requests
.
last
expect
(
current_path
).
to
eq
project_merge_request_path
(
@project
,
@merge_request
)
expect
(
@merge_request
.
source_project
).
to
eq
@forked_project
expect
(
@merge_request
.
source_branch
).
to
eq
"fix"
expect
(
@merge_request
.
target_branch
).
to
eq
"master"
expect
(
page
).
to
have_content
@forked_project
.
full_path
expect
(
page
).
to
have_content
@project
.
full_path
expect
(
page
).
to
have_content
@merge_request
.
source_branch
expect
(
page
).
to
have_content
@merge_request
.
target_branch
end
step
'I should see last push widget'
do
expect
(
page
).
to
have_content
"You pushed to new_design"
expect
(
page
).
to
have_link
"Create Merge Request"
end
step
'I click link edit "Merge Request On Forked Project"'
do
find
(
"#edit_merge_request"
).
click
end
step
'I see the edit page prefilled for "Merge Request On Forked Project"'
do
expect
(
current_path
).
to
eq
edit_project_merge_request_path
(
@project
,
@merge_request
)
expect
(
page
).
to
have_content
"Edit merge request
#{
@merge_request
.
to_reference
}
"
expect
(
find
(
"#merge_request_title"
).
value
).
to
eq
"Merge Request On Forked Project"
end
step
'I fill out an invalid "Merge Request On Forked Project" merge request'
do
expect
(
find_by_id
(
"merge_request_source_project_id"
,
visible:
false
).
value
).
to
eq
@forked_project
.
id
.
to_s
expect
(
find_by_id
(
"merge_request_target_project_id"
,
visible:
false
).
value
).
to
eq
@project
.
id
.
to_s
expect
(
find_by_id
(
"merge_request_source_branch"
,
visible:
false
).
value
).
to
eq
nil
expect
(
find_by_id
(
"merge_request_target_branch"
,
visible:
false
).
value
).
to
eq
"master"
click_button
"Compare branches"
end
step
'I should see validation errors'
do
expect
(
page
).
to
have_content
"You must select source and target branch"
end
step
'the target repository should be the original repository'
do
expect
(
find_by_id
(
"merge_request_target_project_id"
).
value
).
to
eq
"
#{
@project
.
id
}
"
end
step
'I click "Assign to" dropdown"'
do
click_button
'Assignee'
end
step
'I should see the target project ID in the input selector'
do
expect
(
find
(
'.js-assignee-search'
)[
"data-project-id"
]).
to
eq
"
#{
@project
.
id
}
"
end
step
'I should see the users from the target project ID'
do
page
.
within
'.dropdown-menu-user'
do
expect
(
page
).
to
have_content
'Unassigned'
expect
(
page
).
to
have_content
current_user
.
name
expect
(
page
).
to
have_content
@project
.
users
.
first
.
name
end
end
end
features/steps/shared/authentication.rb
View file @
e7dc3bc5
...
@@ -15,13 +15,6 @@ module SharedAuthentication
...
@@ -15,13 +15,6 @@ module SharedAuthentication
gitlab_sign_in
(
create
(
:user
))
gitlab_sign_in
(
create
(
:user
))
end
end
step
'I sign in as an admin'
do
sign_out
(
@user
)
if
@user
@user
=
create
(
:admin
)
sign_in
(
@user
)
end
step
'I should be redirected to sign in page'
do
step
'I should be redirected to sign in page'
do
expect
(
current_path
).
to
eq
new_user_session_path
expect
(
current_path
).
to
eq
new_user_session_path
end
end
...
...
features/steps/shared/paths.rb
View file @
e7dc3bc5
...
@@ -252,10 +252,6 @@ module SharedPaths
...
@@ -252,10 +252,6 @@ module SharedPaths
visit
project_path
(
project
)
visit
project_path
(
project
)
end
end
step
'I visit project "Forked Shop" merge requests page'
do
visit
project_merge_requests_path
(
@forked_project
)
end
step
'I visit edit project "Shop" page'
do
step
'I visit edit project "Shop" page'
do
visit
edit_project_path
(
project
)
visit
edit_project_path
(
project
)
end
end
...
...
spec/features/projects/merge_requests/user_creates_merge_request_spec.rb
View file @
e7dc3bc5
require
'spec_helper'
require
"spec_helper"
describe
'User creates a merge request'
,
:js
do
describe
"User creates a merge request"
,
:js
do
include
ProjectForksHelper
let
(
:title
)
{
"Some feature"
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
before
do
project
.
add_master
(
user
)
project
.
add_master
(
user
)
sign_in
(
user
)
sign_in
(
user
)
end
it
"creates a merge request"
do
visit
(
project_new_merge_request_path
(
project
))
visit
(
project_new_merge_request_path
(
project
))
end
it
'creates a merge request'
do
find
(
".js-source-branch"
).
click
find
(
'.js-source-branch'
).
click
click_link
(
"fix"
)
click_link
(
'fix'
)
find
(
'.js-target-branch'
).
click
find
(
".js-target-branch"
).
click
click_link
(
'feature'
)
click_link
(
"feature"
)
click_button
(
'Compare branches'
)
click_button
(
"Compare branches"
)
fill_in
(
'merge_request_title'
,
with:
'Wiki Feature'
)
fill_in
(
"Title"
,
with:
title
)
click_button
(
'Submit merge request'
)
click_button
(
"Submit merge request"
)
page
.
within
(
'.merge-request'
)
do
page
.
within
(
".merge-request"
)
do
expect
(
page
).
to
have_content
(
'Wiki Feature'
)
expect
(
page
).
to
have_content
(
title
)
end
end
end
context
"to a forked project"
do
let
(
:forked_project
)
{
fork_project
(
project
,
user
,
namespace:
user
.
namespace
,
repository:
true
)
}
it
"creates a merge request"
do
visit
(
project_new_merge_request_path
(
forked_project
))
expect
(
page
).
to
have_content
(
"Source branch"
).
and
have_content
(
"Target branch"
)
expect
(
find
(
"#merge_request_target_project_id"
,
visible:
false
).
value
).
to
eq
(
project
.
id
.
to_s
)
click_button
(
"Compare branches and continue"
)
expect
(
page
).
to
have_content
(
"You must select source and target branch"
)
first
(
".js-source-project"
).
click
first
(
".dropdown-source-project a"
,
text:
forked_project
.
full_path
)
first
(
".js-target-project"
).
click
first
(
".dropdown-target-project a"
,
text:
project
.
full_path
)
first
(
".js-source-branch"
).
click
wait_for_requests
wait_for_requests
source_branch
=
"fix"
first
(
".js-source-branch-dropdown .dropdown-content a"
,
text:
source_branch
).
click
click_button
(
"Compare branches and continue"
)
expect
(
page
).
to
have_css
(
"h3.page-title"
,
text:
"New Merge Request"
)
page
.
within
(
"form#new_merge_request"
)
do
fill_in
(
"Title"
,
with:
title
)
end
click_button
(
"Assignee"
)
expect
(
find
(
".js-assignee-search"
)[
"data-project-id"
]).
to
eq
(
project
.
id
.
to_s
)
page
.
within
(
".dropdown-menu-user"
)
do
expect
(
page
).
to
have_content
(
"Unassigned"
)
.
and
have_content
(
user
.
name
)
.
and
have_content
(
project
.
users
.
first
.
name
)
end
click_button
(
"Submit merge request"
)
expect
(
page
).
to
have_content
(
title
).
and
have_content
(
"Request to merge
#{
user
.
namespace
.
name
}
:
#{
source_branch
}
into master"
)
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