Commit 9d60ef37 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'ccr/7743_issue_sidebar' into 'master'

Show promotion for epics on issues

See merge request gitlab-org/gitlab-ee!7602
parents 76da065b 94048497
......@@ -108,5 +108,9 @@ module LicenseHelper
!Gitlab::CurrentSettings.should_check_namespace_plan? && show_promotions? && show_callout?('promote_advanced_search_dismissed') && !License.feature_available?(:elastic_search)
end
def promote_feature?(feature_name)
!@project&.group&.feature_available?(feature_name) && show_promotions? && show_callout?(feature_name)
end
extend self
end
- promotion_feature = 'promote_epics_sidebar_dismissed'
- if !@project.feature_available?(:epics) && show_promotions? && show_callout?(promotion_feature)
- if promote_feature?(:epic)
.block.js-epics-sidebar-callout.promotion-issue-sidebar{ data: { uid: promotion_feature } }
.sidebar-collapsed-icon{ data: { toggle: "dropdown", target: ".js-epics-sidebar-callout" } }
%span{ data: { toggle: "tooltip", placement: "left", container: "body" }, title: _('Epic') }
......
---
title: Show promotion for epics on issues
merge_request: 7602
author:
type: fixed
......@@ -236,53 +236,71 @@ describe 'Promotions', :js do
end
describe 'for epics in issues sidebar', :js do
before do
allow(License).to receive(:current).and_return(nil)
stub_application_setting(check_namespace_plan: false)
shared_examples 'Epics promotion' do
it 'should appear on the page' do
visit project_issue_path(project, issue)
wait_for_requests
project.add_maintainer(user)
sign_in(user)
end
click_epic_link
it 'should appear on the page' do
visit project_issue_path(project, issue)
wait_for_requests
expect(find('.promotion-issue-sidebar-message')).to have_content 'Epics let you manage your portfolio of projects more efficiently'
end
find('.js-epics-sidebar-callout .btn-link').click
it 'should be removed after dismissal' do
visit project_issue_path(project, issue)
wait_for_requests
expect(find('.promotion-issue-sidebar-message')).to have_content 'Epics let you manage your portfolio of projects more efficiently'
end
click_epic_link
find('.js-epics-sidebar-callout .js-close-callout').click
it 'should be removed after dismissal' do
visit project_issue_path(project, issue)
wait_for_requests
expect(page).not_to have_selector('.promotion-issue-sidebar-message')
end
it 'should not appear on page after dismissal and reload' do
visit project_issue_path(project, issue)
wait_for_requests
find('.js-epics-sidebar-callout .btn-link').click
find('.js-epics-sidebar-callout .js-close-callout').click
click_epic_link
find('.js-epics-sidebar-callout .js-close-callout').click
visit project_issue_path(project, issue)
expect(page).not_to have_selector('.js-epics-sidebar-callout')
expect(page).not_to have_selector('.promotion-issue-sidebar-message')
end
it 'should close dialog when clicking on X, but not dismiss it' do
visit project_issue_path(project, issue)
wait_for_requests
click_epic_link
find('.js-epics-sidebar-callout .dropdown-menu-close').click
expect(page).to have_selector('.js-epics-sidebar-callout')
expect(page).to have_selector('.promotion-issue-sidebar-message', visible: false)
end
end
it 'should not appear on page after dismissal and reload' do
visit project_issue_path(project, issue)
wait_for_requests
context 'gitlab.com' do
before do
stub_application_setting(check_namespace_plan: true)
allow(Gitlab).to receive(:com?) { true }
find('.js-epics-sidebar-callout .btn-link').click
find('.js-epics-sidebar-callout .js-close-callout').click
visit project_issue_path(project, issue)
project.add_maintainer(user)
sign_in(user)
end
expect(page).not_to have_selector('.js-epics-sidebar-callout')
it_behaves_like 'Epics promotion'
end
it 'should close dialog when clicking on X, but not dismiss it' do
visit project_issue_path(project, issue)
wait_for_requests
context 'self hosted' do
before do
allow(License).to receive(:current).and_return(nil)
stub_application_setting(check_namespace_plan: false)
find('.js-epics-sidebar-callout .btn-link').click
find('.js-epics-sidebar-callout .dropdown-menu-close').click
project.add_maintainer(user)
sign_in(user)
end
expect(page).to have_selector('.js-epics-sidebar-callout')
expect(page).to have_selector('.promotion-issue-sidebar-message', visible: false)
it_behaves_like 'Epics promotion'
end
end
......@@ -439,4 +457,8 @@ describe 'Promotions', :js do
expect(page).not_to have_selector('#promote_advanced_search')
end
end
def click_epic_link
find('.js-epics-sidebar-callout .btn-link').click
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