debian-mirror-gitlab/spec/features/explore/groups_list_spec.rb

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

92 lines
2.8 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 'Explore Groups page', :js do
2017-08-17 22:00:37 +05:30
let!(:user) { create :user }
let!(:group) { create(:group) }
let!(:public_group) { create(:group, :public) }
let!(:private_group) { create(:group, :private) }
2017-09-10 17:25:29 +05:30
let!(:empty_project) { create(:project, group: public_group) }
2017-08-17 22:00:37 +05:30
before do
group.add_owner(user)
2017-09-10 17:25:29 +05:30
sign_in(user)
2017-08-17 22:00:37 +05:30
visit explore_groups_path
2018-03-17 18:26:18 +05:30
wait_for_requests
2017-08-17 22:00:37 +05:30
end
it 'shows groups user is member of' do
expect(page).to have_content(group.full_name)
expect(page).to have_content(public_group.full_name)
expect(page).not_to have_content(private_group.full_name)
end
it 'filters groups' do
2018-03-17 18:26:18 +05:30
fill_in 'filter', with: group.name
2017-09-10 17:25:29 +05:30
wait_for_requests
2017-08-17 22:00:37 +05:30
expect(page).to have_content(group.full_name)
expect(page).not_to have_content(public_group.full_name)
expect(page).not_to have_content(private_group.full_name)
end
it 'resets search when user cleans the input' do
2018-03-17 18:26:18 +05:30
fill_in 'filter', with: group.name
2017-09-10 17:25:29 +05:30
wait_for_requests
2017-08-17 22:00:37 +05:30
2018-11-08 19:23:39 +05:30
expect(page).to have_content(group.full_name)
expect(page).not_to have_content(public_group.full_name)
2018-03-17 18:26:18 +05:30
fill_in 'filter', with: ""
2018-11-08 19:23:39 +05:30
page.find('[name="filter"]').send_keys(:enter)
2017-09-10 17:25:29 +05:30
wait_for_requests
2017-08-17 22:00:37 +05:30
expect(page).to have_content(group.full_name)
expect(page).to have_content(public_group.full_name)
expect(page).not_to have_content(private_group.full_name)
2020-04-22 19:07:51 +05:30
expect(page.all('.js-groups-list-holder .groups-list li').length).to eq 2
2017-08-17 22:00:37 +05:30
end
it 'shows non-archived projects count' do
# Initially project is not archived
2020-04-22 19:07:51 +05:30
expect(find('.js-groups-list-holder .groups-list li:first-child .stats .number-projects')).to have_text("1")
2017-08-17 22:00:37 +05:30
# Archive project
2018-11-18 11:00:15 +05:30
::Projects::UpdateService.new(empty_project, user, archived: true).execute
2017-08-17 22:00:37 +05:30
visit explore_groups_path
# Check project count
2020-04-22 19:07:51 +05:30
expect(find('.js-groups-list-holder .groups-list li:first-child .stats .number-projects')).to have_text("0")
2017-08-17 22:00:37 +05:30
# Unarchive project
2018-11-18 11:00:15 +05:30
::Projects::UpdateService.new(empty_project, user, archived: false).execute
2017-08-17 22:00:37 +05:30
visit explore_groups_path
# Check project count
2020-04-22 19:07:51 +05:30
expect(find('.js-groups-list-holder .groups-list li:first-child .stats .number-projects')).to have_text("1")
2017-08-17 22:00:37 +05:30
end
describe 'landing component' do
2019-07-07 11:18:12 +05:30
it 'shows a landing component' do
2017-08-17 22:00:37 +05:30
expect(page).to have_content('Below you will find all the groups that are public.')
end
2019-07-07 11:18:12 +05:30
it 'is dismissable' do
2017-08-17 22:00:37 +05:30
find('.dismiss-button').click
expect(page).not_to have_content('Below you will find all the groups that are public.')
end
2019-07-07 11:18:12 +05:30
it 'does not show persistently once dismissed' do
2017-08-17 22:00:37 +05:30
find('.dismiss-button').click
visit explore_groups_path
expect(page).not_to have_content('Below you will find all the groups that are public.')
end
end
end