diff --git a/features/admin/active_tab.feature b/features/admin/active_tab.feature new file mode 100644 index 00000000000..fce85ce9901 --- /dev/null +++ b/features/admin/active_tab.feature @@ -0,0 +1,33 @@ +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 Home + 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 Projects + And no other main tabs should be active + + Scenario: On Admin Users + Given I visit admin users page + Then the active main tab should be Users + And no other main tabs should be active + + Scenario: On Admin Logs + Given I visit admin logs page + Then the active main tab should be Logs + 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 Resque + And no other main tabs should be active diff --git a/features/dashboard/active_tab.feature b/features/dashboard/active_tab.feature new file mode 100644 index 00000000000..6715ea269c7 --- /dev/null +++ b/features/dashboard/active_tab.feature @@ -0,0 +1,28 @@ +Feature: Dashboard active tab + Background: + Given I sign in as a user + + Scenario: On Dashboard Home + Given I visit dashboard page + Then the active main tab should be Home + And no other main tabs should be active + + Scenario: On Dashboard Issues + Given I visit dashboard issues page + Then the active main tab should be Issues + And no other main tabs should be active + + Scenario: On Dashboard Merge Requests + Given I visit dashboard merge requests page + Then the active main tab should be Merge Requests + And no other main tabs should be active + + Scenario: On Dashboard Search + Given I visit dashboard search page + Then the active main tab should be Search + And no other main tabs should be active + + Scenario: On Dashboard Help + Given I visit dashboard help page + Then the active main tab should be Help + And no other main tabs should be active diff --git a/features/profile/active_tab.feature b/features/profile/active_tab.feature new file mode 100644 index 00000000000..475641a33ed --- /dev/null +++ b/features/profile/active_tab.feature @@ -0,0 +1,28 @@ +Feature: Profile active tab + Background: + Given I sign in as a user + + Scenario: On Profile Home + Given I visit profile page + Then the active main tab should be Home + And no other main tabs should be active + + Scenario: On Profile Account + Given I visit profile account page + Then the active main tab should be Account + And no other main tabs should be active + + Scenario: On Profile SSH Keys + Given I visit profile SSH keys page + Then the active main tab should be SSH Keys + And no other main tabs should be active + + Scenario: On Profile Design + Given I visit profile design page + Then the active main tab should be Design + And no other main tabs should be active + + Scenario: On Profile History + Given I visit profile history page + Then the active main tab should be History + And no other main tabs should be active diff --git a/features/project/active_tab.feature b/features/project/active_tab.feature new file mode 100644 index 00000000000..2d3e41d3d33 --- /dev/null +++ b/features/project/active_tab.feature @@ -0,0 +1,147 @@ +Feature: Project active tab + Background: + Given I sign in as a user + And I own a project + + # Main Tabs + + Scenario: On Project Home + Given I visit my project's home page + Then the active main tab should be Home + And no other main tabs should be active + + Scenario: On Project Files + Given I visit my project's files page + Then the active main tab should be Files + And no other main tabs should be active + + Scenario: On Project Commits + Given I visit my project's commits page + Then the active main tab should be Commits + And no other main tabs should be active + + Scenario: On Project Network + Given I visit my project's network page + Then the active main tab should be Network + And no other main tabs should be active + + Scenario: On Project Issues + Given I visit my project's issues page + Then the active main tab should be Issues + And no other main tabs should be active + + Scenario: On Project Merge Requests + Given I visit my project's merge requests page + Then the active main tab should be Merge Requests + And no other main tabs should be active + + Scenario: On Project Wall + Given I visit my project's wall page + Then the active main tab should be Wall + And no other main tabs should be active + + Scenario: On Project Wiki + Given I visit my project's wiki page + Then the active main tab should be Wiki + And no other main tabs should be active + + # Sub Tabs: Home + + Scenario: On Project Home/Show + Given I visit my project's home page + Then the active sub tab should be Show + And no other sub tabs should be active + And the active main tab should be Home + + Scenario: On Project Home/Team + Given I visit my project's home page + And I click the "Team" tab + Then the active sub tab should be Team + And no other sub tabs should be active + And the active main tab should be Home + + Scenario: On Project Home/Attachments + Given I visit my project's home page + And I click the "Attachments" tab + Then the active sub tab should be Attachments + And no other sub tabs should be active + And the active main tab should be Home + + Scenario: On Project Home/Snippets + Given I visit my project's home page + And I click the "Snippets" tab + Then the active sub tab should be Snippets + And no other sub tabs should be active + And the active main tab should be Home + + Scenario: On Project Home/Edit + Given I visit my project's home page + And I click the "Edit" tab + Then the active sub tab should be Edit + And no other sub tabs should be active + And the active main tab should be Home + + Scenario: On Project Home/Hooks + Given I visit my project's home page + And I click the "Hooks" tab + Then the active sub tab should be Hooks + And no other sub tabs should be active + And the active main tab should be Home + + Scenario: On Project Home/Deploy Keys + Given I visit my project's home page + And I click the "Deploy Keys" tab + Then the active sub tab should be Deploy Keys + And no other sub tabs should be active + And the active main tab should be Home + + # Sub Tabs: Commits + + Scenario: On Project Commits/Commits + Given I visit my project's commits page + Then the active sub tab should be Commits + And no other sub tabs should be active + And the active main tab should be Commits + + Scenario: On Project Commits/Compare + Given I visit my project's commits page + And I click the "Compare" tab + Then the active sub tab should be Compare + And no other sub tabs should be active + And the active main tab should be Commits + + Scenario: On Project Commits/Branches + Given I visit my project's commits page + And I click the "Branches" tab + Then the active sub tab should be Branches + And no other sub tabs should be active + And the active main tab should be Commits + + Scenario: On Project Commits/Tags + Given I visit my project's commits page + And I click the "Tags" tab + Then the active sub tab should be Tags + And no other sub tabs should be active + And the active main tab should be Commits + + # Sub Tabs: Issues + + Scenario: On Project Issues/Browse + Given I visit my project's issues page + Then the active sub tab should be Browse Issues + And no other sub tabs should be active + And the active main tab should be Issues + + Scenario: On Project Issues/Milestones + Given I visit my project's issues page + And I click the "Milestones" tab + Then the active sub tab should be Milestones + And no other sub tabs should be active + And the active main tab should be Issues + + Scenario: On Project Issues/Labels + Given I visit my project's issues page + And I click the "Labels" tab + Then the active sub tab should be Labels + And no other sub tabs should be active + And the active main tab should be Issues diff --git a/features/steps/admin/admin_active_tab.rb b/features/steps/admin/admin_active_tab.rb new file mode 100644 index 00000000000..29290892823 --- /dev/null +++ b/features/steps/admin/admin_active_tab.rb @@ -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 diff --git a/features/steps/dashboard/dashboard_active_tab.rb b/features/steps/dashboard/dashboard_active_tab.rb new file mode 100644 index 00000000000..41ecc48c0d3 --- /dev/null +++ b/features/steps/dashboard/dashboard_active_tab.rb @@ -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 diff --git a/features/steps/profile/profile_active_tab.rb b/features/steps/profile/profile_active_tab.rb new file mode 100644 index 00000000000..1924a6fa785 --- /dev/null +++ b/features/steps/profile/profile_active_tab.rb @@ -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 diff --git a/features/steps/project/project_active_tab.rb b/features/steps/project/project_active_tab.rb new file mode 100644 index 00000000000..a5c80353862 --- /dev/null +++ b/features/steps/project/project_active_tab.rb @@ -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 diff --git a/features/steps/shared/active_tab.rb b/features/steps/shared/active_tab.rb new file mode 100644 index 00000000000..33ac5cf5050 --- /dev/null +++ b/features/steps/shared/active_tab.rb @@ -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 diff --git a/features/steps/shared/authentication.rb b/features/steps/shared/authentication.rb index 77d9839f5b7..2add91617fe 100644 --- a/features/steps/shared/authentication.rb +++ b/features/steps/shared/authentication.rb @@ -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 diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index fc23a798c59..bb35b8b0f8a 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -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