diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-05-16 12:36:27 -0500 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-05-16 12:36:27 -0500 |
commit | 79b9ff60768644287daace5a8f640d1790816353 (patch) | |
tree | e4976e2feef97c848fc75521276c14e144409124 | |
parent | 7365ac60f116d0e0a89a3bd8ebcf558b477c4bc3 (diff) | |
download | gitlab-ce-79b9ff60768644287daace5a8f640d1790816353.tar.gz |
Modify tests to match new navigation behaviour for project pages
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r-- | features/project/active_tab.feature | 18 | ||||
-rw-r--r-- | features/project/project.feature | 9 | ||||
-rw-r--r-- | features/steps/admin/active_tab.rb | 10 | ||||
-rw-r--r-- | features/steps/dashboard/active_tab.rb | 6 | ||||
-rw-r--r-- | features/steps/dashboard/shortcuts.rb | 2 | ||||
-rw-r--r-- | features/steps/profile/active_tab.rb | 4 | ||||
-rw-r--r-- | features/steps/project/active_tab.rb | 28 | ||||
-rw-r--r-- | features/steps/project/fork.rb | 2 | ||||
-rw-r--r-- | features/steps/project/project.rb | 12 | ||||
-rw-r--r-- | features/steps/project/project_milestone.rb | 2 | ||||
-rw-r--r-- | features/steps/shared/active_tab.rb | 28 | ||||
-rw-r--r-- | features/steps/shared/issuable.rb | 8 | ||||
-rw-r--r-- | features/steps/shared/project_tab.rb | 4 | ||||
-rw-r--r-- | features/steps/shared/sidebar_active_tab.rb | 35 |
14 files changed, 82 insertions, 86 deletions
diff --git a/features/project/active_tab.feature b/features/project/active_tab.feature index 2fd097d100b..5125a3e5773 100644 --- a/features/project/active_tab.feature +++ b/features/project/active_tab.feature @@ -30,11 +30,6 @@ Feature: Project Active Tab Then the active main tab should be Merge Requests And no other main tabs should be active - Scenario: On Project Members - Given I visit my project's members page - Then the active main tab should be Members - 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 @@ -49,13 +44,6 @@ Feature: Project Active Tab # Sub Tabs: Settings - Scenario: On Project Settings/Edit - Given I visit my project's settings page - And I click the "Edit" tab - Then the active sub nav should be Edit - And no other sub navs should be active - And the active main tab should be Settings - Scenario: On Project Settings/Hooks Given I visit my project's settings page And I click the "Hooks" tab @@ -70,6 +58,12 @@ Feature: Project Active Tab And no other sub navs should be active And the active main tab should be Settings + Scenario: On Project Members + Given I visit my project's members page + Then the active sub nav should be Members + And no other sub navs should be active + And the active main tab should be Settings + # Sub Tabs: Commits Scenario: On Project Commits/Commits diff --git a/features/project/project.feature b/features/project/project.feature index f1f3ed26065..aa22401c88e 100644 --- a/features/project/project.feature +++ b/features/project/project.feature @@ -18,15 +18,6 @@ Feature: Project Then I should see the default project avatar And I should not see the "Remove avatar" button - Scenario: I should have back to group button - And project "Shop" belongs to group - And I visit project "Shop" page - Then I should see back to group button - - Scenario: I should have back to group button - And I visit project "Shop" page - Then I should see back to dashboard button - Scenario: I should have readme on page And I visit project "Shop" page Then I should see project "Shop" README diff --git a/features/steps/admin/active_tab.rb b/features/steps/admin/active_tab.rb index 90d13abdb13..f2db1801389 100644 --- a/features/steps/admin/active_tab.rb +++ b/features/steps/admin/active_tab.rb @@ -1,7 +1,7 @@ class Spinach::Features::AdminActiveTab < Spinach::FeatureSteps include SharedAuthentication include SharedPaths - include SharedActiveTab + include SharedSidebarActiveTab step 'the active main tab should be Home' do ensure_active_main_tab('Overview') @@ -34,4 +34,12 @@ class Spinach::Features::AdminActiveTab < Spinach::FeatureSteps step 'the active main tab should be Messages' do ensure_active_main_tab('Messages') end + + step 'no other main tabs should be active' do + expect(page).to have_selector('.nav-sidebar > li.active', count: 1) + end + + def ensure_active_main_tab(content) + expect(find('.nav-sidebar > li.active')).to have_content(content) + end end diff --git a/features/steps/dashboard/active_tab.rb b/features/steps/dashboard/active_tab.rb index 0e2c04fb299..04fe96cef22 100644 --- a/features/steps/dashboard/active_tab.rb +++ b/features/steps/dashboard/active_tab.rb @@ -1,9 +1,5 @@ class Spinach::Features::DashboardActiveTab < Spinach::FeatureSteps include SharedAuthentication include SharedPaths - include SharedActiveTab - - step 'the active main tab should be Help' do - ensure_active_main_tab('Help') - end + include SharedSidebarActiveTab end diff --git a/features/steps/dashboard/shortcuts.rb b/features/steps/dashboard/shortcuts.rb index a9083850b52..512dc5f18d9 100644 --- a/features/steps/dashboard/shortcuts.rb +++ b/features/steps/dashboard/shortcuts.rb @@ -2,5 +2,5 @@ class Spinach::Features::DashboardShortcuts < Spinach::FeatureSteps include SharedAuthentication include SharedPaths include SharedProject - include SharedActiveTab + include SharedSidebarActiveTab end diff --git a/features/steps/profile/active_tab.rb b/features/steps/profile/active_tab.rb index 3b59089a093..4724a326277 100644 --- a/features/steps/profile/active_tab.rb +++ b/features/steps/profile/active_tab.rb @@ -22,8 +22,4 @@ class Spinach::Features::ProfileActiveTab < Spinach::FeatureSteps step 'the active main tab should be Audit Log' do ensure_active_main_tab('Audit Log') end - - def ensure_active_main_tab(content) - expect(find('.layout-nav li.active')).to have_content(content) - end end diff --git a/features/steps/project/active_tab.rb b/features/steps/project/active_tab.rb index 19d81453d8c..4a5a71e7e61 100644 --- a/features/steps/project/active_tab.rb +++ b/features/steps/project/active_tab.rb @@ -16,12 +16,14 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps end step 'I click the "Snippets" tab' do - click_link('Snippets') + page.within('.layout-nav') do + click_link('Snippets') + end end - step 'I click the "Edit" tab' do - page.within '.sidebar-subnav' do - click_link('Project Settings') + step 'I click the "Edit Project"' do + page.within '.layout-nav .controls' do + click_link('Edit Project') end end @@ -33,14 +35,10 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps click_link('Deploy Keys') end - step 'the active sub nav should be Team' do + step 'the active sub nav should be Members' do ensure_active_sub_nav('Members') end - step 'the active sub nav should be Edit' do - ensure_active_sub_nav('Project') - end - step 'the active sub nav should be Hooks' do ensure_active_sub_nav('Webhooks') end @@ -56,7 +54,9 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps end step 'I click the "Branches" tab' do - click_link('Branches') + page.within '.content' do + click_link('Branches') + end end step 'I click the "Tags" tab' do @@ -82,11 +82,15 @@ class Spinach::Features::ProjectActiveTab < Spinach::FeatureSteps # Sub Tabs: Issues step 'I click the "Milestones" tab' do - click_link('Milestones') + page.within('.layout-nav') do + click_link('Milestones') + end end step 'I click the "Labels" tab' do - click_link('Labels') + page.within('.layout-nav') do + click_link('Labels') + end end step 'the active sub tab should be Issues' do diff --git a/features/steps/project/fork.rb b/features/steps/project/fork.rb index 527f7853da9..8abeb5ee242 100644 --- a/features/steps/project/fork.rb +++ b/features/steps/project/fork.rb @@ -36,7 +36,7 @@ class Spinach::Features::ProjectFork < Spinach::FeatureSteps end step 'I goto the Merge Requests page' do - page.within '.page-sidebar-expanded' do + page.within '.layout-nav' do click_link "Merge Requests" end end diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb index ef185861e00..a1785311c2b 100644 --- a/features/steps/project/project.rb +++ b/features/steps/project/project.rb @@ -114,7 +114,9 @@ class Spinach::Features::Project < Spinach::FeatureSteps end step 'I should not see "Snippets" button' do - expect(page).not_to have_link 'Snippets' + page.within '.content' do + expect(page).not_to have_link 'Snippets' + end end step 'project "Shop" belongs to group' do @@ -123,14 +125,6 @@ class Spinach::Features::Project < Spinach::FeatureSteps @project.save! end - step 'I should see back to dashboard button' do - expect(page).to have_content 'Go to dashboard' - end - - step 'I should see back to group button' do - expect(page).to have_content 'Go to group' - end - step 'I click notifications drop down button' do click_link 'notifications-button' end diff --git a/features/steps/project/project_milestone.rb b/features/steps/project/project_milestone.rb index 2508c09e36d..1864b3a2b52 100644 --- a/features/steps/project/project_milestone.rb +++ b/features/steps/project/project_milestone.rb @@ -52,7 +52,7 @@ class Spinach::Features::ProjectMilestone < Spinach::FeatureSteps end step 'I click link "Labels"' do - page.within('.nav-links') do + page.within('.layout-nav .nav-links') do page.find(:xpath, "//a[@href='#tab-labels']").click end end diff --git a/features/steps/shared/active_tab.rb b/features/steps/shared/active_tab.rb index 0bee91d758d..ace717b9909 100644 --- a/features/steps/shared/active_tab.rb +++ b/features/steps/shared/active_tab.rb @@ -2,7 +2,7 @@ module SharedActiveTab include Spinach::DSL def ensure_active_main_tab(content) - expect(find('.nav-sidebar > li.active')).to have_content(content) + expect(find('.layout-nav li.active')).to have_content(content) end def ensure_active_sub_tab(content) @@ -10,11 +10,11 @@ module SharedActiveTab end def ensure_active_sub_nav(content) - expect(find('.sidebar-subnav > li.active')).to have_content(content) + expect(find('.layout-nav .controls li.active')).to have_content(content) end step 'no other main tabs should be active' do - expect(page).to have_selector('.nav-sidebar > li.active', count: 1) + expect(page).to have_selector('.layout-nav .nav-links > li.active', count: 1) end step 'no other sub tabs should be active' do @@ -22,26 +22,6 @@ module SharedActiveTab end step 'no other sub navs should be active' do - expect(page).to have_selector('.sidebar-subnav > li.active', count: 1) - end - - step 'the active main tab should be Home' do - ensure_active_main_tab('Projects') - end - - step 'the active main tab should be Projects' do - ensure_active_main_tab('Projects') - end - - step 'the active main tab should be Issues' do - ensure_active_main_tab('Issues') - end - - step 'the active main tab should be Merge Requests' do - ensure_active_main_tab('Merge Requests') - end - - step 'the active main tab should be Help' do - ensure_active_main_tab('Help') + expect(page).to have_selector('.layout-nav .controls li.active', count: 1) end end diff --git a/features/steps/shared/issuable.rb b/features/steps/shared/issuable.rb index a58b3cb7e16..733e80b7279 100644 --- a/features/steps/shared/issuable.rb +++ b/features/steps/shared/issuable.rb @@ -111,7 +111,7 @@ module SharedIssuable step 'I sort the list by "Oldest updated"' do find('button.dropdown-toggle.btn').click - page.within('ul.dropdown-menu.dropdown-menu-align-right li') do + page.within('.content ul.dropdown-menu.dropdown-menu-align-right li') do click_link "Oldest updated" end end @@ -119,7 +119,7 @@ module SharedIssuable step 'I sort the list by "Least popular"' do find('button.dropdown-toggle.btn').click - page.within('ul.dropdown-menu.dropdown-menu-align-right li') do + page.within('.content ul.dropdown-menu.dropdown-menu-align-right li') do click_link 'Least popular' end end @@ -127,13 +127,13 @@ module SharedIssuable step 'I sort the list by "Most popular"' do find('button.dropdown-toggle.btn').click - page.within('ul.dropdown-menu.dropdown-menu-align-right li') do + page.within('.content ul.dropdown-menu.dropdown-menu-align-right li') do click_link 'Most popular' end end step 'The list should be sorted by "Oldest updated"' do - page.within('div.dropdown.inline.prepend-left-10') do + page.within('.content div.dropdown.inline.prepend-left-10') do expect(page.find('button.dropdown-toggle.btn')).to have_content('Oldest updated') end end diff --git a/features/steps/shared/project_tab.rb b/features/steps/shared/project_tab.rb index 4fc2ece79ff..b209020c5a9 100644 --- a/features/steps/shared/project_tab.rb +++ b/features/steps/shared/project_tab.rb @@ -41,9 +41,7 @@ module SharedProjectTab end step 'the active main tab should be Settings' do - page.within '.nav-sidebar' do - expect(page).to have_content('Go to project') - end + expect(page).to have_selector('.layout-nav .nav-links > li.active', count: 0) end step 'the active main tab should be Activity' do diff --git a/features/steps/shared/sidebar_active_tab.rb b/features/steps/shared/sidebar_active_tab.rb new file mode 100644 index 00000000000..5c47238777f --- /dev/null +++ b/features/steps/shared/sidebar_active_tab.rb @@ -0,0 +1,35 @@ +module SharedSidebarActiveTab + include Spinach::DSL + + step 'the active main tab should be Help' do + ensure_active_main_tab('Help') + end + + step 'no other main tabs should be active' do + expect(page).to have_selector('.nav-sidebar > li.active', count: 1) + end + + def ensure_active_main_tab(content) + expect(find('.nav-sidebar li.active')).to have_content(content) + end + + step 'the active main tab should be Home' do + ensure_active_main_tab('Projects') + end + + step 'the active main tab should be Projects' do + ensure_active_main_tab('Projects') + end + + step 'the active main tab should be Issues' do + ensure_active_main_tab('Issues') + end + + step 'the active main tab should be Merge Requests' do + ensure_active_main_tab('Merge Requests') + end + + step 'the active main tab should be Help' do + ensure_active_main_tab('Help') + end +end |