debian-mirror-gitlab/features/steps/project/issues/award_emoji.rb

102 lines
2.7 KiB
Ruby
Raw Normal View History

2015-11-26 14:37:03 +05:30
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
2016-04-02 18:10:28 +05:30
step 'I click the thumbsup award Emoji' do
page.within '.awards' do
2016-06-02 11:05:42 +05:30
thumbsup = page.first('.award-control')
2016-04-02 18:10:28 +05:30
thumbsup.click
thumbsup.hover
end
end
2015-11-26 14:37:03 +05:30
step 'I click to emoji-picker' do
2016-06-02 11:05:42 +05:30
page.within '.awards' do
page.find('.js-add-award').click
2015-11-26 14:37:03 +05:30
end
end
step 'I click to emoji in the picker' do
page.within '.emoji-menu-content' do
2016-06-02 11:05:42 +05:30
page.first('.js-emoji-btn').click
2015-11-26 14:37:03 +05:30
end
end
step 'I can remove it by clicking to icon' do
2015-12-23 02:04:40 +05:30
page.within '.awards' do
expect do
2016-06-02 11:05:42 +05:30
page.find('.js-emoji-btn.active').click
sleep 0.3
2016-06-02 11:05:42 +05:30
end.to change{ page.all(".award-control.js-emoji-btn").size }.from(3).to(2)
end
end
step 'I can see the activity and food categories' do
page.within '.emoji-menu' do
expect(page).not_to have_selector 'Activity'
expect(page).not_to have_selector 'Food'
2015-11-26 14:37:03 +05:30
end
end
step 'I have award added' do
2015-12-23 02:04:40 +05:30
page.within '.awards' do
2016-06-02 11:05:42 +05:30
expect(page).to have_selector '.js-emoji-btn'
expect(page.find('.js-emoji-btn.active .js-counter')).to have_content '1'
expect(page).to have_css(".js-emoji-btn.active[data-original-title='me']")
2016-04-02 18:10:28 +05:30
end
end
step 'I have no awards added' do
page.within '.awards' do
2016-06-02 11:05:42 +05:30
expect(page).to have_selector '.award-control.js-emoji-btn'
expect(page.all('.award-control.js-emoji-btn').size).to eq(2)
2016-04-02 18:10:28 +05:30
# Check tooltip data
2016-06-02 11:05:42 +05:30
page.all('.award-control.js-emoji-btn').each do |element|
2016-04-02 18:10:28 +05:30
expect(element['title']).to eq("")
end
2016-06-02 11:05:42 +05:30
page.all('.award-control .js-counter').each do |element|
2016-04-02 18:10:28 +05:30
expect(element).to have_content '0'
end
2015-11-26 14:37:03 +05:30
end
end
step 'project "Shop" has issue "Bugfix"' do
2015-12-23 02:04:40 +05:30
@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-06-02 11:05:42 +05:30
click_button 'Comment'
2015-12-23 02:04:40 +05:30
end
2015-11-26 14:37:03 +05:30
end
step 'I search "hand"' do
2016-08-24 12:49:21 +05:30
fill_in 'emoji_search', with: 'hand'
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-04-02 18:10:28 +05:30
2016-06-02 11:05:42 +05:30
step 'The emoji menu is visible' do
page.find(".emoji-menu.is-visible")
end
2016-04-02 18:10:28 +05:30
step 'The search field is focused' do
2016-06-02 11:05:42 +05:30
expect(page).to have_selector('#emoji_search')
expect(page.evaluate_script('document.activeElement.id')).to eq('emoji_search')
2016-04-02 18:10:28 +05:30
end
2015-11-26 14:37:03 +05:30
end