Merge branch 'move-admin-active-tab-spinach-tests-to-rspec' into 'master'
Move admin active tab spinach tests to RSpec See merge request !8037
This commit is contained in:
commit
a2ee24dc59
4 changed files with 94 additions and 95 deletions
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Move admin active tab spinach tests to rspec
|
||||
merge_request: 8037
|
||||
author: Semyon Pupkov
|
|
@ -1,54 +0,0 @@
|
|||
@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
|
|
@ -1,41 +0,0 @@
|
|||
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
|
90
spec/features/admin/admin_active_tab_spec.rb
Normal file
90
spec/features/admin/admin_active_tab_spec.rb
Normal file
|
@ -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
|
Loading…
Reference in a new issue