Add features for checking the "Active Tab" across various pages

This commit is contained in:
Robert Speicher 2012-09-25 20:11:57 -04:00
parent f814da38bf
commit cada511f8b
11 changed files with 537 additions and 9 deletions

View file

@ -0,0 +1,29 @@
class AdminActiveTab < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedActiveTab
Then 'the active main tab should be Home' do
ensure_active_main_tab('Stats')
end
Then 'the active main tab should be Projects' do
ensure_active_main_tab('Projects')
end
Then 'the active main tab should be Users' do
ensure_active_main_tab('Users')
end
Then 'the active main tab should be Logs' do
ensure_active_main_tab('Logs')
end
Then 'the active main tab should be Hooks' do
ensure_active_main_tab('Hooks')
end
Then 'the active main tab should be Resque' do
ensure_active_main_tab('Resque')
end
end

View file

@ -0,0 +1,25 @@
class DashboardActiveTab < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedActiveTab
Then 'the active main tab should be Home' do
ensure_active_main_tab('Home')
end
Then 'the active main tab should be Issues' do
ensure_active_main_tab('Issues')
end
Then 'the active main tab should be Merge Requests' do
ensure_active_main_tab('Merge Requests')
end
Then 'the active main tab should be Search' do
ensure_active_main_tab('Search')
end
Then 'the active main tab should be Help' do
ensure_active_main_tab('Help')
end
end

View file

@ -0,0 +1,25 @@
class ProfileActiveTab < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedActiveTab
Then 'the active main tab should be Home' do
ensure_active_main_tab('Profile')
end
Then 'the active main tab should be Account' do
ensure_active_main_tab('Account')
end
Then 'the active main tab should be SSH Keys' do
ensure_active_main_tab('SSH Keys')
end
Then 'the active main tab should be Design' do
ensure_active_main_tab('Design')
end
Then 'the active main tab should be History' do
ensure_active_main_tab('History')
end
end

View file

@ -0,0 +1,146 @@
class ProjectActiveTab < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedProject
include SharedActiveTab
# Main Tabs
Then 'the active main tab should be Home' do
ensure_active_main_tab(@project.name)
end
Then 'the active main tab should be Files' do
ensure_active_main_tab('Files')
end
Then 'the active main tab should be Commits' do
ensure_active_main_tab('Commits')
end
Then 'the active main tab should be Network' do
ensure_active_main_tab('Network')
end
Then 'the active main tab should be Issues' do
ensure_active_main_tab('Issues')
end
Then 'the active main tab should be Merge Requests' do
ensure_active_main_tab('Merge Requests')
end
Then 'the active main tab should be Wall' do
ensure_active_main_tab('Wall')
end
Then 'the active main tab should be Wiki' do
ensure_active_main_tab('Wiki')
end
# Sub Tabs: Home
Given 'I click the "Team" tab' do
click_link('Team')
end
Given 'I click the "Attachments" tab' do
click_link('Attachments')
end
Given 'I click the "Snippets" tab' do
click_link('Snippets')
end
Given 'I click the "Edit" tab' do
click_link('Edit')
end
Given 'I click the "Hooks" tab' do
click_link('Hooks')
end
Given 'I click the "Deploy Keys" tab' do
click_link('Deploy Keys')
end
Then 'the active sub tab should be Show' do
ensure_active_sub_tab('Show')
end
Then 'the active sub tab should be Team' do
ensure_active_sub_tab('Team')
end
Then 'the active sub tab should be Attachments' do
ensure_active_sub_tab('Attachments')
end
Then 'the active sub tab should be Snippets' do
ensure_active_sub_tab('Snippets')
end
Then 'the active sub tab should be Edit' do
ensure_active_sub_tab('Edit')
end
Then 'the active sub tab should be Hooks' do
ensure_active_sub_tab('Hooks')
end
Then 'the active sub tab should be Deploy Keys' do
ensure_active_sub_tab('Deploy Keys')
end
# Sub Tabs: Commits
Given 'I click the "Compare" tab' do
click_link('Compare')
end
Given 'I click the "Branches" tab' do
click_link('Branches')
end
Given 'I click the "Tags" tab' do
click_link('Tags')
end
Then 'the active sub tab should be Commits' do
ensure_active_sub_tab('Commits')
end
Then 'the active sub tab should be Compare' do
ensure_active_sub_tab('Compare')
end
Then 'the active sub tab should be Branches' do
ensure_active_sub_tab('Branches')
end
Then 'the active sub tab should be Tags' do
ensure_active_sub_tab('Tags')
end
# Sub Tabs: Issues
Given 'I click the "Milestones" tab' do
click_link('Milestones')
end
Given 'I click the "Labels" tab' do
click_link('Labels')
end
Then 'the active sub tab should be Browse Issues' do
ensure_active_sub_tab('Browse Issues')
end
Then 'the active sub tab should be Milestones' do
ensure_active_sub_tab('Milestones')
end
Then 'the active sub tab should be Labels' do
ensure_active_sub_tab('Labels')
end
end

View file

@ -0,0 +1,11 @@
module SharedActiveTab
include Spinach::DSL
def ensure_active_main_tab(content)
page.find('ul.main_menu li.current').should have_content(content)
end
And 'no other main tabs should be active' do
page.should have_selector('ul.main_menu li.current', count: 1)
end
end

View file

@ -7,4 +7,8 @@ module SharedAuthentication
Given 'I sign in as a user' do
login_as :user
end
Given 'I sign in as an admin' do
login_as :admin
end
end

View file

@ -1,22 +1,34 @@
module SharedPaths
include Spinach::DSL
And 'I visit dashboard search page' do
visit search_path
# ----------------------------------------
# Dashboard
# ----------------------------------------
Given 'I visit dashboard page' do
visit dashboard_path
end
And 'I visit dashboard merge requests page' do
visit dashboard_merge_requests_path
end
And 'I visit dashboard issues page' do
Given 'I visit dashboard issues page' do
visit dashboard_issues_path
end
When 'I visit dashboard page' do
visit dashboard_path
Given 'I visit dashboard merge requests page' do
visit dashboard_merge_requests_path
end
Given 'I visit dashboard search page' do
visit search_path
end
Given 'I visit dashboard help page' do
visit help_path
end
# ----------------------------------------
# Profile
# ----------------------------------------
Given 'I visit profile page' do
visit profile_path
end
@ -25,10 +37,50 @@ module SharedPaths
visit profile_account_path
end
Given 'I visit profile SSH keys page' do
visit keys_path
end
Given 'I visit profile design page' do
visit profile_design_path
end
Given 'I visit profile history page' do
visit profile_history_path
end
Given 'I visit profile token page' do
visit profile_token_path
end
# ----------------------------------------
# Admin
# ----------------------------------------
Given 'I visit admin page' do
visit admin_root_path
end
Given 'I visit admin projects page' do
visit admin_projects_path
end
Given 'I visit admin users page' do
visit admin_users_path
end
Given 'I visit admin logs page' do
visit admin_logs_path
end
Given 'I visit admin hooks page' do
visit admin_hooks_path
end
Given 'I visit admin Resque page' do
visit admin_resque_path
end
When 'I visit new project page' do
visit new_project_path
end