<commit_before>Feature: Sign in
  As an existing User
  So that I can add charities to the list and make a page for my own charity
  I want to be able to login
  Tracker story ID: https://www.pivotaltracker.com/story/show/47373809

Background:
  Given the following organizations exist:
    | name           | description               | address        | postcode | telephone |
    | Friendly       | Bereavement Counselling   | 34 pinner road | HA1 4HZ  | 020800000 |

  Given the following users are registered:
    | email                     | password | admin | organization | confirmed_at         |
    | <EMAIL>   | <PASSWORD> |       |              | 2007-01-01  10:00:00 |
    | <EMAIL>    | pppppppp | true  |              | 2007-01-01  10:00:00 |
    | <EMAIL> | pppppppp | false | Friendly     | 2007-01-01  10:00:00 |
  Given I am on the home page
  And cookies are approved

Scenario: Sign in for an existing non-admin user unassociated with any organization
  Given I sign in as "<EMAIL>" with password "<PASSWORD>"
  Then I should see a link or button "<EMAIL>"

Scenario: Sign in with wrong password for an existing non-admin user unassociated with any organization
  Given I sign in as "<EMAIL>" with password "<PASSWORD>"
  Then I should be on the Sign in page
  And I should see "I'm sorry, you are not authorized to login to the system."

Scenario: Sign in for an existing non-admin user associated with an organization
  Given I sign in as "<EMAIL>" with password "<PASSWORD>"
  Then I should be on the charity page for "Friendly"
  And I should see a link or button "<EMAIL>"

Scenario: Sign in with wrong password for an existing non-admin user associated with an organization
  Given I sign in as "<EMAIL>" with password "<PASSWORD>"
  Then I should be on the Sign in page
  And I should see "I'm sorry, you are not authorized to login to the system."

Scenario: Sign in for an existing admin user
  Given I sign in as "<EMAIL>" with password "<PASSWORD>"
  Then I should be on the home page
  And I should see a link or button "<EMAIL>"

Scenario: Sign in with wrong password for an existing admin user
  Given I sign in as "<EMAIL>" with password "<PASSWORD>"
  Then I should be on the Sign in page
  And I should see "I'm sorry, you are not authorized to login to the system."

Scenario: Sign in for a non-existent user
  Given I sign in as "<EMAIL>" with password "<PASSWORD>"
  Then I should be on the sign in page
  And I should see "I'm sorry, you are not authorized to login to the system"

@javascript
Scenario: Check that login/register toggle works
  # when first opened
  Given I click "Login"
  Then the "loginForm" should be visible
  And the "registerForm" should be not visible
  And I should see "New organisation? Sign-up.."
  # click one way
  Given I click "toggle_link"
  Then the "loginForm" should be not visible
  And the "registerForm" should be visible
  And I should see "Already a member? Login"
  # then click back the other way
  Given I click "toggle_link"
  Then the "loginForm" should be visible
  And the "registerForm" should be not visible
  And I should see "New organisation? Sign-up.."

Scenario: Check class of flash notice  - error
  Given I sign in as "<EMAIL>" with password "<PASSWORD>"
  Then I should be on the Sign in page
  And the "flash_alert" should be "alert-error"


Scenario: Check class of flash notice  - success
  Given I sign in as "<EMAIL>" with password "<PASSWORD>"
  Then I should be on the Sign in page
  And the "flash_notice" should be "alert-success"<commit_msg>Fixed errant scenario step for sign in feature; fixed other step misspelling errors for sign in page<commit_after>Feature: Sign in
  As an existing User
  So that I can add charities to the list and make a page for my own charity
  I want to be able to login
  Tracker story ID: https://www.pivotaltracker.com/story/show/47373809

Background:
  Given the following organizations exist:
    | name           | description               | address        | postcode | telephone |
    | Friendly       | Bereavement Counselling   | 34 pinner road | HA1 4HZ  | 020800000 |

  Given the following users are registered:
    | email                     | password | admin | organization | confirmed_at         |
    | <EMAIL>   | pppppppp |       |              | 2007-01-01  10:00:00 |
    | <EMAIL>    | pppppppp | true  |              | 2007-01-01  10:00:00 |
    | <EMAIL> | pppppppp | false | Friendly     | 2007-01-01  10:00:00 |
  Given I am on the home page
  And cookies are approved

Scenario: Sign in for an existing non-admin user unassociated with any organization
  Given I sign in as "<EMAIL>" with password "<PASSWORD>"
  Then I should see a link or button "<EMAIL>"

Scenario: Sign in with wrong password for an existing non-admin user unassociated with any organization
  Given I sign in as "<EMAIL>" with password "<PASSWORD>"
  Then I should be on the sign in page
  And I should see "I'm sorry, you are not authorized to login to the system."

Scenario: Sign in for an existing non-admin user associated with an organization
  Given I sign in as "<EMAIL>" with password "<PASSWORD>"
  Then I should be on the charity page for "Friendly"
  And I should see a link or button "<EMAIL>"

Scenario: Sign in with wrong password for an existing non-admin user associated with an organization
  Given I sign in as "<EMAIL>" with password "<PASSWORD>"
  Then I should be on the sign in page
  And I should see "I'm sorry, you are not authorized to login to the system."

Scenario: Sign in for an existing admin user
  Given I sign in as "<EMAIL>" with password "<PASSWORD>"
  Then I should be on the home page
  And I should see a link or button "<EMAIL>"

Scenario: Sign in with wrong password for an existing admin user
  Given I sign in as "<EMAIL>" with password "<PASSWORD>"
  Then I should be on the sign in page
  And I should see "I'm sorry, you are not authorized to login to the system."

Scenario: Sign in for a non-existent user
  Given I sign in as "<EMAIL>" with password "<PASSWORD>"
  Then I should be on the sign in page
  And I should see "I'm sorry, you are not authorized to login to the system"

@javascript
Scenario: Check that login/register toggle works
  # when first opened
  Given I click "Login"
  Then the "loginForm" should be visible
  And the "registerForm" should be not visible
  And I should see "New organisation? Sign-up.."
  # click one way
  Given I click "toggle_link"
  Then the "loginForm" should be not visible
  And the "registerForm" should be visible
  And I should see "Already a member? Login"
  # then click back the other way
  Given I click "toggle_link"
  Then the "loginForm" should be visible
  And the "registerForm" should be not visible
  And I should see "New organisation? Sign-up.."

Scenario: Check class of flash notice  - error
  Given I sign in as "<EMAIL>" with password "<PASSWORD>"
  Then I should be on the sign in page
  And the "flash_alert" should be "alert-error"


Scenario: Check class of flash notice  - success
  Given I sign in as "<EMAIL>" with password "<PASSWORD>"
  Then I should be on the home page
  And the "flash_notice" should be "alert-success"
{'fraction_non_alphanumeric': 0.06719532554257095, 'fraction_numerical': 0.017529215358931552, 'mean_word_length': 3.1796511627906976, 'pattern_counts': {'":': 0, '<': 52, '<?xml version=': 0, '>': 52, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 5, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1774750', 'n_tokens_mistral': 2109, 'n_tokens_neox': 1998, 'n_words': 1074}