diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-29 18:10:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-29 18:10:07 +0300 |
commit | c5e4f06c597e7ef9b584595a55a82cb221804e4b (patch) | |
tree | 2db854553738bf601a40d427dbb9eaf5516be027 /spec/features/user_can_display_performance_bar_spec.rb | |
parent | db36dea03b0e56ed242eb290c51be88ca4c61a65 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/user_can_display_performance_bar_spec.rb')
-rw-r--r-- | spec/features/user_can_display_performance_bar_spec.rb | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/spec/features/user_can_display_performance_bar_spec.rb b/spec/features/user_can_display_performance_bar_spec.rb index b8f41925156..14b5964686f 100644 --- a/spec/features/user_can_display_performance_bar_spec.rb +++ b/spec/features/user_can_display_performance_bar_spec.rb @@ -47,7 +47,7 @@ RSpec.describe 'User can display performance bar', :js do end end - let(:group) { create(:group) } + let_it_be(:group) { create(:group) } before do allow(GitlabPerformanceBarStatsWorker).to receive(:perform_in) @@ -123,4 +123,38 @@ RSpec.describe 'User can display performance bar', :js do end end end + + context 'flamegraphs' do + let_it_be(:user) { create(:user) } + + before_all do + group.add_guest(user) + end + + context 'when user has access' do + before do + stub_application_setting(performance_bar_allowed_group_id: group.id) + + Warden.on_next_request do |proxy| + proxy.set_user(user) + end + end + + it 'renders flamegraph when requested' do + visit root_path(performance_bar: 'flamegraph') + + page.within_frame 'speedscope-iframe' do + expect(page).to have_content('Flamegraph for /') + end + end + end + + context 'when user does not have access' do + it 'renders the original page' do + visit root_path(performance_bar: 'flamegraph') + + expect(page).not_to have_selector('iframe#speedscope-iframe') + end + end + end end |