diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/features/users/overview_spec.rb | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) | |
download | gitlab-ce-859a6fb938bb9ee2a317c46dfa4fcc1af49608f0.tar.gz |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/features/users/overview_spec.rb')
-rw-r--r-- | spec/features/users/overview_spec.rb | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/spec/features/users/overview_spec.rb b/spec/features/users/overview_spec.rb index 67216b04504..902079b7b93 100644 --- a/spec/features/users/overview_spec.rb +++ b/spec/features/users/overview_spec.rb @@ -151,6 +151,132 @@ RSpec.describe 'Overview tab on a user profile', :js do end end + describe 'followers section' do + describe 'user has no followers' do + before do + visit user.username + page.find('.js-followers-tab a').click + wait_for_requests + end + + it 'shows an empty followers list with an info message' do + page.within('#followers') do + expect(page).to have_content('You do not have any followers') + expect(page).not_to have_selector('.gl-card.gl-mb-5') + expect(page).not_to have_selector('.gl-pagination') + end + end + end + + describe 'user has less then 20 followers' do + let(:follower) { create(:user) } + + before do + follower.follow(user) + visit user.username + page.find('.js-followers-tab a').click + wait_for_requests + end + + it 'shows followers' do + page.within('#followers') do + expect(page).to have_content(follower.name) + expect(page).to have_selector('.gl-card.gl-mb-5') + expect(page).not_to have_selector('.gl-pagination') + end + end + end + + describe 'user has more then 20 followers' do + let(:other_users) { create_list(:user, 21) } + + before do + other_users.each do |follower| + follower.follow(user) + end + + visit user.username + page.find('.js-followers-tab a').click + wait_for_requests + end + it 'shows paginated followers' do + page.within('#followers') do + other_users.each_with_index do |follower, i| + break if i == 20 + + expect(page).to have_content(follower.name) + end + expect(page).to have_selector('.gl-card.gl-mb-5') + expect(page).to have_selector('.gl-pagination') + expect(page).to have_selector('.gl-pagination .js-pagination-page', count: 2) + end + end + end + end + + describe 'following section' do + describe 'user is not following others' do + before do + visit user.username + page.find('.js-following-tab a').click + wait_for_requests + end + + it 'shows an empty following list with an info message' do + page.within('#following') do + expect(page).to have_content('You are not following other users') + expect(page).not_to have_selector('.gl-card.gl-mb-5') + expect(page).not_to have_selector('.gl-pagination') + end + end + end + + describe 'user is following less then 20 people' do + let(:followee) { create(:user) } + + before do + user.follow(followee) + visit user.username + page.find('.js-following-tab a').click + wait_for_requests + end + + it 'shows following user' do + page.within('#following') do + expect(page).to have_content(followee.name) + expect(page).to have_selector('.gl-card.gl-mb-5') + expect(page).not_to have_selector('.gl-pagination') + end + end + end + + describe 'user is following more then 20 people' do + let(:other_users) { create_list(:user, 21) } + + before do + other_users.each do |followee| + user.follow(followee) + end + + visit user.username + page.find('.js-following-tab a').click + wait_for_requests + end + it 'shows paginated following' do + page.within('#following') do + other_users.each_with_index do |followee, i| + break if i == 20 + + expect(page).to have_content(followee.name) + end + expect(page).to have_selector('.gl-card.gl-mb-5') + expect(page).to have_selector('.gl-pagination') + expect(page).to have_selector('.gl-pagination .js-pagination-page', count: 2) + end + end + end + end + describe 'bot user' do let(:bot_user) { create(:user, user_type: :security_bot) } |