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
9647d2e7
Commit
9647d2e7
authored
Jun 07, 2017
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enhancing Spec's with negative cases
parent
bf601f07
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
148 deletions
+55
-148
features/explore/new_menu.feature
features/explore/new_menu.feature
+0
-55
features/steps/explore/new_menu.rb
features/steps/explore/new_menu.rb
+0
-81
spec/features/explore/new_menu_spec.rb
spec/features/explore/new_menu_spec.rb
+55
-12
No files found.
features/explore/new_menu.feature
deleted
100644 → 0
View file @
bf601f07
@explore
Feature
:
New Menu
Background
:
Given
I sign in as
"John Doe"
And
"John Doe"
is owner of group
"Owned"
And
I own project
"Shop"
And
I visit dashboard page
@javascript
Scenario
:
I
should see New Projects page
When
I visit dashboard page
And
I click
"New project"
in top right menu
Then
I see
"New Project"
page
@javascript
Scenario
:
I
should see New Group page
When
I visit dashboard page
And
I click
"New group"
in top right menu
Then
I see
"New Group"
page
@javascript
Scenario
:
I
should see New Snippet page
When
I visit dashboard page
And
I click
"New snippet"
in top right menu
Then
I see
"New Snippet"
page
@javascript
Scenario
:
I
should see New Issue page
When
I visit project
"Shop"
page
And
I click
"New issue"
in top right menu
Then
I see
"New Issue"
page
@javascript
Scenario
:
I
should see New Merge Request page
When
I visit project
"Shop"
page
And
I click
"New merge request"
in top right menu
Then
I see
"New Merge Request"
page
@javascript
Scenario
:
I
should see New Project Snippet page
When
I visit project
"Shop"
page
And
I click
"New project snippet"
in top right menu
Then
I see
"New Snippet"
page
@javascript
Scenario
:
I
should see New Group Project page
When
I visit group
"Owned"
page
And
I click
"New group project"
in top right menu
Then
I see
"New Project"
page
@javascript
Scenario
:
I
should see New Subgroup page
When
I visit group
"Owned"
page
And
I click
"New subgroup"
in top right menu
Then
I see
"New Group"
page
features/steps/explore/new_menu.rb
deleted
100644 → 0
View file @
bf601f07
class
Spinach::Features::NewMenu
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedPaths
include
SharedProject
include
SharedGroup
include
SharedUser
step
'I click "New project" in top right menu'
do
click_topmenuitem
(
"New project"
)
end
step
'I click "New group" in top right menu'
do
click_topmenuitem
(
"New group"
)
end
step
'I click "New snippet" in top right menu'
do
click_topmenuitem
(
"New snippet"
)
end
step
'I click "New project snippet" in top right menu'
do
page
.
within
'.header-content'
do
find
(
'.header-new-dropdown-toggle'
).
trigger
(
'click'
)
expect
(
page
).
to
have_selector
(
'.header-new.dropdown.open'
,
count:
1
)
find
(
'.header-new-project-snippet a'
).
trigger
(
'click'
)
end
end
step
'I click "New issue" in top right menu'
do
click_topmenuitem
(
"New issue"
)
end
step
'I click "New merge request" in top right menu'
do
click_topmenuitem
(
"New merge request"
)
end
step
'I click "New subgroup" in top right menu'
do
click_topmenuitem
(
"New subgroup"
)
end
step
'I click "New group project" in top right menu'
do
page
.
within
'.header-content'
do
find
(
'.header-new-dropdown-toggle'
).
trigger
(
'click'
)
expect
(
page
).
to
have_selector
(
'.header-new.dropdown.open'
,
count:
1
)
find
(
'.header-new-group-project a'
).
trigger
(
'click'
)
end
end
step
'I see "New Project" page'
do
expect
(
page
).
to
have_content
(
'Project path'
)
expect
(
page
).
to
have_content
(
'Project name'
)
end
step
'I see "New Group" page'
do
expect
(
page
).
to
have_content
(
'Group path'
)
expect
(
page
).
to
have_content
(
'Group name'
)
end
step
'I see "New Snippet" page'
do
expect
(
page
).
to
have_content
(
'New Snippet'
)
expect
(
page
).
to
have_content
(
'Title'
)
end
step
'I see "New Issue" page'
do
expect
(
page
).
to
have_content
(
'New Issue'
)
expect
(
page
).
to
have_content
(
'Title'
)
end
step
'I see "New Merge Request" page'
do
expect
(
page
).
to
have_content
(
'New Merge Request'
)
expect
(
page
).
to
have_content
(
'Source branch'
)
expect
(
page
).
to
have_content
(
'Target branch'
)
end
def
click_topmenuitem
(
item_name
)
page
.
within
'.header-content'
do
find
(
'.header-new-dropdown-toggle'
).
trigger
(
'click'
)
expect
(
page
).
to
have_selector
(
'.header-new.dropdown.open'
,
count:
1
)
click_link
item_name
end
end
end
spec/features/explore/new_menu_spec.rb
View file @
9647d2e7
require
'spec_helper'
require
'spec_helper'
feature
'Top Plus Menu'
,
feature:
true
,
js:
true
do
feature
'Top Plus Menu'
,
feature:
true
,
js:
true
do
let
!
(
:user
)
{
create
:user
}
let
(
:user
)
{
create
:user
}
let
!
(
:group
)
{
create
(
:group
)
}
let
(
:guest_user
)
{
create
:user
}
let
!
(
:public_group
)
{
create
(
:group
,
:public
)
}
let
(
:group
)
{
create
(
:group
)
}
let
!
(
:private_group
)
{
create
(
:group
,
:private
)
}
let
(
:public_group
)
{
create
(
:group
,
:public
)
}
let
!
(
:empty_project
)
{
create
(
:empty_project
,
group:
public_group
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
creator:
user
,
namespace:
user
.
namespace
)
}
before
do
before
do
group
.
add_owner
(
user
)
group
.
add_owner
(
user
)
group
.
add_guest
(
guest_user
)
login_as
(
user
)
project
.
add_guest
(
guest_user
)
visit
explore_groups_path
end
end
context
'used by full user'
do
context
'used by full user'
do
before
do
before
do
login_as
:user
login_as
(
user
)
end
end
scenario
'click on New project shows new project page'
do
scenario
'click on New project shows new project page'
do
...
@@ -48,7 +47,7 @@ feature 'Top Plus Menu', feature: true, js: true do
...
@@ -48,7 +47,7 @@ feature 'Top Plus Menu', feature: true, js: true do
end
end
scenario
'click on New issue shows new issue page'
do
scenario
'click on New issue shows new issue page'
do
visit
namespace_project_path
(
empty_project
.
namespace
,
empty_
project
)
visit
namespace_project_path
(
project
.
namespace
,
project
)
click_topmenuitem
(
"New issue"
)
click_topmenuitem
(
"New issue"
)
...
@@ -57,7 +56,7 @@ feature 'Top Plus Menu', feature: true, js: true do
...
@@ -57,7 +56,7 @@ feature 'Top Plus Menu', feature: true, js: true do
end
end
scenario
'click on New merge request shows new merge request page'
do
scenario
'click on New merge request shows new merge request page'
do
visit
namespace_project_path
(
empty_project
.
namespace
,
empty_
project
)
visit
namespace_project_path
(
project
.
namespace
,
project
)
click_topmenuitem
(
"New merge request"
)
click_topmenuitem
(
"New merge request"
)
...
@@ -67,7 +66,7 @@ feature 'Top Plus Menu', feature: true, js: true do
...
@@ -67,7 +66,7 @@ feature 'Top Plus Menu', feature: true, js: true do
end
end
scenario
'click on New project snippet shows new snippet page'
do
scenario
'click on New project snippet shows new snippet page'
do
visit
namespace_project_path
(
empty_project
.
namespace
,
empty_
project
)
visit
namespace_project_path
(
project
.
namespace
,
project
)
page
.
within
'.header-content'
do
page
.
within
'.header-content'
do
find
(
'.header-new-dropdown-toggle'
).
trigger
(
'click'
)
find
(
'.header-new-dropdown-toggle'
).
trigger
(
'click'
)
...
@@ -102,6 +101,45 @@ feature 'Top Plus Menu', feature: true, js: true do
...
@@ -102,6 +101,45 @@ feature 'Top Plus Menu', feature: true, js: true do
end
end
end
end
context
'used by guest user'
do
before
do
login_as
(
guest_user
)
end
scenario
'click on New issue shows new issue page'
do
visit
namespace_project_path
(
project
.
namespace
,
project
)
click_topmenuitem
(
"New issue"
)
expect
(
page
).
to
have_content
(
'New Issue'
)
expect
(
page
).
to
have_content
(
'Title'
)
end
scenario
'has no New merge request menu item'
do
visit
namespace_project_path
(
project
.
namespace
,
project
)
hasnot_topmenuitem
(
"New merge request"
)
end
scenario
'has no New project snippet menu item'
do
visit
namespace_project_path
(
project
.
namespace
,
project
)
expect
(
find
(
'.header-new.dropdown'
)).
not_to
have_selector
(
'.header-new-project-snippet'
)
end
scenario
'has no New subgroup menu item'
do
visit
group_path
(
group
)
hasnot_topmenuitem
(
"New subgroup"
)
end
scenario
'has no New project for group menu item'
do
visit
group_path
(
group
)
expect
(
find
(
'.header-new.dropdown'
)).
not_to
have_selector
(
'.header-new-group-project'
)
end
end
def
click_topmenuitem
(
item_name
)
def
click_topmenuitem
(
item_name
)
page
.
within
'.header-content'
do
page
.
within
'.header-content'
do
find
(
'.header-new-dropdown-toggle'
).
trigger
(
'click'
)
find
(
'.header-new-dropdown-toggle'
).
trigger
(
'click'
)
...
@@ -109,4 +147,9 @@ feature 'Top Plus Menu', feature: true, js: true do
...
@@ -109,4 +147,9 @@ feature 'Top Plus Menu', feature: true, js: true do
click_link
item_name
click_link
item_name
end
end
end
end
def
hasnot_topmenuitem
(
item_name
)
expect
(
find
(
'.header-new.dropdown'
)).
not_to
have_content
(
item_name
)
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