Commit 6cf8378d authored by Jarka Kadlecova's avatar Jarka Kadlecova

Add additional spec and assertions for epis_issues

parent d15e704e
...@@ -43,6 +43,17 @@ describe 'Epic Issues', :js do ...@@ -43,6 +43,17 @@ describe 'Epic Issues', :js do
end end
context 'when user is a group member' do context 'when user is a group member' do
let(:issue_to_add) { create(:issue, project: private_project) }
let(:issue_invalid) { create(:issue) }
def add_issues(references)
find('.related-issues-block h3.panel-title button').click
find('.js-add-issuable-form-input').set(references)
find('.js-add-issuable-form-add-button').click
wait_for_requests
end
before do before do
group.add_developer(user) group.add_developer(user)
visit_epic visit_epic
...@@ -64,16 +75,20 @@ describe 'Epic Issues', :js do ...@@ -64,16 +75,20 @@ describe 'Epic Issues', :js do
end end
end end
it 'user cannot add new issues to the epic from another group' do
add_issues("#{issue_invalid.to_reference(full: true)}")
expect(page).to have_selector('.content-wrapper .alert-wrapper .flash-text')
expect(find('.flash-alert')).to have_text('No Issue found for given params')
end
it 'user can add new issues to the epic' do it 'user can add new issues to the epic' do
issue_to_add = create(:issue, project: private_project)
issue_invalid = create(:issue)
references = "#{issue_to_add.to_reference(full: true)} #{issue_invalid.to_reference(full: true)}" references = "#{issue_to_add.to_reference(full: true)} #{issue_invalid.to_reference(full: true)}"
find('.related-issues-block h3.panel-title button').click add_issues(references)
find('.js-add-issuable-form-input').set references
find('.js-add-issuable-form-add-button').click
wait_for_requests expect(page).not_to have_selector('.content-wrapper .alert-wrapper .flash-text')
expect(page).not_to have_content('No Issue found for given params')
within('.related-issues-block ul.issuable-list') do within('.related-issues-block ul.issuable-list') do
expect(page).to have_selector('li', count: 3) expect(page).to have_selector('li', count: 3)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment