diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /spec/features/incidents | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/features/incidents')
-rw-r--r-- | spec/features/incidents/user_views_incident_spec.rb | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/spec/features/incidents/user_views_incident_spec.rb b/spec/features/incidents/user_views_incident_spec.rb new file mode 100644 index 00000000000..3595f5c03ec --- /dev/null +++ b/spec/features/incidents/user_views_incident_spec.rb @@ -0,0 +1,82 @@ +# frozen_string_literal: true + +require "spec_helper" + +RSpec.describe "User views incident" do + let_it_be(:project) { create(:project_empty_repo, :public) } + let_it_be(:user) { create(:user) } + let_it_be(:incident) { create(:incident, project: project, description: "# Description header\n\n**Lorem** _ipsum_ dolor sit [amet](https://example.com)", author: user) } + let_it_be(:note) { create(:note, noteable: incident, project: project, author: user) } + + before_all do + project.add_developer(user) + end + + before do + stub_feature_flags(vue_issue_header: false) + + sign_in(user) + + visit(project_issues_incident_path(project, incident)) + end + + it { expect(page).to have_header_with_correct_id_and_link(1, "Description header", "description-header") } + + it_behaves_like 'page meta description', ' Description header Lorem ipsum dolor sit amet' + + it 'shows the merge request and incident actions', :aggregate_failures do + expect(page).to have_link('New incident') + expect(page).to have_button('Create merge request') + expect(page).to have_link('Close incident') + end + + context 'when the project is archived' do + before do + project.update!(archived: true) + visit(project_issues_incident_path(project, incident)) + end + + it 'hides the merge request and incident actions', :aggregate_failures do + expect(page).not_to have_link('New incident') + expect(page).not_to have_button('Create merge request') + expect(page).not_to have_link('Close incident') + end + end + + describe 'user status' do + subject { visit(project_issues_incident_path(project, incident)) } + + context 'when showing status of the author of the incident' do + it_behaves_like 'showing user status' do + let(:user_with_status) { user } + end + end + + context 'when showing status of a user who commented on an incident', :js do + it_behaves_like 'showing user status' do + let(:user_with_status) { user } + end + end + + context 'when status message has an emoji', :js do + 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}:") } + + it 'correctly renders the emoji' do + wait_for_requests + + tooltip_span = page.first(".user-status-emoji[title^='#{message}']") + tooltip_span.hover + + wait_for_requests + + tooltip = page.find('.tooltip .tooltip-inner') + + page.within(tooltip) do + expect(page).to have_emoji(message_emoji) + end + end + end + end +end |