Commit a2ee24dc authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'move-admin-active-tab-spinach-tests-to-rspec' into 'master'

Move admin active tab spinach tests to RSpec

See merge request !8037
parents 18c58ed3 4bb3c464
---
title: Move admin active tab spinach tests to rspec
merge_request: 8037
author: Semyon Pupkov
@admin
Feature: Admin Active Tab
Background:
Given I sign in as an admin
Scenario: On Admin Home
Given I visit admin page
Then the active main tab should be Overview
And no other main tabs should be active
Scenario: On Admin Projects
Given I visit admin projects page
Then the active main tab should be Overview
And the active sub tab should be Projects
And no other main tabs should be active
And no other sub tabs should be active
Scenario: On Admin Groups
Given I visit admin groups page
Then the active main tab should be Overview
And the active sub tab should be Groups
And no other main tabs should be active
And no other sub tabs should be active
Scenario: On Admin Users
Given I visit admin users page
Then the active main tab should be Overview
And the active sub tab should be Users
And no other main tabs should be active
And no other sub tabs should be active
Scenario: On Admin Logs
Given I visit admin logs page
Then the active main tab should be Monitoring
And the active sub tab should be Logs
And no other main tabs should be active
And no other sub tabs should be active
Scenario: On Admin Messages
Given I visit admin messages page
Then the active main tab should be Messages
And no other main tabs should be active
Scenario: On Admin Hooks
Given I visit admin hooks page
Then the active main tab should be Hooks
And no other main tabs should be active
Scenario: On Admin Resque
Given I visit admin Resque page
Then the active main tab should be Monitoring
And the active sub tab should be Resque
And no other main tabs should be active
And no other sub tabs should be active
class Spinach::Features::AdminActiveTab < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedActiveTab
step 'the active main tab should be Overview' do
ensure_active_main_tab('Overview')
end
step 'the active sub tab should be Projects' do
ensure_active_sub_tab('Projects')
end
step 'the active sub tab should be Groups' do
ensure_active_sub_tab('Groups')
end
step 'the active sub tab should be Users' do
ensure_active_sub_tab('Users')
end
step 'the active main tab should be Hooks' do
ensure_active_main_tab('Hooks')
end
step 'the active main tab should be Monitoring' do
ensure_active_main_tab('Monitoring')
end
step 'the active sub tab should be Resque' do
ensure_active_sub_tab('Background Jobs')
end
step 'the active sub tab should be Logs' do
ensure_active_sub_tab('Logs')
end
step 'the active main tab should be Messages' do
ensure_active_main_tab('Messages')
end
end
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
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