summaryrefslogtreecommitdiff
path: root/spec/features/admin/admin_active_tab_spec.rb
diff options
context:
space:
mode:
authorSemyon Pupkov <mail@semyonpupkov.com>2016-12-12 14:57:46 +0500
committerSemyon Pupkov <mail@semyonpupkov.com>2016-12-12 15:01:44 +0500
commit4bb3c4644734a8f23bcfbe97018431f3a2bafedb (patch)
tree8c86e565e92b8610e17f96b75fd673d1595912c5 /spec/features/admin/admin_active_tab_spec.rb
parent221a461c1e917e816e30c213d48ad0ff87170527 (diff)
downloadgitlab-ce-4bb3c4644734a8f23bcfbe97018431f3a2bafedb.tar.gz
Move admin active tab spinach tests to rspec
https://gitlab.com/gitlab-org/gitlab-ce/issues/23036
Diffstat (limited to 'spec/features/admin/admin_active_tab_spec.rb')
-rw-r--r--spec/features/admin/admin_active_tab_spec.rb90
1 files changed, 90 insertions, 0 deletions
diff --git a/spec/features/admin/admin_active_tab_spec.rb b/spec/features/admin/admin_active_tab_spec.rb
new file mode 100644
index 00000000000..f2eecc5b552
--- /dev/null
+++ b/spec/features/admin/admin_active_tab_spec.rb
@@ -0,0 +1,90 @@
+require 'spec_helper'
+
+RSpec.describe 'admin active tab' do
+ before do
+ login_as :admin
+ end
+
+ shared_examples 'page has active tab' do |title|
+ it "activates #{title} tab" do
+ expect(page).to have_selector('.layout-nav .nav-links > li.active', count: 1)
+ expect(page.find('.layout-nav li.active')).to have_content(title)
+ end
+ end
+
+ shared_examples 'page has active sub tab' do |title|
+ it "activates #{title} sub tab" do
+ expect(page).to have_selector('.sub-nav li.active', count: 1)
+ expect(page.find('.sub-nav li.active')).to have_content(title)
+ end
+ end
+
+ context 'on home page' do
+ before do
+ visit admin_root_path
+ end
+
+ it_behaves_like 'page has active tab', 'Overview'
+ end
+
+ context 'on projects' do
+ before do
+ visit admin_namespaces_projects_path
+ end
+
+ it_behaves_like 'page has active tab', 'Overview'
+ it_behaves_like 'page has active sub tab', 'Projects'
+ end
+
+ context 'on groups' do
+ before do
+ visit admin_groups_path
+ end
+
+ it_behaves_like 'page has active tab', 'Overview'
+ it_behaves_like 'page has active sub tab', 'Groups'
+ end
+
+ context 'on users' do
+ before do
+ visit admin_users_path
+ end
+
+ it_behaves_like 'page has active tab', 'Overview'
+ it_behaves_like 'page has active sub tab', 'Users'
+ end
+
+ context 'on logs' do
+ before do
+ visit admin_logs_path
+ end
+
+ it_behaves_like 'page has active tab', 'Monitoring'
+ it_behaves_like 'page has active sub tab', 'Logs'
+ end
+
+ context 'on messages' do
+ before do
+ visit admin_broadcast_messages_path
+ end
+
+ it_behaves_like 'page has active tab', 'Messages'
+ end
+
+ context 'on hooks' do
+ before do
+ visit admin_hooks_path
+ end
+
+ it_behaves_like 'page has active tab', 'Hooks'
+ end
+
+ context 'on background jobs' do
+ before do
+ visit admin_background_jobs_path
+ end
+
+ it_behaves_like 'page has active tab', 'Monitoring'
+ it_behaves_like 'page has active sub tab', 'Background Jobs'
+ end
+end