Commit 204ae6dc authored by Felipe Artur's avatar Felipe Artur

Adds test cases controller and quality tab

Initial work for adding test cases.
parent 30ba441f
......@@ -167,7 +167,7 @@
= render_if_exists "layouts/nav/requirements_link", project: @project
- if project_nav_tab? :pipelines
= nav_link(controller: [:pipelines, :builds, :jobs, :pipeline_schedules, :artifacts], unless: -> { current_path?('projects/pipelines#charts') }) do
= nav_link(controller: [:pipelines, :builds, :jobs, :pipeline_schedules, :artifacts, :test_cases], unless: -> { current_path?('projects/pipelines#charts') }) do
= link_to project_pipelines_path(@project), class: 'shortcuts-pipelines qa-link-pipelines rspec-link-pipelines', data: { qa_selector: 'ci_cd_link' } do
.nav-icon-container
= sprite_icon('rocket')
......@@ -175,7 +175,7 @@
= _('CI / CD')
%ul.sidebar-sub-level-items
= nav_link(controller: [:pipelines, :builds, :jobs, :pipeline_schedules, :artifacts], html_options: { class: "fly-out-top-item" }) do
= nav_link(controller: [:pipelines, :builds, :jobs, :pipeline_schedules, :artifacts, :test_cases], html_options: { class: "fly-out-top-item" }) do
= link_to project_pipelines_path(@project) do
%strong.fly-out-top-item-name
= _('CI / CD')
......@@ -204,6 +204,8 @@
%span
= _('Schedules')
= render_if_exists "layouts/nav/test_cases_link", project: @project
= render_if_exists 'layouts/nav/sidebar/project_security_link' # EE-specific
- if project_nav_tab? :operations
......
# frozen_string_literal: true
class Projects::Quality::TestCasesController < Projects::ApplicationController
before_action :check_quality_management_available!
before_action :authorize_read_issue!
before_action :verify_test_cases_flag!
before_action do
push_frontend_feature_flag(:quality_test_cases, project)
end
def index
respond_to do |format|
format.html
end
end
private
def verify_test_cases_flag!
render_404 unless Feature.enabled?(:quality_test_cases, project)
end
end
......@@ -144,6 +144,7 @@ class License < ApplicationRecord
subepics
threat_monitoring
tracing
quality_management
]
EEU_FEATURES.freeze
......
- return unless Feature.enabled?(:quality_test_cases, project)
- return unless project.feature_available?(:quality_management)
- return unless can?(current_user, :read_issue, project)
- if project_nav_tab?(:pipelines)
= nav_link(controller: :test_cases) do
= link_to project_quality_test_cases_path(project), title: _('Test Cases'), class: 'shortcuts-test-cases' do
%span
= _('Test Cases')
- page_title _('Test Cases')
- breadcrumb_title _("Test Cases")
---
name: quality_test_cases
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/40019
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/241983
group: group::certify
type: development
default_enabled: false
\ No newline at end of file
......@@ -15,6 +15,10 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
resources :requirements, only: [:index]
end
namespace :quality do
resources :test_cases, only: [:index]
end
resources :feature_flags, param: :iid do
resources :feature_flag_issues, only: [:index, :create, :destroy], as: 'issues', path: 'issues'
end
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Projects::Quality::TestCasesController do
let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) }
subject { get :index, params: { namespace_id: project.namespace, project_id: project } }
describe 'GET #index' do
context 'with authorized user' do
before do
project.add_developer(user)
sign_in(user)
end
context 'when feature is available' do
before do
stub_licensed_features(quality_management: true)
end
it 'renders the index template' do
subject
expect(response).to have_gitlab_http_status(:ok)
expect(response).to render_template(:index)
end
context 'when quality_test_cases flag is disabled' do
before do
stub_feature_flags(quality_test_cases: false)
end
it 'returns 404' do
subject
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
context 'when feature is not available' do
before do
stub_licensed_features(quality_management: false)
end
it 'returns 404' do
subject
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
context 'with unauthorized user' do
before do
sign_in(user)
end
context 'when feature is available' do
before do
stub_licensed_features(quality_management: true)
end
it 'returns 404' do
subject
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
context 'with anonymous user' do
it 'returns 302' do
subject
expect(response).to have_gitlab_http_status(:found)
expect(response).to redirect_to(new_user_session_path)
end
end
end
end
......@@ -24200,6 +24200,9 @@ msgstr ""
msgid "Test"
msgstr ""
msgid "Test Cases"
msgstr ""
msgid "Test coverage parsing"
msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment