Add test for award-emoji being added as regular comment

This commit is contained in:
Grzegorz Bizon 2015-12-02 14:11:32 +00:00
parent a527f5c27f
commit 4676ba1f7c
2 changed files with 24 additions and 13 deletions

View file

@ -12,3 +12,7 @@ Feature: Award Emoji
Then I have award added
And I can remove it by clicking to icon
@javascript
Scenario: I add award emoji using regular comment
Given I leave comment with a single emoji
Then I have award added

View file

@ -9,33 +9,40 @@ class Spinach::Features::AwardEmoji < Spinach::FeatureSteps
end
step 'I click to emoji-picker' do
page.within ".awards-controls" do
page.find(".add-award").click
page.within '.awards-controls' do
page.find('.add-award').click
end
end
step 'I click to emoji in the picker' do
page.within ".awards-menu" do
page.first("img").click
page.within '.awards-menu' do
page.first('img').click
end
end
step 'I can remove it by clicking to icon' do
page.within ".awards" do
page.first(".award").click
expect(page).to_not have_selector ".award"
page.within '.awards' do
page.first('.award').click
expect(page).to_not have_selector '.award'
end
end
step 'I have award added' do
page.within ".awards" do
expect(page).to have_selector ".award"
expect(page.find(".award .counter")).to have_content "1"
page.within '.awards' do
expect(page).to have_selector '.award'
expect(page.find('.award .counter')).to have_content '1'
end
end
step 'project "Shop" has issue "Bugfix"' do
@project = Project.find_by(name: "Shop")
@issue = create(:issue, title: "Bugfix", project: project)
@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
end
end