Commit 33e7d73d authored by Jarka Košanová's avatar Jarka Košanová

Prepare epics in premium for FE integration

- move epics from ultimate to premium
- update documentation
parent b4036a8f
# Epics API **(ULTIMATE)**
# Epics API **(PREMIUM)**
Every API call to epic must be authenticated.
......
......@@ -66,6 +66,7 @@ class License < ApplicationRecord
design_management
disable_name_update_for_users
email_additional_text
epics
extended_audit_events
external_authorization_service_api_management
feature_flags
......@@ -110,7 +111,6 @@ class License < ApplicationRecord
credentials_inventory
dast
dependency_scanning
epics
group_ip_restriction
group_level_compliance_dashboard
incident_management
......
......@@ -30,6 +30,6 @@ class LinkedEpicEntity < Grape::Entity
end
expose :can_admin do |epic|
can?(request.current_user, :admin_epic, epic)
can?(request.current_user, :admin_epic_link, epic)
end
end
......@@ -98,108 +98,135 @@ describe 'Epic Issues', :js do
visit_epic
end
it 'user can display create new epic form by clicking the dropdown item' do
expect(page).not_to have_selector('input[placeholder="New epic title"]')
context 'handling epics' do
it 'user can display create new epic form by clicking the dropdown item' do
expect(page).not_to have_selector('input[placeholder="New epic title"]')
find('.related-items-tree-container .js-add-epics-button .dropdown-toggle').click
find('.related-items-tree-container .js-add-epics-button .dropdown-item', text: 'Create new epic').click
find('.related-items-tree-container .js-add-epics-button .dropdown-toggle').click
find('.related-items-tree-container .js-add-epics-button .dropdown-item', text: 'Create new epic').click
expect(page).to have_selector('input[placeholder="New epic title"]')
expect(page).to have_selector('input[placeholder="New epic title"]')
end
end
it 'user can see all issues of the group and delete the associations' do
within('.related-items-tree-container ul.related-items-list') do
expect(page).to have_selector('li.js-item-type-issue', count: 2)
expect(page).to have_content(public_issue.title)
expect(page).to have_content(private_issue.title)
context 'handling epic issues' do
it 'user can see all issues of the group and delete the associations' do
within('.related-items-tree-container ul.related-items-list') do
expect(page).to have_selector('li.js-item-type-issue', count: 2)
expect(page).to have_content(public_issue.title)
expect(page).to have_content(private_issue.title)
first('li.js-item-type-issue button.js-issue-item-remove-button').click
first('li.js-item-type-issue button.js-issue-item-remove-button').click
end
first('#item-remove-confirmation .modal-footer .btn-danger').click
wait_for_requests
within('.related-items-tree-container ul.related-items-list') do
expect(page).to have_selector('li.js-item-type-issue', count: 1)
end
end
first('#item-remove-confirmation .modal-footer .btn-danger').click
wait_for_requests
it 'user cannot add new issues to the epic from another group' do
add_issues("#{issue_invalid.to_reference(full: true)}")
within('.related-items-tree-container ul.related-items-list') do
expect(page).to have_selector('li.js-item-type-issue', count: 1)
expect(page).to have_selector('.gl-field-error')
expect(find('.gl-field-error')).to have_text("Issue cannot be found.")
end
end
it 'user can see all epics of the group and delete the associations' do
within('.related-items-tree-container ul.related-items-list') do
expect(page).to have_selector('li.js-item-type-epic', count: 2)
expect(page).to have_content(nested_epics[0].title)
expect(page).to have_content(nested_epics[1].title)
it 'user can add new issues to the epic' do
references = "#{issue_to_add.to_reference(full: true)}"
add_issues(references)
expect(page).not_to have_selector('.gl-field-error')
expect(page).not_to have_content("Issue cannot be found.")
first('li.js-item-type-epic button.js-issue-item-remove-button').click
within('.related-items-tree-container ul.related-items-list') do
expect(page).to have_selector('li.js-item-type-issue', count: 3)
end
end
first('#item-remove-confirmation .modal-footer .btn-danger').click
wait_for_requests
it 'user cannot add new issue that does not exist' do
add_issues("&123")
within('.related-items-tree-container ul.related-items-list') do
expect(page).to have_selector('li.js-item-type-epic', count: 1)
expect(page).to have_selector('.gl-field-error')
expect(find('.gl-field-error')).to have_text("Issue cannot be found.")
end
end
it 'user cannot add new issues to the epic from another group' do
add_issues("#{issue_invalid.to_reference(full: true)}")
context 'handling epic links' do
context 'when subepics feature is enabled' do
it 'user can see all epics of the group and delete the associations' do
within('.related-items-tree-container ul.related-items-list') do
expect(page).to have_selector('li.js-item-type-epic', count: 2)
expect(page).to have_content(nested_epics[0].title)
expect(page).to have_content(nested_epics[1].title)
expect(page).to have_selector('.gl-field-error')
expect(find('.gl-field-error')).to have_text("Issue cannot be found.")
end
first('li.js-item-type-epic button.js-issue-item-remove-button').click
end
first('#item-remove-confirmation .modal-footer .btn-danger').click
it 'user can add new issues to the epic' do
references = "#{issue_to_add.to_reference(full: true)}"
wait_for_requests
add_issues(references)
within('.related-items-tree-container ul.related-items-list') do
expect(page).to have_selector('li.js-item-type-epic', count: 1)
end
end
expect(page).not_to have_selector('.gl-field-error')
expect(page).not_to have_content("Issue cannot be found.")
it 'user cannot add new epic that does not exist' do
add_epics("&123")
within('.related-items-tree-container ul.related-items-list') do
expect(page).to have_selector('li.js-item-type-issue', count: 3)
end
end
expect(page).to have_selector('.gl-field-error')
expect(find('.gl-field-error')).to have_text("Epic cannot be found.")
end
it 'user cannot add new issue that does not exist' do
add_issues("&123")
it 'user can add new epics to the epic' do
references = "#{epic_to_add.to_reference(full: true)}"
add_epics(references)
expect(page).to have_selector('.gl-field-error')
expect(find('.gl-field-error')).to have_text("Issue cannot be found.")
end
expect(page).not_to have_selector('.gl-field-error')
expect(page).not_to have_content("Epic cannot be found.")
it 'user cannot add new epic that does not exist' do
add_epics("&123")
within('.related-items-tree-container ul.related-items-list') do
expect(page).to have_selector('li.js-item-type-epic', count: 3)
end
end
expect(page).to have_selector('.gl-field-error')
expect(find('.gl-field-error')).to have_text("Epic cannot be found.")
end
context 'when epics are nested too deep' do
let(:epic1) { create(:epic, group: group, parent_id: epic.id) }
let(:epic2) { create(:epic, group: group, parent_id: epic1.id) }
let(:epic3) { create(:epic, group: group, parent_id: epic2.id) }
let(:epic4) { create(:epic, group: group, parent_id: epic3.id) }
context 'when epics are nested too deep' do
let(:epic1) { create(:epic, group: group, parent_id: epic.id) }
let(:epic2) { create(:epic, group: group, parent_id: epic1.id) }
let(:epic3) { create(:epic, group: group, parent_id: epic2.id) }
let(:epic4) { create(:epic, group: group, parent_id: epic3.id) }
before do
visit group_epic_path(group, epic4)
before do
stub_licensed_features(epics: true, subepics: true)
wait_for_requests
sign_in(user)
visit group_epic_path(group, epic4)
find('.js-epic-tabs-container #tree-tab').click
wait_for_requests
wait_for_requests
end
find('.js-epic-tabs-container #tree-tab').click
it 'user cannot add new epic when hierarchy level limit has been reached' do
references = "#{epic_to_add.to_reference(full: true)}"
add_epics(references)
wait_for_requests
expect(page).to have_selector('.gl-field-error')
expect(find('.gl-field-error')).to have_text("This epic can't be added because the parent is already at the maximum depth from its most distant ancestor")
end
end
end
it 'user cannot add new epic when hierarchy level limit has been reached' do
references = "#{epic_to_add.to_reference(full: true)}"
add_epics(references)
context 'when subepics feature is disabled' do
it 'user can not add new epics to the epic' do
stub_licensed_features(epics: true, subepics: false)
expect(page).to have_selector('.gl-field-error')
expect(find('.gl-field-error')).to have_text("This epic can't be added because the parent is already at the maximum depth from its most distant ancestor")
visit_epic
expect(page).not_to have_selector('.related-items-tree-container .js-add-epics-button')
end
end
end
......@@ -222,17 +249,5 @@ describe 'Epic Issues', :js do
end
end
end
it 'user can add new epics to the epic' do
references = "#{epic_to_add.to_reference(full: true)}"
add_epics(references)
expect(page).not_to have_selector('.gl-field-error')
expect(page).not_to have_content("Epic cannot be found.")
within('.related-items-tree-container ul.related-items-list') do
expect(page).to have_selector('li.js-item-type-epic', count: 3)
end
end
end
end
......@@ -1372,7 +1372,8 @@ describe Project do
before do
allow(License).to receive(:current).and_return(global_license)
allow(global_license).to receive(:features).and_return([
:epics, # Gold only
:subepics, # Gold only
:epics, # Silver and up
:service_desk, # Silver and up
:audit_events, # Bronze and up
:geo # Global feature, should not be checked at namespace level
......@@ -1398,7 +1399,7 @@ describe Project do
let(:plan_license) { :silver }
it 'filters for silver features' do
is_expected.to contain_exactly(:service_desk, :audit_events, :geo)
is_expected.to contain_exactly(:service_desk, :audit_events, :geo, :epics)
end
end
......@@ -1406,7 +1407,7 @@ describe Project do
let(:plan_license) { :gold }
it 'filters for gold features' do
is_expected.to contain_exactly(:epics, :service_desk, :audit_events, :geo)
is_expected.to contain_exactly(:epics, :service_desk, :audit_events, :geo, :subepics)
end
end
......@@ -1423,7 +1424,7 @@ describe Project do
let(:project) { create(:project, :public, group: group) }
it 'includes all features in global license' do
is_expected.to contain_exactly(:epics, :service_desk, :audit_events, :geo)
is_expected.to contain_exactly(:epics, :service_desk, :audit_events, :geo, :subepics)
end
end
end
......@@ -1431,7 +1432,7 @@ describe Project do
context 'when namespace should not be checked' do
it 'includes all features in global license' do
is_expected.to contain_exactly(:epics, :service_desk, :audit_events, :geo)
is_expected.to contain_exactly(:epics, :service_desk, :audit_events, :geo, :subepics)
end
end
......
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