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
7bcd30d6
Commit
7bcd30d6
authored
Nov 17, 2020
by
Felipe Artur
Committed by
Michael Kozono
Nov 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add route for test cases show page
parent
0a7ce52e
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
83 additions
and
23 deletions
+83
-23
app/assets/javascripts/issuable_sidebar/components/issuable_sidebar_root.vue
...pts/issuable_sidebar/components/issuable_sidebar_root.vue
+1
-0
ee/app/assets/javascripts/pages/projects/issues/show/index.js
...pp/assets/javascripts/pages/projects/issues/show/index.js
+0
-12
ee/app/assets/javascripts/pages/projects/quality/test_cases/show/index.js
...vascripts/pages/projects/quality/test_cases/show/index.js
+5
-0
ee/app/controllers/projects/quality/test_cases_controller.rb
ee/app/controllers/projects/quality/test_cases_controller.rb
+20
-0
ee/app/presenters/ee/issue_presenter.rb
ee/app/presenters/ee/issue_presenter.rb
+6
-0
ee/app/views/projects/issues/show.html.haml
ee/app/views/projects/issues/show.html.haml
+0
-4
ee/app/views/projects/quality/test_cases/show.html.haml
ee/app/views/projects/quality/test_cases/show.html.haml
+5
-5
ee/changelogs/unreleased/add_test_cases_show_route.yml
ee/changelogs/unreleased/add_test_cases_show_route.yml
+5
-0
ee/config/routes/project.rb
ee/config/routes/project.rb
+1
-1
ee/spec/controllers/projects/quality/test_cases_controller_spec.rb
...ontrollers/projects/quality/test_cases_controller_spec.rb
+23
-0
ee/spec/features/projects/quality/test_case_show_spec.rb
ee/spec/features/projects/quality/test_case_show_spec.rb
+1
-1
ee/spec/presenters/ee/issue_presenter_spec.rb
ee/spec/presenters/ee/issue_presenter_spec.rb
+16
-0
No files found.
app/assets/javascripts/issuable_sidebar/components/issuable_sidebar_root.vue
View file @
7bcd30d6
...
...
@@ -29,6 +29,7 @@ export default {
},
mounted
()
{
window
.
addEventListener
(
'
resize
'
,
this
.
handleWindowResize
);
this
.
updatePageContainerClass
();
},
beforeDestroy
()
{
window
.
removeEventListener
(
'
resize
'
,
this
.
handleWindowResize
);
...
...
ee/app/assets/javascripts/pages/projects/issues/show/index.js
View file @
7bcd30d6
import
initSidebarBundle
from
'
ee/sidebar/sidebar_bundle
'
;
import
trackShowInviteMemberLink
from
'
ee/projects/track_invite_members
'
;
import
initTestCaseShow
from
'
ee/test_case_show/test_case_show_bundle
'
;
import
{
parseIssuableData
}
from
'
~/issue_show/utils/parse_data
'
;
import
initRelatedIssues
from
'
~/related_issues
'
;
import
initShow
from
'
~/pages/projects/issues/show
'
;
import
UserCallout
from
'
~/user_callout
'
;
import
{
IssuableType
}
from
'
~/issuable_show/constants
'
;
const
{
issueType
}
=
parseIssuableData
();
initShow
();
if
(
issueType
===
IssuableType
.
TestCase
)
{
initTestCaseShow
({
mountPointSelector
:
'
#js-issuable-app
'
,
});
}
if
(
gon
.
features
&&
!
gon
.
features
.
vueIssuableSidebar
)
{
initSidebarBundle
();
}
...
...
ee/app/assets/javascripts/pages/projects/quality/test_cases/show/index.js
0 → 100644
View file @
7bcd30d6
import
initTestCaseShow
from
'
ee/test_case_show/test_case_show_bundle
'
;
initTestCaseShow
({
mountPointSelector
:
'
#js-issuable-app
'
,
});
ee/app/controllers/projects/quality/test_cases_controller.rb
View file @
7bcd30d6
...
...
@@ -26,9 +26,29 @@ class Projects::Quality::TestCasesController < Projects::ApplicationController
end
end
def
show
@test_case
=
test_cases_finder
.
execute
.
iid_in
(
params
[
:id
])
.
without_order
.
first
serializer
=
IssueSerializer
.
new
(
current_user:
current_user
,
project:
project
)
@issuable_sidebar
=
serializer
.
represent
(
@test_case
,
serializer:
'sidebar'
)
respond_to
do
|
format
|
format
.
html
end
end
private
def
verify_test_cases_flag!
render_404
unless
Feature
.
enabled?
(
:quality_test_cases
,
project
)
end
def
test_cases_finder
IssuesFinder
.
new
(
current_user
,
project_id:
project
.
id
,
issue_types: :test_case
)
end
end
ee/app/presenters/ee/issue_presenter.rb
View file @
7bcd30d6
...
...
@@ -9,5 +9,11 @@ module EE
issuable_sla
&
.
due_at
end
def
web_url
return
super
unless
issue
.
issue_type
==
'test_case'
project_quality_test_case_url
(
issue
.
project
,
issue
)
end
end
end
ee/app/views/projects/issues/show.html.haml
deleted
100644 → 0
View file @
0a7ce52e
-
if
@issue
.
issue_type
==
'test_case'
=
render_if_exists
'projects/quality/test_cases/show'
-
else
=
render_ce
'projects/issues/show'
ee/app/views/projects/quality/test_cases/
_
show.html.haml
→
ee/app/views/projects/quality/test_cases/show.html.haml
View file @
7bcd30d6
-
@content_class
=
"limit-container-width"
unless
fluid_layout
-
add_to_breadcrumbs
_
(
'Test Cases'
),
project_quality_test_cases_path
(
@project
)
-
breadcrumb_title
@
issu
e
.
to_reference
-
breadcrumb_title
@
test_cas
e
.
to_reference
-
page_title
"
#{
@
issue
.
title
}
(
#{
@issu
e
.
to_reference
}
)"
,
_
(
'Test Cases'
)
-
page_description
@
issu
e
.
description
-
page_title
"
#{
@
test_case
.
title
}
(
#{
@test_cas
e
.
to_reference
}
)"
,
_
(
'Test Cases'
)
-
page_description
@
test_cas
e
.
description
#js-issuable-app
{
data:
{
initial:
issuable_initial_data
(
@
issu
e
).
to_json
,
#js-issuable-app
{
data:
{
initial:
issuable_initial_data
(
@
test_cas
e
).
to_json
,
can_edit_test_case:
can?
(
current_user
,
:admin_issue
,
@project
).
to_s
,
can_move_test_case:
@issuable_sidebar
.
dig
(
:current_user
,
:can_move
).
to_s
,
description_preview_path:
preview_markdown_path
(
@project
),
...
...
@@ -15,4 +15,4 @@
labels_fetch_path:
project_labels_path
(
@project
,
format: :json
),
test_case_new_path:
new_project_quality_test_case_path
(
@project
),
sidebar_options:
issuable_sidebar_options
(
@issuable_sidebar
).
to_json
.
html_safe
,
test_case_id:
@
issu
e
.
iid
}
}
test_case_id:
@
test_cas
e
.
iid
}
}
ee/changelogs/unreleased/add_test_cases_show_route.yml
0 → 100644
View file @
7bcd30d6
---
title
:
Add route for test cases show page
merge_request
:
47441
author
:
type
:
added
ee/config/routes/project.rb
View file @
7bcd30d6
...
...
@@ -16,7 +16,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
namespace
:quality
do
resources
:test_cases
,
only:
[
:index
,
:new
]
resources
:test_cases
,
only:
[
:index
,
:new
,
:show
]
end
resources
:autocomplete_sources
,
only:
[]
do
...
...
ee/spec/controllers/projects/quality/test_cases_controller_spec.rb
View file @
7bcd30d6
...
...
@@ -91,5 +91,28 @@ RSpec.describe Projects::Quality::TestCasesController do
it_behaves_like
'test case action'
,
:new
end
describe
'#show'
do
let_it_be
(
:test_case
)
{
create
(
:quality_test_case
,
project:
project
)
}
subject
{
get
:show
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
,
id:
test_case
}
}
it_behaves_like
'test case action'
,
:show
context
'when feature is enabled and user has access'
do
before
do
stub_licensed_features
(
quality_management:
true
)
project
.
add_developer
(
user
)
sign_in
(
user
)
end
it
'assigns test case related variables'
do
subject
expect
(
assigns
(
:test_case
)).
to
eq
(
test_case
)
expect
(
assigns
(
:issuable_sidebar
)).
to
be_present
end
end
end
end
end
ee/spec/features/projects/quality/test_case_show_spec.rb
View file @
7bcd30d6
...
...
@@ -18,7 +18,7 @@ RSpec.describe 'Test Cases', :js do
context
'test case page'
do
before
do
visit
project_
issu
e_path
(
project
,
test_case
)
visit
project_
quality_test_cas
e_path
(
project
,
test_case
)
wait_for_all_requests
end
...
...
ee/spec/presenters/ee/issue_presenter_spec.rb
View file @
7bcd30d6
...
...
@@ -25,4 +25,20 @@ RSpec.describe IssuePresenter do
it
{
is_expected
.
to
eq
(
nil
)
}
end
end
describe
'#web_url'
do
subject
{
described_class
.
new
(
issue
).
present
.
web_url
}
context
'when issue has default type'
do
let_it_be
(
:issue
)
{
create
(
:issue
)
}
it
{
is_expected
.
to
eq
(
"http://localhost/
#{
issue
.
project
.
namespace
.
path
}
/
#{
issue
.
project
.
name
}
/-/issues/
#{
issue
.
iid
}
"
)
}
end
context
'when issue has test_case type'
do
let_it_be
(
:issue
)
{
create
(
:quality_test_case
)
}
it
{
is_expected
.
to
eq
(
"http://localhost/
#{
issue
.
project
.
namespace
.
path
}
/
#{
issue
.
project
.
name
}
/-/quality/test_cases/
#{
issue
.
iid
}
"
)
}
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