diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 15:44:42 +0000 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /spec/features/user_can_display_performance_bar_spec.rb | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) | |
download | gitlab-ce-4555e1b21c365ed8303ffb7a3325d773c9b8bf31.tar.gz |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
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 |