2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'Dashboard shortcuts', :js do
|
2021-06-08 01:23:25 +05:30
|
|
|
shared_examples 'combined_menu: feature flag examples' do
|
|
|
|
context 'logged in' do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project) }
|
2021-04-29 21:17:54 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
before do
|
|
|
|
project.add_developer(user)
|
|
|
|
sign_in(user)
|
|
|
|
visit root_dashboard_path
|
|
|
|
end
|
2018-12-13 13:39:08 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
it 'navigate to tabs' do
|
|
|
|
find('body').send_keys([:shift, 'I'])
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
check_page_title('Issues')
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
find('body').send_keys([:shift, 'M'])
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
check_page_title('Merge requests')
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
find('body').send_keys([:shift, 'T'])
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
check_page_title('To-Do List')
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
find('body').send_keys([:shift, 'G'])
|
2020-04-22 19:07:51 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
check_page_title('Groups')
|
2020-04-22 19:07:51 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
find('body').send_keys([:shift, 'P'])
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
check_page_title('Projects')
|
2020-04-22 19:07:51 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
find('body').send_keys([:shift, 'A'])
|
2020-04-22 19:07:51 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
check_page_title('Activity')
|
2021-09-04 01:27:46 +05:30
|
|
|
|
|
|
|
find('body').send_keys([:shift, 'L'])
|
|
|
|
|
|
|
|
check_page_title('Milestones')
|
2021-06-08 01:23:25 +05:30
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'logged out' do
|
|
|
|
before do
|
|
|
|
visit explore_root_path
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'navigate to tabs' do
|
|
|
|
find('body').send_keys([:shift, 'G'])
|
|
|
|
|
|
|
|
find('.nothing-here-block')
|
|
|
|
expect(page).to have_content('No public groups')
|
|
|
|
|
|
|
|
find('body').send_keys([:shift, 'S'])
|
|
|
|
|
|
|
|
find('.nothing-here-block')
|
|
|
|
expect(page).to have_content('No snippets found')
|
|
|
|
|
|
|
|
find('body').send_keys([:shift, 'P'])
|
|
|
|
|
|
|
|
find('.nothing-here-block')
|
|
|
|
expect(page).to have_content('Explore public groups to find projects to contribute to.')
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
def check_page_title(title)
|
|
|
|
expect(find('.page-title')).to have_content(title)
|
|
|
|
end
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
context 'with combined_menu feature flag on' do
|
2021-06-08 01:23:25 +05:30
|
|
|
before do
|
|
|
|
stub_feature_flags(combined_menu: true)
|
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
it_behaves_like 'combined_menu: feature flag examples'
|
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
context 'with combined_menu feature flag off' do
|
|
|
|
before do
|
|
|
|
stub_feature_flags(combined_menu: false)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
2021-06-08 01:23:25 +05:30
|
|
|
|
|
|
|
it_behaves_like 'combined_menu: feature flag examples'
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|