debian-mirror-gitlab/spec/features/dashboard/activity_spec.rb

177 lines
5.3 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe 'Dashboard > Activity' do
2017-09-10 17:25:29 +05:30
let(:user) { create(:user) }
2017-08-17 22:00:37 +05:30
before do
2017-09-10 17:25:29 +05:30
sign_in(user)
end
context 'rss' do
before do
visit activity_dashboard_path
end
2018-11-08 19:23:39 +05:30
it_behaves_like "it has an RSS button with current_user's feed token"
it_behaves_like "an autodiscoverable RSS feed with current_user's feed token"
2017-09-10 17:25:29 +05:30
end
context 'event filters', :js do
2018-03-17 18:26:18 +05:30
let(:project) { create(:project, :repository) }
2017-09-10 17:25:29 +05:30
let(:merge_request) do
create(:merge_request, author: user, source_project: project, target_project: project)
end
let(:note) { create(:note, project: project, noteable: merge_request) }
2018-03-17 18:26:18 +05:30
let(:milestone) { create(:milestone, :active, project: project, title: '1.0') }
2017-09-10 17:25:29 +05:30
let!(:push_event) do
event = create(:push_event, project: project, author: user)
create(:push_event_payload,
event: event,
action: :created,
commit_to: '0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e',
ref: 'new_design',
commit_count: 1)
event
end
2019-07-07 11:18:12 +05:30
let(:issue) { create(:issue, project: project) }
2017-09-10 17:25:29 +05:30
let!(:merged_event) do
create(:event, :merged, project: project, target: merge_request, author: user)
end
let!(:joined_event) do
create(:event, :joined, project: project, author: user)
end
let!(:closed_event) do
create(:event, :closed, project: project, target: merge_request, author: user)
end
let!(:comments_event) do
create(:event, :commented, project: project, target: note, author: user)
end
2018-03-17 18:26:18 +05:30
let!(:milestone_event) do
create(:event, :closed, project: project, target: milestone, author: user)
end
2019-07-07 11:18:12 +05:30
let!(:issue_event) do
create(:event, :created, project: project, target: issue, author: user)
end
2017-09-10 17:25:29 +05:30
before do
2018-11-18 11:00:15 +05:30
project.add_maintainer(user)
2017-09-10 17:25:29 +05:30
visit activity_dashboard_path
wait_for_requests
end
2018-11-08 19:23:39 +05:30
it 'user should see all events' do
2017-09-10 17:25:29 +05:30
within '.content_list' do
expect(page).to have_content('pushed new branch')
expect(page).to have_content('joined')
expect(page).to have_content('accepted')
expect(page).to have_content('closed')
expect(page).to have_content('commented on')
2018-03-17 18:26:18 +05:30
expect(page).to have_content('closed milestone')
2019-07-07 11:18:12 +05:30
expect(page).to have_content('opened issue')
2017-09-10 17:25:29 +05:30
end
end
2018-11-08 19:23:39 +05:30
it 'user should see only pushed events' do
2017-09-10 17:25:29 +05:30
click_link('Push events')
wait_for_requests
within '.content_list' do
expect(page).to have_content('pushed new branch')
expect(page).not_to have_content('joined')
expect(page).not_to have_content('accepted')
expect(page).not_to have_content('closed')
expect(page).not_to have_content('commented on')
2019-07-07 11:18:12 +05:30
expect(page).not_to have_content('opened issue')
2017-09-10 17:25:29 +05:30
end
end
2018-11-08 19:23:39 +05:30
it 'user should see only merged events' do
2017-09-10 17:25:29 +05:30
click_link('Merge events')
wait_for_requests
within '.content_list' do
expect(page).not_to have_content('pushed new branch')
expect(page).not_to have_content('joined')
expect(page).to have_content('accepted')
expect(page).not_to have_content('closed')
expect(page).not_to have_content('commented on')
2019-07-07 11:18:12 +05:30
expect(page).not_to have_content('opened issue')
2017-09-10 17:25:29 +05:30
end
end
2018-11-08 19:23:39 +05:30
it 'user should see only issues events' do
2017-09-10 17:25:29 +05:30
click_link('Issue events')
wait_for_requests
within '.content_list' do
expect(page).not_to have_content('pushed new branch')
expect(page).not_to have_content('joined')
expect(page).not_to have_content('accepted')
2019-07-07 11:18:12 +05:30
expect(page).not_to have_content('closed')
2017-09-10 17:25:29 +05:30
expect(page).not_to have_content('commented on')
2019-07-07 11:18:12 +05:30
expect(page).not_to have_content('closed milestone')
expect(page).to have_content('opened issue')
2017-09-10 17:25:29 +05:30
end
end
2018-11-08 19:23:39 +05:30
it 'user should see only comments events' do
2017-09-10 17:25:29 +05:30
click_link('Comments')
wait_for_requests
within '.content_list' do
expect(page).not_to have_content('pushed new branch')
expect(page).not_to have_content('joined')
expect(page).not_to have_content('accepted')
expect(page).not_to have_content('closed')
expect(page).to have_content('commented on')
2019-07-07 11:18:12 +05:30
expect(page).not_to have_content('opened issue')
2017-09-10 17:25:29 +05:30
end
end
2018-11-08 19:23:39 +05:30
it 'user should see only joined events' do
2017-09-10 17:25:29 +05:30
click_link('Team')
wait_for_requests
within '.content_list' do
expect(page).not_to have_content('pushed new branch')
expect(page).to have_content('joined')
expect(page).not_to have_content('accepted')
expect(page).not_to have_content('closed')
expect(page).not_to have_content('commented on')
2019-07-07 11:18:12 +05:30
expect(page).not_to have_content('opened issue')
2017-09-10 17:25:29 +05:30
end
end
2018-11-08 19:23:39 +05:30
it 'user see selected event after page reloading' do
2017-09-10 17:25:29 +05:30
click_link('Push events')
wait_for_requests
visit activity_dashboard_path
wait_for_requests
within '.content_list' do
expect(page).to have_content('pushed new branch')
expect(page).not_to have_content('joined')
expect(page).not_to have_content('accepted')
expect(page).not_to have_content('closed')
expect(page).not_to have_content('commented on')
2019-07-07 11:18:12 +05:30
expect(page).not_to have_content('opened issue')
2017-09-10 17:25:29 +05:30
end
end
2017-08-17 22:00:37 +05:30
end
end