debian-mirror-gitlab/spec/features/merge_request/user_awards_emoji_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

81 lines
2.3 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2019-12-04 20:38:33 +05:30
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe 'Merge request > User awards emoji', :js do
2017-09-10 17:25:29 +05:30
let(:project) { create(:project, :public, :repository) }
2018-03-17 18:26:18 +05:30
let(:user) { project.creator }
let(:merge_request) { create(:merge_request, source_project: project, author: create(:user)) }
2019-02-15 15:39:39 +05:30
let!(:note) { create(:note, noteable: merge_request, project: merge_request.project) }
describe 'logged in' do
before do
2017-09-10 17:25:29 +05:30
sign_in(user)
2019-02-15 15:39:39 +05:30
2022-07-23 23:45:48 +05:30
visit project_merge_request_path(project, merge_request)
2019-02-15 15:39:39 +05:30
wait_for_requests
end
2016-09-13 17:45:13 +05:30
it 'adds award to merge request' do
2021-04-29 21:17:54 +05:30
first('[data-testid="award-button"]').click
2022-07-23 23:45:48 +05:30
wait_for_requests
2021-09-04 01:27:46 +05:30
expect(page).to have_selector('[data-testid="award-button"].selected')
2021-04-29 21:17:54 +05:30
expect(first('[data-testid="award-button"]')).to have_content '1'
2017-09-10 17:25:29 +05:30
visit project_merge_request_path(project, merge_request)
2022-07-23 23:45:48 +05:30
wait_for_requests
2021-04-29 21:17:54 +05:30
expect(first('[data-testid="award-button"]')).to have_content '1'
end
2016-09-13 17:45:13 +05:30
it 'removes award from merge request' do
2021-04-29 21:17:54 +05:30
first('[data-testid="award-button"]').click
2022-07-23 23:45:48 +05:30
wait_for_requests
2022-04-04 11:22:00 +05:30
expect(first('[data-testid="award-button"]')).to have_content '1'
2022-07-23 23:45:48 +05:30
2021-09-04 01:27:46 +05:30
find('[data-testid="award-button"].selected').click
2022-07-23 23:45:48 +05:30
wait_for_requests
2021-04-29 21:17:54 +05:30
expect(first('[data-testid="award-button"]')).to have_content '0'
2017-09-10 17:25:29 +05:30
visit project_merge_request_path(project, merge_request)
2022-07-23 23:45:48 +05:30
wait_for_requests
2021-04-29 21:17:54 +05:30
expect(first('[data-testid="award-button"]')).to have_content '0'
end
2018-05-09 12:01:36 +05:30
2019-02-15 15:39:39 +05:30
it 'adds awards to note' do
2021-04-29 21:17:54 +05:30
page.within('.note-actions') do
first('.note-emoji-button').click
2022-07-16 23:28:13 +05:30
# make sure emoji popup is visible
execute_script("window.scrollBy(0, 200)")
2021-04-29 21:17:54 +05:30
find('gl-emoji[data-name="8ball"]').click
end
2019-02-15 15:39:39 +05:30
wait_for_requests
expect(page).to have_selector('.js-awards-block')
end
2018-05-09 12:01:36 +05:30
describe 'the project is archived' do
let(:project) { create(:project, :public, :repository, :archived) }
it 'does not see award menu button' do
expect(page).not_to have_selector('.js-award-holder')
end
end
end
describe 'logged out' do
before do
2017-09-10 17:25:29 +05:30
visit project_merge_request_path(project, merge_request)
2022-07-23 23:45:48 +05:30
wait_for_requests
end
2016-09-13 17:45:13 +05:30
it 'does not see award menu button' do
expect(page).not_to have_selector('.js-award-holder')
end
end
end