Fix CI/CD > Pipelines active routes

In this commit we add more route to indicate when
the `CI/CD > Pipelines` menu item should be active.

Changelog: fixed
parent 475ba0d9
......@@ -18,6 +18,15 @@ module EE
private
override :pipelines_routes
def pipelines_routes
super + %w[
pipelines#security
pipelines#licenses
pipelines#codequality_report
]
end
def test_cases_menu_item
if !context.project.licensed_feature_available?(:quality_management) ||
!can?(context.current_user, :read_issue, context.project)
......
......@@ -3,17 +3,11 @@
require 'spec_helper'
RSpec.describe 'Project active tab' do
let(:user) { create :user }
let(:project) { create(:project, :repository) }
let_it_be(:project) { create(:project, :repository) }
def click_tab(title)
page.within '.sidebar-top-level-items > .active' do
click_link(title)
end
end
let(:user) { project.owner }
before do
project.add_maintainer(user)
sign_in(user)
end
......@@ -38,4 +32,37 @@ RSpec.describe 'Project active tab' do
it_behaves_like 'page has active tab', _('Analytics')
it_behaves_like 'page has active sub tab', _('Code Review')
end
context 'on project CI/CD' do
context 'browsing Pipelines tabs' do
let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
context 'Security tab' do
before do
visit security_project_pipeline_path(project, pipeline)
end
it_behaves_like 'page has active tab', _('CI/CD')
it_behaves_like 'page has active sub tab', _('Pipelines')
end
context 'Licenses tab' do
before do
visit licenses_project_pipeline_path(project, pipeline)
end
it_behaves_like 'page has active tab', _('CI/CD')
it_behaves_like 'page has active sub tab', _('Pipelines')
end
context 'Code Quality tab' do
before do
visit codequality_report_project_pipeline_path(project, pipeline)
end
it_behaves_like 'page has active tab', _('CI/CD')
it_behaves_like 'page has active sub tab', _('Pipelines')
end
end
end
end
......@@ -61,6 +61,10 @@ module Sidebars
pipelines#index
pipelines#show
pipelines#new
pipelines#dag
pipelines#failures
pipelines#builds
pipelines#test_report
]
end
......
......@@ -182,4 +182,55 @@ RSpec.describe 'Project active tab' do
it_behaves_like 'page has active sub tab', _('CI/CD')
end
end
context 'on project CI/CD' do
context 'browsing Pipelines tabs' do
let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
context 'Pipeline tab' do
before do
visit project_pipeline_path(project, pipeline)
end
it_behaves_like 'page has active tab', _('CI/CD')
it_behaves_like 'page has active sub tab', _('Pipelines')
end
context 'Needs tab' do
before do
visit dag_project_pipeline_path(project, pipeline)
end
it_behaves_like 'page has active tab', _('CI/CD')
it_behaves_like 'page has active sub tab', _('Pipelines')
end
context 'Builds tab' do
before do
visit builds_project_pipeline_path(project, pipeline)
end
it_behaves_like 'page has active tab', _('CI/CD')
it_behaves_like 'page has active sub tab', _('Pipelines')
end
context 'Failures tab' do
before do
visit failures_project_pipeline_path(project, pipeline)
end
it_behaves_like 'page has active tab', _('CI/CD')
it_behaves_like 'page has active sub tab', _('Pipelines')
end
context 'Test Report tab' do
before do
visit test_report_project_pipeline_path(project, pipeline)
end
it_behaves_like 'page has active tab', _('CI/CD')
it_behaves_like 'page has active sub tab', _('Pipelines')
end
end
end
end
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