2015-11-19 06:20:09 -05:00
|
|
|
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
|
2015-12-02 09:11:32 -05:00
|
|
|
page.within '.awards-controls' do
|
|
|
|
page.find('.add-award').click
|
2015-11-19 06:20:09 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click to emoji in the picker' do
|
2015-12-25 07:10:55 -05:00
|
|
|
page.within '.emoji-menu-content' do
|
2015-12-22 12:39:15 -05:00
|
|
|
page.first('.emoji-icon').click
|
2015-11-19 06:20:09 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I can remove it by clicking to icon' do
|
2015-12-02 09:11:32 -05:00
|
|
|
page.within '.awards' do
|
2015-12-25 07:10:55 -05:00
|
|
|
expect do
|
|
|
|
page.find('.award.active').click
|
2015-12-31 08:58:52 -05:00
|
|
|
sleep 0.3
|
2015-12-25 07:10:55 -05:00
|
|
|
end.to change{ page.all(".award").size }.from(3).to(2)
|
2015-11-19 06:20:09 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-12-22 12:47:38 -05:00
|
|
|
step 'I can see the activity and food categories' do
|
|
|
|
page.within '.emoji-menu' do
|
|
|
|
expect(page).to_not have_selector 'Activity'
|
|
|
|
expect(page).to_not have_selector 'Food'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-11-19 06:20:09 -05:00
|
|
|
step 'I have award added' do
|
2015-12-02 09:11:32 -05:00
|
|
|
page.within '.awards' do
|
|
|
|
expect(page).to have_selector '.award'
|
2015-12-25 05:08:53 -05:00
|
|
|
expect(page.find('.award.active .counter')).to have_content '1'
|
2015-11-19 06:20:09 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'project "Shop" has issue "Bugfix"' do
|
2015-12-02 09:11:32 -05:00
|
|
|
@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
|
2015-11-19 06:20:09 -05:00
|
|
|
end
|
2015-12-23 05:01:31 -05:00
|
|
|
|
|
|
|
step 'I search "hand"' do
|
|
|
|
page.within('.emoji-menu-content') do
|
|
|
|
fill_in 'emoji_search', with: 'hand'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see search result for "hand"' do
|
|
|
|
page.within '.emoji-menu-content' do
|
|
|
|
expect(page).to have_selector '[data-emoji="raised_hand"]'
|
|
|
|
end
|
|
|
|
end
|
2016-01-29 07:58:34 -05:00
|
|
|
|
|
|
|
step 'The search field is focused' do
|
|
|
|
page.evaluate_script("document.activeElement.id").should eq "emoji_search"
|
|
|
|
end
|
2015-11-19 06:20:09 -05:00
|
|
|
end
|