BigW Consortium Gitlab

shortcuts_spec.rb 1.16 KB
Newer Older
1 2
require 'spec_helper'

3
feature 'Dashboard shortcuts', :js do
4 5
  context 'logged in' do
    before do
6
      sign_in(create(:user))
7 8 9 10
      visit root_dashboard_path
    end

    scenario 'Navigate to tabs' do
11
      find('body').send_keys([:shift, 'I'])
12 13

      check_page_title('Issues')
14

15
      find('body').send_keys([:shift, 'M'])
16 17 18

      check_page_title('Merge Requests')

19
      find('body').send_keys([:shift, 'T'])
20 21

      check_page_title('Todos')
22 23 24 25

      find('body').send_keys([:shift, 'P'])

      check_page_title('Projects')
26 27
    end
  end
28

29 30 31 32
  context 'logged out' do
    before do
      visit explore_root_path
    end
33

34
    scenario 'Navigate to tabs' do
35
      find('body').send_keys([:shift, 'G'])
36

37
      find('.nothing-here-block')
38
      expect(page).to have_content('No public groups')
39

40
      find('body').send_keys([:shift, 'S'])
41

42
      find('.nothing-here-block')
43
      expect(page).to have_selector('.snippets-list-holder')
44 45 46 47 48

      find('body').send_keys([:shift, 'P'])

      find('.nothing-here-block')
      expect(page).to have_content('No projects found')
49
    end
50 51
  end

52
  def check_page_title(title)
53
    expect(find('.breadcrumbs-sub-title')).to have_content(title)
54
  end
55
end