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
|
2017-06-29 13:06:35 -04:00
|
|
|
visit project_issue_path(@project, @issue)
|
2015-11-19 06:20:09 -05:00
|
|
|
end
|
|
|
|
|
2016-02-13 05:47:15 -05:00
|
|
|
step 'I click the thumbsup award Emoji' do
|
|
|
|
page.within '.awards' do
|
2016-03-01 08:00:26 -05:00
|
|
|
thumbsup = page.first('.award-control')
|
2016-02-13 05:47:15 -05:00
|
|
|
thumbsup.click
|
|
|
|
thumbsup.hover
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-11-19 06:20:09 -05:00
|
|
|
step 'I click to emoji-picker' do
|
2016-03-01 08:00:26 -05:00
|
|
|
page.within '.awards' do
|
|
|
|
page.find('.js-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
|
2017-04-05 06:54:37 -04:00
|
|
|
emoji_button = page.first('.js-emoji-btn')
|
|
|
|
emoji_button.hover
|
|
|
|
emoji_button.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
|
2016-03-01 08:00:26 -05:00
|
|
|
page.find('.js-emoji-btn.active').click
|
2017-06-13 04:57:33 -04:00
|
|
|
wait_for_requests
|
|
|
|
end.to change { page.all(".award-control.js-emoji-btn").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
|
2016-05-23 19:37:59 -04:00
|
|
|
expect(page).not_to have_selector 'Activity'
|
|
|
|
expect(page).not_to have_selector 'Food'
|
2015-12-22 12:47:38 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-02-28 15:38:19 -05:00
|
|
|
step 'I have new comment with emoji added' do
|
2017-03-24 20:10:57 -04:00
|
|
|
expect(page).to have_selector 'gl-emoji[data-name="smile"]'
|
2017-02-28 15:38:19 -05:00
|
|
|
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
|
2016-03-01 08:00:26 -05:00
|
|
|
expect(page).to have_selector '.js-emoji-btn'
|
|
|
|
expect(page.find('.js-emoji-btn.active .js-counter')).to have_content '1'
|
2016-07-11 14:53:07 -04:00
|
|
|
expect(page).to have_css(".js-emoji-btn.active[data-original-title='You']")
|
2016-02-13 05:47:15 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I have no awards added' do
|
|
|
|
page.within '.awards' do
|
2016-03-01 08:00:26 -05:00
|
|
|
expect(page).to have_selector '.award-control.js-emoji-btn'
|
|
|
|
expect(page.all('.award-control.js-emoji-btn').size).to eq(2)
|
2016-02-13 05:47:15 -05:00
|
|
|
|
|
|
|
# Check tooltip data
|
2016-03-01 08:00:26 -05:00
|
|
|
page.all('.award-control.js-emoji-btn').each do |element|
|
2016-02-13 05:47:15 -05:00
|
|
|
expect(element['title']).to eq("")
|
|
|
|
end
|
|
|
|
|
2016-03-01 08:00:26 -05:00
|
|
|
page.all('.award-control .js-counter').each do |element|
|
2016-02-13 05:47:15 -05:00
|
|
|
expect(element).to have_content '0'
|
|
|
|
end
|
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:'
|
2016-03-04 08:52:29 -05:00
|
|
|
click_button 'Comment'
|
2015-12-02 09:11:32 -05:00
|
|
|
end
|
2015-11-19 06:20:09 -05:00
|
|
|
end
|
2015-12-23 05:01:31 -05:00
|
|
|
|
|
|
|
step 'I search "hand"' do
|
2017-04-07 01:28:30 -04:00
|
|
|
fill_in 'emoji-menu-search', with: 'hand'
|
2015-12-23 05:01:31 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'I see search result for "hand"' do
|
|
|
|
page.within '.emoji-menu-content' do
|
2017-02-27 23:44:34 -05:00
|
|
|
expect(page).to have_selector '[data-name="raised_hand"]'
|
2015-12-23 05:01:31 -05:00
|
|
|
end
|
|
|
|
end
|
2016-01-29 07:58:34 -05:00
|
|
|
|
2016-03-17 19:25:21 -04:00
|
|
|
step 'The emoji menu is visible' do
|
|
|
|
page.find(".emoji-menu.is-visible")
|
|
|
|
end
|
|
|
|
|
2016-01-29 07:58:34 -05:00
|
|
|
step 'The search field is focused' do
|
2017-04-07 01:28:30 -04:00
|
|
|
expect(page).to have_selector('.js-emoji-menu-search')
|
|
|
|
expect(page.evaluate_script("document.activeElement.classList.contains('js-emoji-menu-search')")).to eq(true)
|
2016-01-29 07:58:34 -05:00
|
|
|
end
|
2015-11-19 06:20:09 -05:00
|
|
|
end
|