debian-mirror-gitlab/spec/features/issues/user_views_issue_spec.rb

81 lines
2.5 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-05-09 12:01:36 +05:30
require "spec_helper"
2020-06-23 00:09:42 +05:30
RSpec.describe "User views issue" do
2020-11-24 15:15:51 +05:30
let_it_be(:project) { create(:project_empty_repo, :public) }
let_it_be(:user) { create(:user) }
2021-01-03 14:25:43 +05:30
let_it_be(:issue) { create(:issue, project: project, description: "# Description header\n\n**Lorem** _ipsum_ dolor sit [amet](https://example.com)", author: user) }
2020-11-24 15:15:51 +05:30
let_it_be(:note) { create(:note, noteable: issue, project: project, author: user) }
2018-05-09 12:01:36 +05:30
2020-11-24 15:15:51 +05:30
before_all do
2018-05-09 12:01:36 +05:30
project.add_developer(user)
2020-11-24 15:15:51 +05:30
end
before do
2018-05-09 12:01:36 +05:30
sign_in(user)
visit(project_issue_path(project, issue))
end
it { expect(page).to have_header_with_correct_id_and_link(1, "Description header", "description-header") }
2021-01-03 14:25:43 +05:30
it_behaves_like 'page meta description', ' Description header Lorem ipsum dolor sit amet'
2021-02-22 17:27:13 +05:30
it 'shows the merge request and issue actions', :js, :aggregate_failures do
click_button 'Issue actions'
2022-05-07 20:08:51 +05:30
expect(page).to have_link('New related issue', href: new_project_issue_path(project, { add_related_issue: issue.iid }))
2018-05-09 12:01:36 +05:30
expect(page).to have_button('Create merge request')
2021-02-22 17:27:13 +05:30
expect(page).to have_button('Close issue')
2018-05-09 12:01:36 +05:30
end
context 'when the project is archived' do
let(:project) { create(:project, :public, :archived) }
it 'hides the merge request and issue actions', :aggregate_failures do
expect(page).not_to have_link('New issue')
expect(page).not_to have_button('Create merge request')
expect(page).not_to have_link('Close issue')
end
end
2018-11-18 11:00:15 +05:30
describe 'user status' do
subject { visit(project_issue_path(project, issue)) }
2020-06-23 00:09:42 +05:30
context 'when showing status of the author of the issue' do
2018-11-18 11:00:15 +05:30
it_behaves_like 'showing user status' do
2020-11-24 15:15:51 +05:30
let(:user_with_status) { user }
2018-11-18 11:00:15 +05:30
end
end
2020-06-23 00:09:42 +05:30
context 'when showing status of a user who commented on an issue', :js do
2018-11-18 11:00:15 +05:30
it_behaves_like 'showing user status' do
2020-11-24 15:15:51 +05:30
let(:user_with_status) { user }
2018-11-18 11:00:15 +05:30
end
end
2020-06-23 00:09:42 +05:30
context 'when status message has an emoji', :js do
2020-11-24 15:15:51 +05:30
let_it_be(:message) { 'My status with an emoji' }
let_it_be(:message_emoji) { 'basketball' }
let_it_be(:status) { create(:user_status, user: user, emoji: 'smirk', message: "#{message} :#{message_emoji}:") }
2020-06-23 00:09:42 +05:30
it 'correctly renders the emoji' do
2020-11-24 15:15:51 +05:30
wait_for_requests
2020-06-23 00:09:42 +05:30
tooltip_span = page.first(".user-status-emoji[title^='#{message}']")
tooltip_span.hover
2020-11-24 15:15:51 +05:30
wait_for_requests
2020-06-23 00:09:42 +05:30
tooltip = page.find('.tooltip .tooltip-inner')
page.within(tooltip) do
expect(page).to have_emoji(message_emoji)
end
end
end
2018-11-18 11:00:15 +05:30
end
2018-05-09 12:01:36 +05:30
end