Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
44ec3db4
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
44ec3db4
编写于
2月 15, 2018
作者:
S
Semyon Pupkov
提交者:
Rémy Coutable
2月 15, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move spinach group milestones test to RSpec
上级
677951e3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
114 addition
and
220 deletion
+114
-220
features/group/milestones.feature
features/group/milestones.feature
+0
-48
features/steps/group/milestones.rb
features/steps/group/milestones.rb
+0
-135
spec/features/groups/milestone_spec.rb
spec/features/groups/milestone_spec.rb
+114
-37
未找到文件。
features/group/milestones.feature
已删除
100644 → 0
浏览文件 @
677951e3
Feature
:
Group Milestones
Background
:
Given
I sign in as
"John Doe"
And
"John Doe"
is owner of group
"Owned"
Scenario
:
I
should see group
"Owned"
milestone index page with no milestones
When
I visit group
"Owned"
page
And
I click on group milestones
Then
I should see group milestones index page has no milestones
Scenario
:
I
should see group
"Owned"
milestone index page with milestones
Given
Group has projects with milestones
When
I visit group
"Owned"
page
And
I click on group milestones
Then
I should see group milestones index page with milestones
Scenario
:
I
should see group
"Owned"
milestone show page
Given
Group has projects with milestones
When
I visit group
"Owned"
page
And
I click on group milestones
And
I click on one group milestone
Then
I should see group milestone with descriptions and expiry date
And
I should see group milestone with all issues and MRs assigned to that milestone
Scenario
:
Create group milestones
Given
I visit group
"Owned"
milestones page
And
I click new milestone button
And
I fill milestone name
When
I press create mileston button
Then
group milestone should be created
Scenario
:
I
should see Issues listed with labels
Given
Group has projects with milestones
When
I visit group
"Owned"
page
And
I click on group milestones
And
I click on one group milestone
Then
I should see the
"bug"
label
And
I should see the
"feature"
label
And
I should see the project name in the Issue row
@javascript
Scenario
:
I
should see the Labels tab
Given
Group has projects with milestones
When
I visit group
"Owned"
page
And
I click on group milestones
And
I click on one group milestone
And
I click on the
"Labels"
tab
Then
I should see the list of labels
features/steps/group/milestones.rb
已删除
100644 → 0
浏览文件 @
677951e3
class
Spinach::Features::GroupMilestones
<
Spinach
::
FeatureSteps
include
WaitForRequests
include
SharedAuthentication
include
SharedPaths
include
SharedGroup
include
SharedUser
step
'I click on group milestones'
do
visit
group_milestones_path
(
'owned'
)
end
step
'I should see group milestones index page has no milestones'
do
expect
(
page
).
to
have_content
(
'No milestones to show'
)
end
step
'Group has projects with milestones'
do
group_milestone
end
step
'I should see group milestones index page with milestones'
do
expect
(
page
).
to
have_content
(
'Version 7.2'
)
expect
(
page
).
to
have_content
(
'GL-113'
)
expect
(
page
).
to
have_link
(
'3 Issues'
,
href:
issues_group_path
(
"owned"
,
milestone_title:
"Version 7.2"
))
expect
(
page
).
to
have_link
(
'0 Merge Requests'
,
href:
merge_requests_group_path
(
"owned"
,
milestone_title:
"GL-113"
))
end
step
'I click on one group milestone'
do
milestones
=
Milestone
.
where
(
title:
'GL-113'
)
@global_milestone
=
GlobalMilestone
.
new
(
'GL-113'
,
milestones
)
click_link
'GL-113'
end
step
'I should see group milestone with descriptions and expiry date'
do
expect
(
page
).
to
have_content
(
'expires on Aug 20, 2114'
)
end
step
'I should see group milestone with all issues and MRs assigned to that milestone'
do
expect
(
page
).
to
have_content
(
'Milestone GL-113'
)
expect
(
page
).
to
have_content
(
'Issues 3 Open: 3 Closed: 0'
)
issue
=
Milestone
.
find_by
(
name:
'GL-113'
).
issues
.
first
expect
(
page
).
to
have_link
(
issue
.
title
,
href:
project_issue_path
(
issue
.
project
,
issue
))
end
step
'I fill milestone name'
do
fill_in
'milestone_title'
,
with:
'v2.9.0'
end
step
'I click new milestone button'
do
page
.
within
(
'.nav-controls'
)
do
click_link
"New milestone"
end
end
step
'I press create mileston button'
do
click_button
"Create milestone"
end
step
'group milestone should be created'
do
group
=
Group
.
find_by
(
name:
'Owned'
)
expect
(
page
).
to
have_content
group
.
milestones
.
find_by_title
(
'v2.9.0'
).
title
end
step
'I should see the "bug" label'
do
page
.
within
(
'#tab-issues'
)
do
expect
(
page
).
to
have_content
'bug'
end
end
step
'I should see the "feature" label'
do
page
.
within
(
'#tab-issues'
)
do
expect
(
page
).
to
have_content
'bug'
end
end
step
'I should see the project name in the Issue row'
do
page
.
within
(
'#tab-issues'
)
do
@global_milestone
.
projects
.
each
do
|
project
|
expect
(
page
).
to
have_content
project
.
name
end
end
end
step
'I click on the "Labels" tab'
do
page
.
within
(
'.content .nav-links'
)
do
page
.
find
(
:xpath
,
"//a[@href='#tab-labels']"
).
click
end
end
step
'I should see the list of labels'
do
wait_for_requests
page
.
within
(
'#tab-labels'
)
do
expect
(
page
).
to
have_content
'bug'
expect
(
page
).
to
have_content
'feature'
end
end
private
def
group_milestone
group
=
owned_group
%w(gitlabhq gitlab-ci cookbook-gitlab)
.
each
do
|
path
|
project
=
create
(
:project
,
path:
path
,
group:
group
)
milestone
=
create
:milestone
,
title:
"Version 7.2"
,
project:
project
create
(
:label
,
project:
project
,
title:
'bug'
)
create
(
:label
,
project:
project
,
title:
'feature'
)
create
:issue
,
project:
project
,
assignees:
[
current_user
],
author:
current_user
,
milestone:
milestone
milestone
=
create
:milestone
,
title:
"GL-113"
,
project:
project
,
due_date:
'2114-08-20'
,
description:
'Lorem Ipsum is simply dummy text'
issue
=
create
:issue
,
project:
project
,
assignees:
[
current_user
],
author:
current_user
,
milestone:
milestone
issue
.
labels
<<
project
.
labels
.
find_by
(
title:
'bug'
)
issue
.
labels
<<
project
.
labels
.
find_by
(
title:
'feature'
)
end
current_user
.
refresh_authorized_projects
end
end
spec/features/groups/milestone_spec.rb
浏览文件 @
44ec3db4
require
'rails_helper'
feature
'Group milestones'
,
:js
do
feature
'Group milestones'
do
let
(
:group
)
{
create
(
:group
)
}
let!
(
:project
)
{
create
(
:project_empty_repo
,
group:
group
)
}
let
(
:user
)
{
create
(
:group_member
,
:master
,
user:
create
(
:user
),
group:
group
).
user
}
...
...
@@ -13,7 +13,7 @@ feature 'Group milestones', :js do
sign_in
(
user
)
end
context
'create a milestone'
do
context
'create a milestone'
,
:js
do
before
do
visit
new_group_milestone_path
(
group
)
end
...
...
@@ -61,55 +61,132 @@ feature 'Group milestones', :js do
end
context
'milestones list'
do
let!
(
:other_project
)
{
create
(
:project_empty_repo
,
group:
group
)
}
let!
(
:active_project_milestone1
)
{
create
(
:milestone
,
project:
project
,
state:
'active'
,
title:
'v1.0'
)
}
let!
(
:active_project_milestone2
)
{
create
(
:milestone
,
project:
other_project
,
state:
'active'
,
title:
'v1.0'
)
}
let!
(
:closed_project_milestone1
)
{
create
(
:milestone
,
project:
project
,
state:
'closed'
,
title:
'v2.0'
)
}
let!
(
:closed_project_milestone2
)
{
create
(
:milestone
,
project:
other_project
,
state:
'closed'
,
title:
'v2.0'
)
}
let!
(
:active_group_milestone
)
{
create
(
:milestone
,
group:
group
,
state:
'active'
)
}
let!
(
:closed_group_milestone
)
{
create
(
:milestone
,
group:
group
,
state:
'closed'
)
}
before
do
visit
group_milestones_path
(
group
)
context
'when no milestones'
do
it
'renders no milestones text'
do
visit
group_milestones_path
(
group
)
expect
(
page
).
to
have_content
(
'No milestones to show'
)
end
end
it
'counts milestones correctly'
do
expect
(
find
(
'.top-area .active .badge'
).
text
).
to
eq
(
"2"
)
expect
(
find
(
'.top-area .closed .badge'
).
text
).
to
eq
(
"2"
)
expect
(
find
(
'.top-area .all .badge'
).
text
).
to
eq
(
"4"
)
end
context
'when milestones exists'
do
let!
(
:other_project
)
{
create
(
:project_empty_repo
,
group:
group
)
}
let!
(
:active_project_milestone1
)
do
create
(
:milestone
,
project:
project
,
state:
'active'
,
title:
'v1.0'
,
due_date:
'2114-08-20'
,
description:
'Lorem Ipsum is simply dummy text'
)
end
let!
(
:active_project_milestone2
)
{
create
(
:milestone
,
project:
other_project
,
state:
'active'
,
title:
'v1.0'
)
}
let!
(
:closed_project_milestone1
)
{
create
(
:milestone
,
project:
project
,
state:
'closed'
,
title:
'v2.0'
)
}
let!
(
:closed_project_milestone2
)
{
create
(
:milestone
,
project:
other_project
,
state:
'closed'
,
title:
'v2.0'
)
}
let!
(
:active_group_milestone
)
{
create
(
:milestone
,
group:
group
,
state:
'active'
,
title:
'GL-113'
)
}
let!
(
:closed_group_milestone
)
{
create
(
:milestone
,
group:
group
,
state:
'closed'
)
}
let!
(
:issue
)
do
create
:issue
,
project:
project
,
assignees:
[
user
],
author:
user
,
milestone:
active_project_milestone1
end
it
'lists legacy group milestones and group milestones'
do
legacy_milestone
=
GroupMilestone
.
build_collection
(
group
,
group
.
projects
,
{
state:
'active'
}).
first
before
do
visit
group_milestones_path
(
group
)
end
expect
(
page
).
to
have_selector
(
"#milestone_
#{
active_group_milestone
.
id
}
"
,
count:
1
)
expect
(
page
).
to
have_selector
(
"#milestone_
#{
legacy_milestone
.
milestones
.
first
.
id
}
"
,
count:
1
)
end
it
'counts milestones correctly'
do
expect
(
find
(
'.top-area .active .badge'
).
text
).
to
eq
(
"2"
)
expect
(
find
(
'.top-area .closed .badge'
).
text
).
to
eq
(
"2"
)
expect
(
find
(
'.top-area .all .badge'
).
text
).
to
eq
(
"4"
)
end
it
'updates milestone'
do
page
.
within
(
".milestones #milestone_
#{
active_group_milestone
.
id
}
"
)
do
click_link
(
'Edit'
)
it
'lists legacy group milestones and group milestones'
do
legacy_milestone
=
GroupMilestone
.
build_collection
(
group
,
group
.
projects
,
{
state:
'active'
}).
first
expect
(
page
).
to
have_selector
(
"#milestone_
#{
active_group_milestone
.
id
}
"
,
count:
1
)
expect
(
page
).
to
have_selector
(
"#milestone_
#{
legacy_milestone
.
milestones
.
first
.
id
}
"
,
count:
1
)
end
page
.
within
(
'.milestone-form'
)
do
fill_in
'milestone_title'
,
with:
'new title'
click_button
(
'Update milestone'
)
it
'updates milestone'
do
page
.
within
(
".milestones #milestone_
#{
active_group_milestone
.
id
}
"
)
do
click_link
(
'Edit'
)
end
page
.
within
(
'.milestone-form'
)
do
fill_in
'milestone_title'
,
with:
'new title'
click_button
(
'Update milestone'
)
end
expect
(
find
(
'#content-body h2'
)).
to
have_content
(
'new title'
)
end
expect
(
find
(
'#content-body h2'
)).
to
have_content
(
'new title'
)
end
it
'shows milestone detail and supports its edit'
do
page
.
within
(
".milestones #milestone_
#{
active_group_milestone
.
id
}
"
)
do
click_link
(
active_group_milestone
.
title
)
end
page
.
within
(
'.detail-page-header'
)
do
click_link
(
'Edit'
)
end
it
'shows milestone detail and supports its edit'
do
page
.
within
(
".milestones #milestone_
#{
active_group_milestone
.
id
}
"
)
do
click_link
(
active_group_milestone
.
title
)
expect
(
page
).
to
have_selector
(
'.milestone-form'
)
end
page
.
within
(
'.detail-page-header'
)
do
click_link
(
'Edit'
)
it
'renders milestones'
do
expect
(
page
).
to
have_content
(
'v1.0'
)
expect
(
page
).
to
have_content
(
'GL-113'
)
expect
(
page
).
to
have_link
(
'1 Issue'
,
href:
issues_group_path
(
group
,
milestone_title:
'v1.0'
)
)
expect
(
page
).
to
have_link
(
'0 Merge Requests'
,
href:
merge_requests_group_path
(
group
,
milestone_title:
'v1.0'
)
)
end
expect
(
page
).
to
have_selector
(
'.milestone-form'
)
it
'renders group milestone details'
do
click_link
'v1.0'
expect
(
page
).
to
have_content
(
'expires on Aug 20, 2114'
)
expect
(
page
).
to
have_content
(
'v1.0'
)
expect
(
page
).
to
have_content
(
'Issues 1 Open: 1 Closed: 0'
)
expect
(
page
).
to
have_link
(
issue
.
title
,
href:
project_issue_path
(
issue
.
project
,
issue
))
end
describe
'labels'
do
before
do
create
(
:label
,
project:
project
,
title:
'bug'
)
do
|
label
|
issue
.
labels
<<
label
end
create
(
:label
,
project:
project
,
title:
'feature'
)
do
|
label
|
issue
.
labels
<<
label
end
end
it
'renders labels'
do
click_link
'v1.0'
page
.
within
(
'#tab-issues'
)
do
expect
(
page
).
to
have_content
'bug'
expect
(
page
).
to
have_content
'feature'
end
end
it
'renders labels list'
,
:js
do
click_link
'v1.0'
page
.
within
(
'.content .nav-links'
)
do
page
.
find
(
:xpath
,
"//a[@href='#tab-labels']"
).
click
end
page
.
within
(
'#tab-labels'
)
do
expect
(
page
).
to
have_content
'bug'
expect
(
page
).
to
have_content
'feature'
end
end
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录