summaryrefslogtreecommitdiff
path: root/spec/features/projects/ref_switcher_spec.rb
blob: 28b98d70cdce243612b3f0c5bd21e5fb28b4fb9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require 'rails_helper'

feature 'Ref switcher', feature: true, js: true do
  let(:user)      { create(:user) }
  let(:project)   { create(:project, :public) }

  before do
    project.team << [user, :master]
    sign_in(user)
    visit namespace_project_tree_path(project.namespace, project, 'master')
  end

  it 'allow user to change ref by enter key' do
    click_button 'master'
    wait_for_requests

    page.within '.project-refs-form' do
      input = find('input[type="search"]')
      input.set 'binary'
      wait_for_requests

      expect(find('.dropdown-content ul')).to have_selector('li', count: 6)

      page.within '.dropdown-content ul' do
        input.native.send_keys :enter
      end
    end

    expect(page).to have_title 'binary-encoding'
  end

  it "user selects ref with special characters" do
    click_button 'master'
    wait_for_requests

    page.within '.project-refs-form' do
      page.fill_in 'Search branches and tags', with: "'test'"
      click_link "'test'"
    end

    expect(page).to have_title "'test'"
  end
end