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
14165f3a
Commit
14165f3a
authored
Jan 16, 2019
by
Walmyr
Committed by
Rémy Coutable
Jan 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test case to check that branches are correctly listed after CRUD operations
parent
1ffc123d
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
246 additions
and
31 deletions
+246
-31
app/views/layouts/nav/sidebar/_project.html.haml
app/views/layouts/nav/sidebar/_project.html.haml
+2
-2
app/views/projects/branches/_branch.html.haml
app/views/projects/branches/_branch.html.haml
+1
-1
app/views/projects/branches/_panel.html.haml
app/views/projects/branches/_panel.html.haml
+1
-1
app/views/projects/branches/index.html.haml
app/views/projects/branches/index.html.haml
+1
-1
qa/qa.rb
qa/qa.rb
+9
-0
qa/qa/git/repository.rb
qa/qa/git/repository.rb
+7
-6
qa/qa/page/project/branches/show.rb
qa/qa/page/project/branches/show.rb
+62
-0
qa/qa/page/project/menu.rb
qa/qa/page/project/menu.rb
+3
-19
qa/qa/page/project/sub_menus/common.rb
qa/qa/page/project/sub_menus/common.rb
+23
-0
qa/qa/page/project/sub_menus/repository.rb
qa/qa/page/project/sub_menus/repository.rb
+44
-0
qa/qa/resource/repository/push.rb
qa/qa/resource/repository/push.rb
+1
-1
qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb
...r_ui/3_create/repository/add_list_delete_branches_spec.rb
+92
-0
No files found.
app/views/layouts/nav/sidebar/_project.html.haml
View file @
14165f3a
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
-
if
project_nav_tab?
:files
-
if
project_nav_tab?
:files
=
nav_link
(
controller:
sidebar_repository_paths
)
do
=
nav_link
(
controller:
sidebar_repository_paths
)
do
=
link_to
project_tree_path
(
@project
),
class:
'shortcuts-tree'
do
=
link_to
project_tree_path
(
@project
),
class:
'shortcuts-tree
qa-project-menu-repo
'
do
.nav-icon-container
.nav-icon-container
=
sprite_icon
(
'doc-text'
)
=
sprite_icon
(
'doc-text'
)
%span
.nav-item-name
%span
.nav-item-name
...
@@ -64,7 +64,7 @@
...
@@ -64,7 +64,7 @@
=
_
(
'Commits'
)
=
_
(
'Commits'
)
=
nav_link
(
html_options:
{
class:
branches_tab_class
})
do
=
nav_link
(
html_options:
{
class:
branches_tab_class
})
do
=
link_to
project_branches_path
(
@project
)
do
=
link_to
project_branches_path
(
@project
)
,
class:
'qa-branches-link'
do
=
_
(
'Branches'
)
=
_
(
'Branches'
)
=
nav_link
(
controller:
[
:tags
])
do
=
nav_link
(
controller:
[
:tags
])
do
...
...
app/views/projects/branches/_branch.html.haml
View file @
14165f3a
...
@@ -76,7 +76,7 @@
...
@@ -76,7 +76,7 @@
=
icon
(
"trash-o"
)
=
icon
(
"trash-o"
)
-
else
-
else
=
link_to
project_branch_path
(
@project
,
branch
.
name
),
=
link_to
project_branch_path
(
@project
,
branch
.
name
),
class:
"btn btn-remove remove-row js-ajax-loading-spinner has-tooltip"
,
class:
"btn btn-remove remove-row
qa-remove-btn
js-ajax-loading-spinner has-tooltip"
,
title:
s_
(
'Branches|Delete branch'
),
title:
s_
(
'Branches|Delete branch'
),
method: :delete
,
method: :delete
,
data:
{
confirm:
s_
(
"Branches|Deleting the '%{branch_name}' branch cannot be undone. Are you sure?"
)
%
{
branch_name:
branch
.
name
}
},
data:
{
confirm:
s_
(
"Branches|Deleting the '%{branch_name}' branch cannot be undone. Are you sure?"
)
%
{
branch_name:
branch
.
name
}
},
...
...
app/views/projects/branches/_panel.html.haml
View file @
14165f3a
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
.card.prepend-top-10
.card.prepend-top-10
.card-header
.card-header
=
panel_title
=
panel_title
%ul
.content-list.all-branches
%ul
.content-list.all-branches
.qa-all-branches
-
branches
.
first
(
overview_max_branches
).
each
do
|
branch
|
-
branches
.
first
(
overview_max_branches
).
each
do
|
branch
|
=
render
"projects/branches/branch"
,
branch:
branch
,
merged:
project
.
repository
.
merged_to_root_ref?
(
branch
)
=
render
"projects/branches/branch"
,
branch:
branch
,
merged:
project
.
repository
.
merged_to_root_ref?
(
branch
)
-
if
branches
.
size
>
overview_max_branches
-
if
branches
.
size
>
overview_max_branches
...
...
app/views/projects/branches/index.html.haml
View file @
14165f3a
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
-
if
can?
current_user
,
:push_code
,
@project
-
if
can?
current_user
,
:push_code
,
@project
=
link_to
project_merged_branches_path
(
@project
),
=
link_to
project_merged_branches_path
(
@project
),
class:
'btn btn-inverted btn-remove has-tooltip'
,
class:
'btn btn-inverted btn-remove has-tooltip
qa-delete-merged-branches
'
,
title:
s_
(
"Branches|Delete all branches that are merged into '%{default_branch}'"
)
%
{
default_branch:
@project
.
repository
.
root_ref
},
title:
s_
(
"Branches|Delete all branches that are merged into '%{default_branch}'"
)
%
{
default_branch:
@project
.
repository
.
root_ref
},
method: :delete
,
method: :delete
,
data:
{
confirm:
s_
(
'Branches|Deleting the merged branches cannot be undone. Are you sure?'
),
data:
{
confirm:
s_
(
'Branches|Deleting the merged branches cannot be undone. Are you sure?'
),
...
...
qa/qa.rb
View file @
14165f3a
...
@@ -158,6 +158,10 @@ module QA
...
@@ -158,6 +158,10 @@ module QA
autoload
:Activity
,
'qa/page/project/activity'
autoload
:Activity
,
'qa/page/project/activity'
autoload
:Menu
,
'qa/page/project/menu'
autoload
:Menu
,
'qa/page/project/menu'
module
Branches
autoload
:Show
,
'qa/page/project/branches/show'
end
module
Commit
module
Commit
autoload
:Show
,
'qa/page/project/commit/show'
autoload
:Show
,
'qa/page/project/commit/show'
end
end
...
@@ -191,6 +195,11 @@ module QA
...
@@ -191,6 +195,11 @@ module QA
autoload
:MirroringRepositories
,
'qa/page/project/settings/mirroring_repositories'
autoload
:MirroringRepositories
,
'qa/page/project/settings/mirroring_repositories'
end
end
module
SubMenus
autoload
:Common
,
'qa/page/project/sub_menus/common'
autoload
:Repository
,
'qa/page/project/sub_menus/repository'
end
module
Issue
module
Issue
autoload
:New
,
'qa/page/project/issue/new'
autoload
:New
,
'qa/page/project/issue/new'
autoload
:Show
,
'qa/page/project/issue/show'
autoload
:Show
,
'qa/page/project/issue/show'
...
...
qa/qa/git/repository.rb
View file @
14165f3a
...
@@ -46,12 +46,9 @@ module QA
...
@@ -46,12 +46,9 @@ module QA
run
(
"git clone
#{
opts
}
#{
uri
}
./"
)
run
(
"git clone
#{
opts
}
#{
uri
}
./"
)
end
end
def
checkout
(
branch_name
)
def
checkout
(
branch_name
,
new_branch:
false
)
run
(
%Q{git checkout "
#{
branch_name
}
"}
)
opts
=
new_branch
?
'-b'
:
''
end
run
(
%Q{git checkout
#{
opts
}
"
#{
branch_name
}
"}
).
to_s
def
checkout_new_branch
(
branch_name
)
run
(
%Q{git checkout -b "
#{
branch_name
}
"}
)
end
end
def
shallow_clone
def
shallow_clone
...
@@ -84,6 +81,10 @@ module QA
...
@@ -84,6 +81,10 @@ module QA
run
(
"git push
#{
uri
}
#{
branch
}
"
)
run
(
"git push
#{
uri
}
#{
branch
}
"
)
end
end
def
merge
(
branch
)
run
(
"git merge
#{
branch
}
"
)
end
def
commits
def
commits
run
(
'git log --oneline'
).
split
(
"
\n
"
)
run
(
'git log --oneline'
).
split
(
"
\n
"
)
end
end
...
...
qa/qa/page/project/branches/show.rb
0 → 100644
View file @
14165f3a
# frozen_string_literal: true
module
QA
module
Page
module
Project
module
Branches
class
Show
<
Page
::
Base
view
'app/views/projects/branches/_branch.html.haml'
do
element
:remove_btn
end
view
'app/views/projects/branches/_panel.html.haml'
do
element
:all_branches
end
view
'app/views/projects/branches/index.html.haml'
do
element
:delete_merged_branches
end
def
delete_branch
(
branch_name
)
within_element
(
:all_branches
)
do
within
(
".js-branch-
#{
branch_name
}
"
)
do
accept_alert
do
find_element
(
:remove_btn
).
click
end
end
end
end
def
has_branch_title?
(
branch_title
)
within_element
(
:all_branches
)
do
within
(
".item-title"
)
do
has_text?
(
branch_title
)
end
end
end
def
has_branch_with_badge?
(
branch_name
,
badge
)
within_element
(
:all_branches
)
do
within
(
".js-branch-
#{
branch_name
}
.badge"
)
do
has_text?
(
badge
)
end
end
end
def
delete_merged_branches
accept_alert
do
click_element
(
:delete_merged_branches
)
end
end
def
wait_for_texts_not_to_be_visible
(
texts
)
text_not_visible
=
wait
do
texts
.
all?
do
|
text
|
has_no_text?
(
text
)
end
end
raise
"Expected text(s)
#{
texts
}
not to be visible"
unless
text_not_visible
end
end
end
end
end
end
qa/qa/page/project/menu.rb
View file @
14165f3a
...
@@ -4,10 +4,12 @@ module QA
...
@@ -4,10 +4,12 @@ module QA
module
Page
module
Page
module
Project
module
Project
class
Menu
<
Page
::
Base
class
Menu
<
Page
::
Base
include
SubMenus
::
Common
include
SubMenus
::
Repository
view
'app/views/layouts/nav/sidebar/_project.html.haml'
do
view
'app/views/layouts/nav/sidebar/_project.html.haml'
do
element
:settings_item
element
:settings_item
element
:settings_link
,
'link_to edit_project_path'
# rubocop:disable QA/ElementWithPattern
element
:settings_link
,
'link_to edit_project_path'
# rubocop:disable QA/ElementWithPattern
element
:repository_link
,
"title: _('Repository')"
# rubocop:disable QA/ElementWithPattern
element
:link_pipelines
element
:link_pipelines
element
:link_members_settings
element
:link_members_settings
element
:pipelines_settings_link
,
"title: _('CI / CD')"
# rubocop:disable QA/ElementWithPattern
element
:pipelines_settings_link
,
"title: _('CI / CD')"
# rubocop:disable QA/ElementWithPattern
...
@@ -85,12 +87,6 @@ module QA
...
@@ -85,12 +87,6 @@ module QA
end
end
end
end
def
click_repository
within_sidebar
do
click_link
(
'Repository'
)
end
end
def
click_repository_settings
def
click_repository_settings
hover_settings
do
hover_settings
do
within_submenu
do
within_submenu
do
...
@@ -150,18 +146,6 @@ module QA
...
@@ -150,18 +146,6 @@ module QA
yield
yield
end
end
end
end
def
within_sidebar
page
.
within
(
'.sidebar-top-level-items'
)
do
yield
end
end
def
within_submenu
page
.
within
(
'.fly-out-list'
)
do
yield
end
end
end
end
end
end
end
end
...
...
qa/qa/page/project/sub_menus/common.rb
0 → 100644
View file @
14165f3a
# frozen_string_literal: true
module
QA
module
Page
module
Project
module
SubMenus
module
Common
def
within_sidebar
within
(
'.sidebar-top-level-items'
)
do
yield
end
end
def
within_submenu
within
(
'.fly-out-list'
)
do
yield
end
end
end
end
end
end
end
qa/qa/page/project/sub_menus/repository.rb
0 → 100644
View file @
14165f3a
# frozen_string_literal: true
module
QA
module
Page
module
Project
module
SubMenus
module
Repository
def
self
.
included
(
base
)
base
.
class_eval
do
view
'app/views/layouts/nav/sidebar/_project.html.haml'
do
element
:project_menu_repo
element
:branches_link
end
end
end
def
click_repository
within_sidebar
do
click_element
(
:project_menu_repo
)
end
end
def
click_repository_branches
hover_repository
do
within_submenu
do
click_element
(
:branches_link
)
end
end
end
private
def
hover_repository
within_sidebar
do
find_element
(
:project_menu_repo
).
hover
yield
end
end
end
end
end
end
end
qa/qa/resource/repository/push.rb
View file @
14165f3a
...
@@ -64,7 +64,7 @@ module QA
...
@@ -64,7 +64,7 @@ module QA
repository
.
configure_identity
(
username
,
email
)
repository
.
configure_identity
(
username
,
email
)
if
new_branch
if
new_branch
repository
.
checkout
_new_branch
(
branch_nam
e
)
repository
.
checkout
(
branch_name
,
new_branch:
tru
e
)
else
else
repository
.
checkout
(
branch_name
)
repository
.
checkout
(
branch_name
)
end
end
...
...
qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb
0 → 100644
View file @
14165f3a
# frozen_string_literal: true
module
QA
context
'Create'
do
describe
'Create, list, and delete branches via web'
do
master_branch
=
'master'
second_branch
=
'second-branch'
third_branch
=
'third-branch'
file_1_master
=
'file.txt'
file_2_master
=
'other-file.txt'
file_second_branch
=
'file-2.txt'
file_third_branch
=
'file-3.txt'
first_commit_message_of_master_branch
=
"Add
#{
file_1_master
}
"
second_commit_message_of_master_branch
=
"Add
#{
file_2_master
}
"
commit_message_of_second_branch
=
"Add
#{
file_second_branch
}
"
commit_message_of_third_branch
=
"Add
#{
file_third_branch
}
"
before
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
perform
(
&
:sign_in_using_credentials
)
project
=
Resource
::
Project
.
fabricate!
do
|
proj
|
proj
.
name
=
'project-qa-test'
proj
.
description
=
'project for qa test'
end
project
.
visit!
Git
::
Repository
.
perform
do
|
repository
|
repository
.
uri
=
project
.
repository_http_location
.
uri
repository
.
use_default_credentials
repository
.
act
do
clone
configure_identity
(
'GitLab QA'
,
'root@gitlab.com'
)
commit_file
(
file_1_master
,
'Test file content'
,
first_commit_message_of_master_branch
)
push_changes
checkout
(
second_branch
,
new_branch:
true
)
commit_file
(
file_second_branch
,
'File 2 content'
,
commit_message_of_second_branch
)
push_changes
(
second_branch
)
checkout
(
master_branch
)
# This second commit on master is needed for the master branch to be ahead
# of the second branch, and when the second branch is merged to master it will
# show the 'merged' badge on it.
# Refer to the below issue note:
# https://gitlab.com/gitlab-org/gitlab-ce/issues/55524#note_126100848
commit_file
(
file_2_master
,
'Other test file content'
,
second_commit_message_of_master_branch
)
push_changes
merge
(
second_branch
)
push_changes
checkout
(
third_branch
,
new_branch:
true
)
commit_file
(
file_third_branch
,
'File 3 content'
,
commit_message_of_third_branch
)
push_changes
(
third_branch
)
end
end
Page
::
Project
::
Show
.
perform
(
&
:wait_for_push
)
end
it
'branches are correctly listed after CRUD operations'
do
Page
::
Project
::
Menu
.
perform
(
&
:click_repository_branches
)
expect
(
page
).
to
have_content
(
master_branch
)
expect
(
page
).
to
have_content
(
second_branch
)
expect
(
page
).
to
have_content
(
third_branch
)
expect
(
page
).
to
have_content
(
"Merge branch 'second-branch'"
)
expect
(
page
).
to
have_content
(
commit_message_of_second_branch
)
expect
(
page
).
to
have_content
(
commit_message_of_third_branch
)
Page
::
Project
::
Branches
::
Show
.
perform
do
|
branches
|
expect
(
branches
).
to
have_branch_with_badge
(
second_branch
,
'merged'
)
end
Page
::
Project
::
Branches
::
Show
.
perform
do
|
branches_view
|
branches_view
.
delete_branch
(
third_branch
)
end
expect
(
page
).
not_to
have_content
(
third_branch
)
Page
::
Project
::
Branches
::
Show
.
perform
(
&
:delete_merged_branches
)
expect
(
page
).
to
have_content
(
'Merged branches are being deleted. This can take some time depending on the number of branches. Please refresh the page to see changes.'
)
page
.
refresh
Page
::
Project
::
Branches
::
Show
.
perform
do
|
branches_view
|
branches_view
.
wait_for_texts_not_to_be_visible
([
commit_message_of_second_branch
])
expect
(
branches_view
).
not_to
have_branch_title
(
second_branch
)
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