award_emoji.rb 1.21 KB
Newer Older
Valery Sizov's avatar
Valery Sizov committed
1 2 3 4 5 6 7 8 9 10 11
class Spinach::Features::AwardEmoji < Spinach::FeatureSteps
  include SharedAuthentication
  include SharedProject
  include SharedPaths
  include Select2Helper

  step 'I visit "Bugfix" issue page' do
    visit namespace_project_issue_path(@project.namespace, @project, @issue)
  end

  step 'I click to emoji-picker' do
12 13
    page.within '.awards-controls' do
      page.find('.add-award').click
Valery Sizov's avatar
Valery Sizov committed
14 15 16 17
    end
  end

  step 'I click to emoji in the picker' do
Valery Sizov's avatar
Valery Sizov committed
18 19
    page.within '.emoji-menu' do
      page.first('.emoji-icon').click
Valery Sizov's avatar
Valery Sizov committed
20 21 22 23
    end
  end

  step 'I can remove it by clicking to icon' do
24 25 26
    page.within '.awards' do
      page.first('.award').click
      expect(page).to_not have_selector '.award'
Valery Sizov's avatar
Valery Sizov committed
27 28 29 30
    end
  end

  step 'I have award added' do
31 32 33
    page.within '.awards' do
      expect(page).to have_selector '.award'
      expect(page.find('.award .counter')).to have_content '1'
Valery Sizov's avatar
Valery Sizov committed
34 35 36 37
    end
  end

  step 'project "Shop" has issue "Bugfix"' do
38 39 40 41 42 43 44 45 46
    @project = Project.find_by(name: 'Shop')
    @issue = create(:issue, title: 'Bugfix', project: project)
  end

  step 'I leave comment with a single emoji' do
    page.within('.js-main-target-form') do
      fill_in 'note[note]', with: ':smile:'
      click_button 'Add Comment'
    end
Valery Sizov's avatar
Valery Sizov committed
47 48
  end
end