debian-mirror-gitlab/spec/features/projects/group_links_spec.rb

78 lines
2.1 KiB
Ruby
Raw Normal View History

2016-09-13 17:45:13 +05:30
require 'spec_helper'
2017-09-10 17:25:29 +05:30
feature 'Project group links', :js do
2016-09-13 17:45:13 +05:30
include Select2Helper
let(:master) { create(:user) }
let(:project) { create(:project) }
let!(:group) { create(:group) }
background do
2017-08-17 22:00:37 +05:30
project.add_master(master)
2017-09-10 17:25:29 +05:30
sign_in(master)
2016-09-13 17:45:13 +05:30
end
context 'setting an expiration date for a group link' do
before do
2017-09-10 17:25:29 +05:30
visit project_settings_members_path(project)
click_on 'share-with-group-tab'
2016-09-13 17:45:13 +05:30
select2 group.id, from: '#link_group_id'
2017-08-17 22:00:37 +05:30
fill_in 'expires_at_groups', with: (Time.current + 4.5.days).strftime('%Y-%m-%d')
2016-09-13 17:45:13 +05:30
page.find('body').click
2017-09-10 17:25:29 +05:30
find('.btn-create').trigger('click')
2016-09-13 17:45:13 +05:30
end
it 'shows the expiration time with a warning class' do
2017-09-10 17:25:29 +05:30
page.within('.project-members-groups') do
expect(page).to have_content('Expires in 4 days')
2016-09-13 17:45:13 +05:30
expect(page).to have_selector('.text-warning')
end
end
end
2017-08-17 22:00:37 +05:30
context 'nested group project' do
let!(:nested_group) { create(:group, parent: group) }
let!(:another_group) { create(:group) }
let!(:project) { create(:project, namespace: nested_group) }
background do
group.add_master(master)
another_group.add_master(master)
end
2017-09-10 17:25:29 +05:30
it 'does not show ancestors', :nested_groups do
visit project_settings_members_path(project)
2017-08-17 22:00:37 +05:30
2017-09-10 17:25:29 +05:30
click_on 'share-with-group-tab'
2017-08-17 22:00:37 +05:30
click_link 'Search for a group'
page.within '.select2-drop' do
expect(page).to have_content(another_group.name)
expect(page).not_to have_content(group.name)
end
end
end
describe 'the groups dropdown' do
before do
group_two = create(:group)
group.add_owner(master)
group_two.add_owner(master)
2017-09-10 17:25:29 +05:30
visit project_settings_members_path(project)
2017-08-17 22:00:37 +05:30
execute_script 'GroupsSelect.PER_PAGE = 1;'
open_select2 '#link_group_id'
end
it 'should infinitely scroll' do
expect(find('.select2-drop .select2-results')).to have_selector('.select2-result', count: 1)
scroll_select2_to_bottom('.select2-drop .select2-results:visible')
expect(find('.select2-drop .select2-results')).to have_selector('.select2-result', count: 2)
end
end
2016-09-13 17:45:13 +05:30
end