Feature: see all of the user
  As an logged in administrator
  I want see or find all of the users
  
Background:
  Given I am logged in as an administrator
	Given I have the following users
    | full_name | login   | email            |
    | A One     | a_one   | a_one@test.com   |
    | B Two     | b_two   | b_two@test.com   |
    | C Three   | c_three | c_three@test.com |

Scenario: List all of the users
  When I am on the admin users page
	Then I should see the view "admin/users/index"
	Then I should see the breadcrumb "Home Page" link to the root page
	Then I should see the breadcrumb "List Users" link to the admin users page
	Then I should see the breadcrumb "+ Create New User" link to the new admin user page
  Then I should see the "Search" button
	Then should see "a_one@test.com" within "table.data"
	Then should see "b_two@test.com" within "table.data"
	Then should see "c_three@test.com" within "table.data"

Scenario: Search by Name
  Given I am on the admin users page
	Given I fill in "query" with "B"
	Given I select "Search Name" from "query_type"
	When I press "Search"
	Then I should see the view "admin/users/index"
	Then the "query" field should be "B"
	Then the "query_type" select field should be "Search Name"	
	Then should not see "a_one@test.com" within "table.data"
	Then should see "b_two@test.com" within "table.data"
	Then should see "c_three@test.com" within "table.data"
	
Scenario: Search by Login
  Given I am on the admin users page
	Given I fill in "query" with "b"
	Given I select "Search Login" from "query_type"
	When I press "Search"
	Then I should see the view "admin/users/index"
	Then the "query" field should be "b"
	Then the "query_type" select field should be "Search Login"
	Then should not see "a_one@test.com" within "table.data"
	Then should see "b_two@test.com" within "table.data"
	Then should see "c_three@test.com" within "table.data"

Scenario: Search by Email
  Given I am on the admin users page
	Given I fill in "query" with "b"
	Given I select "Search Email" from "query_type"
	When I press "Search"
	Then I should see the view "admin/users/index"
	Then the "query" field should be "b"
	Then the "query_type" select field should be "Search Email"
	Then should not see "a_one@test.com" within "table.data"
	Then should see "b_two@test.com" within "table.data"
	Then should see "c_three@test.com" within "table.data"

Scenario: See the user details
  Given there are no "users"
	Given I am logged in as an administrator
  Given there is a "user"
  When I am on the admin users page
	Then I should see the "user" "login" value
	Then I should see the "user" "full_name" value
	Then I should see the "user" "email" value
	Then I should see the "user" "time_zone" value
	# Then I should see the "user" "access_level" value
	Then I should see "Account Disabled" 

Scenario: Link to the user details
  Given there is a "user"
  When I am on the admin users page
	Then I should see the user login name link to the user page 
	Then I should see the user full name link to the user page