BigW Consortium Gitlab

ref_switcher_spec.rb 1.04 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
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]
    login_as(user)
    visit namespace_project_tree_path(project.namespace, project, 'master')
  end

  it 'allow user to change ref by enter key' do
    click_button 'master'
15
    wait_for_requests
16 17 18

    page.within '.project-refs-form' do
      input = find('input[type="search"]')
Phil Hughes committed
19
      input.set 'binary'
20
      wait_for_requests
21

Phil Hughes committed
22 23
      expect(find('.dropdown-content ul')).to have_selector('li', count: 6)

24 25 26
      page.within '.dropdown-content ul' do
        input.native.send_keys :enter
      end
27 28
    end

Phil Hughes committed
29
    expect(page).to have_title 'binary-encoding'
30 31 32 33
  end

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

36 37 38
    page.within '.project-refs-form' do
      page.fill_in 'Search branches and tags', with: "'test'"
      click_link "'test'"
39
    end
40 41

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