Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/explore/groups_list_spec.rb')
-rw-r--r--spec/features/explore/groups_list_spec.rb132
1 files changed, 74 insertions, 58 deletions
diff --git a/spec/features/explore/groups_list_spec.rb b/spec/features/explore/groups_list_spec.rb
index 39cd3c80307..91ee6d48a48 100644
--- a/spec/features/explore/groups_list_spec.rb
+++ b/spec/features/explore/groups_list_spec.rb
@@ -4,88 +4,104 @@ require 'spec_helper'
RSpec.describe 'Explore Groups page', :js, feature_category: :groups_and_projects do
let!(:user) { create :user }
- let!(:group) { create(:group) }
- let!(:public_group) { create(:group, :public) }
- let!(:private_group) { create(:group, :private) }
- let!(:empty_project) { create(:project, group: public_group) }
- before do
- group.add_owner(user)
+ context 'when there are groups to show' do
+ let!(:group) { create(:group) }
+ let!(:public_group) { create(:group, :public) }
+ let!(:private_group) { create(:group, :private) }
+ let!(:empty_project) { create(:project, group: public_group) }
- sign_in(user)
+ before do
+ group.add_owner(user)
- visit explore_groups_path
- wait_for_requests
- end
+ sign_in(user)
- 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
+ visit explore_groups_path
+ wait_for_requests
+ end
- it 'filters groups' do
- fill_in 'filter', with: group.name
- wait_for_requests
+ 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
- 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 'filters groups' do
+ fill_in 'filter', with: group.name
+ wait_for_requests
- it 'resets search when user cleans the input' do
- fill_in 'filter', with: group.name
- wait_for_requests
+ 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
- expect(page).to have_content(group.full_name)
- expect(page).not_to have_content(public_group.full_name)
+ it 'resets search when user cleans the input' do
+ fill_in 'filter', with: group.name
+ wait_for_requests
- fill_in 'filter', with: ""
- page.find('[name="filter"]').send_keys(:enter)
- wait_for_requests
+ expect(page).to have_content(group.full_name)
+ expect(page).not_to have_content(public_group.full_name)
- 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)
- expect(page.all('.js-groups-list-holder .groups-list li').length).to eq 2
- end
+ fill_in 'filter', with: ""
+ page.find('[name="filter"]').send_keys(:enter)
+ wait_for_requests
- it 'shows non-archived projects count' do
- # Initially project is not archived
- expect(find('.js-groups-list-holder .groups-list li:first-child .stats .number-projects')).to have_text("1")
+ 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)
+ expect(page.all('.js-groups-list-holder .groups-list li').length).to eq 2
+ end
- # Archive project
- ::Projects::UpdateService.new(empty_project, user, archived: true).execute
- visit explore_groups_path
+ it 'shows non-archived projects count' do
+ # Initially project is not archived
+ expect(find('.js-groups-list-holder .groups-list li:first-child .stats .number-projects')).to have_text("1")
- # Check project count
- expect(find('.js-groups-list-holder .groups-list li:first-child .stats .number-projects')).to have_text("0")
+ # Archive project
+ ::Projects::UpdateService.new(empty_project, user, archived: true).execute
+ visit explore_groups_path
- # Unarchive project
- ::Projects::UpdateService.new(empty_project, user, archived: false).execute
- visit explore_groups_path
+ # Check project count
+ expect(find('.js-groups-list-holder .groups-list li:first-child .stats .number-projects')).to have_text("0")
- # Check project count
- expect(find('.js-groups-list-holder .groups-list li:first-child .stats .number-projects')).to have_text("1")
- end
+ # Unarchive project
+ ::Projects::UpdateService.new(empty_project, user, archived: false).execute
+ visit explore_groups_path
- describe 'landing component' do
- it 'shows a landing component' do
- expect(page).to have_content('Below you will find all the groups that are public.')
+ # Check project count
+ expect(find('.js-groups-list-holder .groups-list li:first-child .stats .number-projects')).to have_text("1")
end
- it 'is dismissable' do
- find('.dismiss-button').click
+ describe 'landing component' do
+ it 'shows a landing component' do
+ expect(page).to have_content('Below you will find all the groups that are public.')
+ end
+
+ it 'is dismissable' do
+ find('.dismiss-button').click
+
+ expect(page).not_to have_content('Below you will find all the groups that are public.')
+ end
- expect(page).not_to have_content('Below you will find all the groups that are public.')
+ it 'does not show persistently once dismissed' do
+ 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
- it 'does not show persistently once dismissed' do
- find('.dismiss-button').click
+ context 'when there are no groups to show' do
+ before do
+ sign_in(user)
visit explore_groups_path
+ wait_for_requests
+ end
- expect(page).not_to have_content('Below you will find all the groups that are public.')
+ it 'shows empty state' do
+ expect(page).to have_content(_('No public groups'))
end
end
end