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
Jérome Perrin
gitlab-ce
Commits
7a8514c3
Commit
7a8514c3
authored
Sep 22, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add set_cookie helper
parent
76de6327
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
5 deletions
+26
-5
spec/features/boards/boards_spec.rb
spec/features/boards/boards_spec.rb
+2
-1
spec/features/issues/filtered_search/visual_tokens_spec.rb
spec/features/issues/filtered_search/visual_tokens_spec.rb
+2
-1
spec/features/merge_requests/diff_notes_avatars_spec.rb
spec/features/merge_requests/diff_notes_avatars_spec.rb
+2
-1
spec/features/merge_requests/user_posts_diff_notes_spec.rb
spec/features/merge_requests/user_posts_diff_notes_spec.rb
+3
-2
spec/support/cookie_helper.rb
spec/support/cookie_helper.rb
+17
-0
No files found.
spec/features/boards/boards_spec.rb
View file @
7a8514c3
require
'rails_helper'
require
'rails_helper'
describe
'Issue Boards'
,
js:
true
do
describe
'Issue Boards'
,
js:
true
do
include
CookieHelper
include
DragTo
include
DragTo
let
(
:group
)
{
create
(
:group
,
:nested
)
}
let
(
:group
)
{
create
(
:group
,
:nested
)
}
...
@@ -13,7 +14,7 @@ describe 'Issue Boards', js: true do
...
@@ -13,7 +14,7 @@ describe 'Issue Boards', js: true do
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user2
,
:master
]
project
.
team
<<
[
user2
,
:master
]
page
.
driver
.
set_cookie
(
'sidebar_collapsed'
,
'true'
)
set_cookie
(
'sidebar_collapsed'
,
'true'
)
sign_in
(
user
)
sign_in
(
user
)
end
end
...
...
spec/features/issues/filtered_search/visual_tokens_spec.rb
View file @
7a8514c3
require
'rails_helper'
require
'rails_helper'
describe
'Visual tokens'
,
js:
true
do
describe
'Visual tokens'
,
js:
true
do
include
CookieHelper
include
FilteredSearchHelpers
include
FilteredSearchHelpers
include
WaitForRequests
include
WaitForRequests
...
@@ -28,7 +29,7 @@ describe 'Visual tokens', js: true do
...
@@ -28,7 +29,7 @@ describe 'Visual tokens', js: true do
sign_in
(
user
)
sign_in
(
user
)
create
(
:issue
,
project:
project
)
create
(
:issue
,
project:
project
)
page
.
driver
.
set_cookie
(
'sidebar_collapsed'
,
'true'
)
set_cookie
(
'sidebar_collapsed'
,
'true'
)
visit
project_issues_path
(
project
)
visit
project_issues_path
(
project
)
end
end
...
...
spec/features/merge_requests/diff_notes_avatars_spec.rb
View file @
7a8514c3
require
'spec_helper'
require
'spec_helper'
feature
'Diff note avatars'
,
js:
true
do
feature
'Diff note avatars'
,
js:
true
do
include
CookieHelper
include
NoteInteractionHelpers
include
NoteInteractionHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
...
@@ -22,7 +23,7 @@ feature 'Diff note avatars', js: true do
...
@@ -22,7 +23,7 @@ feature 'Diff note avatars', js: true do
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
sign_in
user
sign_in
user
page
.
driver
.
set_cookie
(
'sidebar_collapsed'
,
'true'
)
set_cookie
(
'sidebar_collapsed'
,
'true'
)
end
end
context
'discussion tab'
do
context
'discussion tab'
do
...
...
spec/features/merge_requests/user_posts_diff_notes_spec.rb
View file @
7a8514c3
require
'spec_helper'
require
'spec_helper'
feature
'Merge requests > User posts diff notes'
,
:js
do
feature
'Merge requests > User posts diff notes'
,
:js
do
include
CookieHelper
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:merge_request
)
{
create
(
:merge_request
)
}
let
(
:merge_request
)
{
create
(
:merge_request
)
}
let
(
:project
)
{
merge_request
.
source_project
}
let
(
:project
)
{
merge_request
.
source_project
}
before
do
before
do
visit
'/'
set_cookie
(
'sidebar_collapsed'
,
'true'
)
page
.
driver
.
browser
.
manage
.
add_cookie
(
name:
'sidebar_collapsed'
,
value:
'true'
)
project
.
add_developer
(
user
)
project
.
add_developer
(
user
)
sign_in
(
user
)
sign_in
(
user
)
...
...
spec/support/cookie_helper.rb
0 → 100644
View file @
7a8514c3
# Helper for setting cookies in Selenium/WebDriver
#
module
CookieHelper
def
set_cookie
(
name
,
value
,
options
=
{})
# Selenium driver will not set cookies for a given domain when the browser is at `about:blank`.
# It also doesn't appear to allow overriding the cookie path. loading `/` is the most inclusive.
visit
options
.
fetch
(
:path
,
'/'
)
unless
on_a_page?
page
.
driver
.
browser
.
manage
.
add_cookie
(
name:
name
,
value:
value
,
**
options
)
end
private
def
on_a_page?
current_url
=
Capybara
.
current_session
.
driver
.
browser
.
current_url
current_url
&&
current_url
!=
''
&&
current_url
!=
'about:blank'
&&
current_url
!=
'data:,'
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