2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'Project active tab' do
|
2018-05-09 12:01:36 +05:30
|
|
|
let(:user) { create :user }
|
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2018-05-09 12:01:36 +05:30
|
|
|
sign_in(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
def click_tab(title)
|
|
|
|
page.within '.sidebar-top-level-items > .active' do
|
|
|
|
click_link(title)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'on project Home' do
|
|
|
|
before do
|
|
|
|
visit project_path(project)
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it_behaves_like 'page has active tab', 'Project'
|
2018-05-09 12:01:36 +05:30
|
|
|
it_behaves_like 'page has active sub tab', 'Details'
|
|
|
|
|
|
|
|
context 'on project Home/Activity' do
|
|
|
|
before do
|
|
|
|
click_tab('Activity')
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it_behaves_like 'page has active tab', 'Project'
|
2018-05-09 12:01:36 +05:30
|
|
|
it_behaves_like 'page has active sub tab', 'Activity'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'on project Repository' do
|
|
|
|
before do
|
|
|
|
root_ref = project.repository.root_ref
|
|
|
|
visit project_tree_path(project, root_ref)
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'page has active tab', 'Repository'
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
%w(Files Commits Graph Compare Branches Tags).each do |sub_menu|
|
2018-05-09 12:01:36 +05:30
|
|
|
context "on project Repository/#{sub_menu}" do
|
|
|
|
before do
|
|
|
|
click_tab(sub_menu)
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'page has active tab', 'Repository'
|
|
|
|
it_behaves_like 'page has active sub tab', sub_menu
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'on project Issues' do
|
|
|
|
before do
|
|
|
|
visit project_issues_path(project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'page has active tab', 'Issues'
|
|
|
|
|
|
|
|
%w(Milestones Labels).each do |sub_menu|
|
|
|
|
context "on project Issues/#{sub_menu}" do
|
|
|
|
before do
|
|
|
|
click_tab(sub_menu)
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'page has active tab', 'Issues'
|
|
|
|
it_behaves_like 'page has active sub tab', sub_menu
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'on project Merge Requests' do
|
|
|
|
before do
|
|
|
|
visit project_merge_requests_path(project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'page has active tab', 'Merge Requests'
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'on project Wiki' do
|
|
|
|
before do
|
2020-06-23 00:09:42 +05:30
|
|
|
visit wiki_path(project.wiki)
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'page has active tab', 'Wiki'
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'on project Members' do
|
|
|
|
before do
|
|
|
|
visit project_project_members_path(project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'page has active tab', 'Members'
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'on project Settings' do
|
|
|
|
before do
|
|
|
|
visit edit_project_path(project)
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'on project Settings/Integrations' do
|
|
|
|
before do
|
|
|
|
click_tab('Integrations')
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'page has active tab', 'Settings'
|
|
|
|
it_behaves_like 'page has active sub tab', 'Integrations'
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'on project Settings/Repository' do
|
|
|
|
before do
|
|
|
|
click_tab('Repository')
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'page has active tab', 'Settings'
|
|
|
|
it_behaves_like 'page has active sub tab', 'Repository'
|
|
|
|
end
|
|
|
|
end
|
2020-03-13 15:44:24 +05:30
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
context 'on project Analytics' do
|
2020-03-13 15:44:24 +05:30
|
|
|
before do
|
2020-04-08 14:13:33 +05:30
|
|
|
visit charts_project_graph_path(project, 'master')
|
2020-03-13 15:44:24 +05:30
|
|
|
end
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
context 'on project Analytics/Repository Analytics' do
|
|
|
|
it_behaves_like 'page has active tab', _('Analytics')
|
|
|
|
it_behaves_like 'page has active sub tab', _('Repository')
|
|
|
|
end
|
2020-03-13 15:44:24 +05:30
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
context 'on project Analytics/Cycle Analytics' do
|
|
|
|
before do
|
|
|
|
click_tab(_('CI / CD'))
|
2020-03-13 15:44:24 +05:30
|
|
|
end
|
|
|
|
|
2020-04-08 14:13:33 +05:30
|
|
|
it_behaves_like 'page has active tab', _('Analytics')
|
|
|
|
it_behaves_like 'page has active sub tab', _('CI / CD')
|
2020-03-13 15:44:24 +05:30
|
|
|
end
|
|
|
|
end
|
2018-05-09 12:01:36 +05:30
|
|
|
end
|