summaryrefslogtreecommitdiff
path: root/spec/features
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-06-12 19:23:49 +0000
committerRobert Speicher <robert@gitlab.com>2017-06-12 19:23:49 +0000
commit5a66e6d968fb9b1bd1159b9156a88bd06208e363 (patch)
tree99bd4cdca441db24dd538c6811f9d76c12d2de58 /spec/features
parent8d7951d879d13894dcc1fd5d845c8d844bee321a (diff)
parentbe0a949a004a34015977bdbcfe24e3173cd3aba9 (diff)
downloadgitlab-ce-5a66e6d968fb9b1bd1159b9156a88bd06208e363.tar.gz
Merge branch '29010-perf-bar' into 'master'
Add an optional performance bar to view performance metrics for the current page Closes #29010 See merge request !11439
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/user_can_display_performance_bar_spec.rb81
1 files changed, 81 insertions, 0 deletions
diff --git a/spec/features/user_can_display_performance_bar_spec.rb b/spec/features/user_can_display_performance_bar_spec.rb
new file mode 100644
index 00000000000..c2842255b86
--- /dev/null
+++ b/spec/features/user_can_display_performance_bar_spec.rb
@@ -0,0 +1,81 @@
+require 'rails_helper'
+
+describe 'User can display performacne bar', :js do
+ shared_examples 'performance bar is disabled' do
+ it 'does not show the performance bar by default' do
+ expect(page).not_to have_css('#peek')
+ end
+
+ context 'when user press `pb`' do
+ before do
+ find('body').native.send_keys('pb')
+ end
+
+ it 'does not show the performance bar by default' do
+ expect(page).not_to have_css('#peek')
+ end
+ end
+ end
+
+ shared_examples 'performance bar is enabled' do
+ it 'does not show the performance bar by default' do
+ expect(page).not_to have_css('#peek')
+ end
+
+ context 'when user press `pb`' do
+ before do
+ find('body').native.send_keys('pb')
+ end
+
+ it 'does not show the performance bar by default' do
+ expect(page).not_to have_css('#peek')
+ end
+ end
+ end
+
+ context 'when user is logged-out' do
+ before do
+ visit root_path
+ end
+
+ context 'when the gitlab_performance_bar feature is disabled' do
+ before do
+ Feature.disable('gitlab_performance_bar')
+ end
+
+ it_behaves_like 'performance bar is disabled'
+ end
+
+ context 'when the gitlab_performance_bar feature is enabled' do
+ before do
+ Feature.enable('gitlab_performance_bar')
+ end
+
+ it_behaves_like 'performance bar is disabled'
+ end
+ end
+
+ context 'when user is logged-in' do
+ before do
+ login_as :user
+
+ visit root_path
+ end
+
+ context 'when the gitlab_performance_bar feature is disabled' do
+ before do
+ Feature.disable('gitlab_performance_bar')
+ end
+
+ it_behaves_like 'performance bar is disabled'
+ end
+
+ context 'when the gitlab_performance_bar feature is enabled' do
+ before do
+ Feature.enable('gitlab_performance_bar')
+ end
+
+ it_behaves_like 'performance bar is enabled'
+ end
+ end
+end