diff --git a/app/views/layouts/_navbar.html.erb b/app/views/layouts/_navbar.html.erb
index c48f8aee..15f3fc71 100644
--- a/app/views/layouts/_navbar.html.erb
+++ b/app/views/layouts/_navbar.html.erb
@@ -17,7 +17,6 @@
Home
-
Help
@@ -28,13 +27,19 @@
<%= current_user.name %>
-
<% else %>
- <%# TODO: Need a test case for this. %>
<%= button_to 'Login', '/auth/canvas', method: :post, class: 'btn btn-primary', id: 'login-button-index' %>
diff --git a/features/navigation.feature b/features/navigation.feature
index d67167af..5ba8f581 100644
--- a/features/navigation.feature
+++ b/features/navigation.feature
@@ -40,3 +40,19 @@ Feature: Navigation
And I should see "Login with bCourses" in the navbar
And I should not see "Offerings" in the navbar
And I should not see "Logout" in the navbar
+
+ Scenario: Admin user sees admin tools in navbar dropdown
+ Given a course exists
+ And I am logged in as an admin
+ And I am on the "Courses page"
+ Then I should see "Admin Tools" in the navbar dropdown
+ And I should see "Dashboards" in the navbar dropdown
+ And I should see "Background Jobs" in the navbar dropdown
+
+ Scenario: Non-admin user does not see admin tools in navbar dropdown
+ Given a course exists
+ And I am logged in as a teacher
+ And I am on the "Courses page"
+ Then I should not see "Admin Tools" in the navbar dropdown
+ And I should not see "Dashboards" in the navbar dropdown
+ And I should not see "Background Jobs" in the navbar dropdown
diff --git a/features/step_definitions/custom_steps.rb b/features/step_definitions/custom_steps.rb
index f05a4c8a..1f6d8089 100644
--- a/features/step_definitions/custom_steps.rb
+++ b/features/step_definitions/custom_steps.rb
@@ -14,11 +14,13 @@
end
end
-Given(/^(?:I am|I'm|I) (?:logged|log) in as a (teacher|ta|student)$/i) do |role|
+Given(/^(?:I am|I'm|I) (?:logged|log) in as an? (teacher|ta|student|admin)$/i) do |role|
emails = {
'teacher' => 'user1@berkeley.edu',
'ta' => 'user2@berkeley.edu',
- 'student' => 'user3@berkeley.edu'
+ 'student' => 'user3@berkeley.edu',
+ # Not part of `a course exists`, so this is created on demand.
+ 'admin' => 'admin@berkeley.edu'
}
email = emails[role.downcase]
user = User.find_by(email: email) || create(role.to_sym, email: email)
diff --git a/features/step_definitions/navigation_steps.rb b/features/step_definitions/navigation_steps.rb
index 4711ac16..10685c40 100644
--- a/features/step_definitions/navigation_steps.rb
+++ b/features/step_definitions/navigation_steps.rb
@@ -14,6 +14,18 @@
end
end
+Then(/^I should see "(.*?)" in the navbar dropdown$/) do |text|
+ within('#user-dropdown-menu') do
+ expect(page).to have_content(text)
+ end
+end
+
+Then(/^I should not see "(.*?)" in the navbar dropdown$/) do |text|
+ within('#user-dropdown-menu') do
+ expect(page).not_to have_content(text)
+ end
+end
+
When(/^I navigate to any page other than the "(.*?)"$/) do |excluded_page|
# Currently included home and courses page
case excluded_page