| 1 | 
           efrain | 
           1 | 
           @tool @tool_mfa @factor_sms
  | 
        
        
            | 
            | 
           2 | 
           Feature: Set up SMS factor in user preferences
  | 
        
        
            | 
            | 
           3 | 
             In order check the SMS factor verification
  | 
        
        
            | 
            | 
           4 | 
             As an admin
  | 
        
        
            | 
            | 
           5 | 
             I want to setup and enable the SMS factor for the current user
  | 
        
        
            | 
            | 
           6 | 
              | 
        
        
            | 
            | 
           7 | 
             Background:
  | 
        
        
            | 
            | 
           8 | 
               Given I log in as "admin"
  | 
        
        
           | 1441 | 
           ariadna | 
           9 | 
               And I navigate to "Plugins > SMS > Manage SMS gateways" in site administration
  | 
        
        
            | 
            | 
           10 | 
               And I follow "Create new SMS gateway"
  | 
        
        
            | 
            | 
           11 | 
               And I set the following fields to these values:
  | 
        
        
            | 
            | 
           12 | 
                 | SMS gateway provider | AWS           |
  | 
        
        
            | 
            | 
           13 | 
                 | Gateway name         | Dummy gateway |
  | 
        
        
            | 
            | 
           14 | 
                 | Access key           | key123        |
  | 
        
        
            | 
            | 
           15 | 
                 | Secret access key    | secret456     |
  | 
        
        
            | 
            | 
           16 | 
               And I press "Save changes"
  | 
        
        
           | 1 | 
           efrain | 
           17 | 
               And the following config values are set as admin:
  | 
        
        
            | 
            | 
           18 | 
                 | enabled | 1 | tool_mfa |
  | 
        
        
           | 1441 | 
           ariadna | 
           19 | 
                 | lockout | 3 | tool_mfa |
  | 
        
        
           | 1 | 
           efrain | 
           20 | 
               And the following config values are set as admin:
  | 
        
        
           | 1441 | 
           ariadna | 
           21 | 
                 | enabled    | 1      | factor_sms |
  | 
        
        
            | 
            | 
           22 | 
                 | weight     | 100    | factor_sms |
  | 
        
        
            | 
            | 
           23 | 
                 | duration   | 1800   | factor_sms |
  | 
        
        
            | 
            | 
           24 | 
               And I navigate to "Plugins > Admin tools > Multi-factor authentication" in site administration
  | 
        
        
            | 
            | 
           25 | 
               And I follow "Edit settings for the SMS factor"
  | 
        
        
            | 
            | 
           26 | 
               And I set the field "SMS gateway" to "Dummy gateway (AWS)"
  | 
        
        
            | 
            | 
           27 | 
               And I press "Save changes"
  | 
        
        
            | 
            | 
           28 | 
               And I should see "Changes saved"
  | 
        
        
           | 1 | 
           efrain | 
           29 | 
               When I follow "Preferences" in the user menu
  | 
        
        
            | 
            | 
           30 | 
               And I click on "Multi-factor authentication preferences" "link"
  | 
        
        
            | 
            | 
           31 | 
               And I click on "Set up" "button"
  | 
        
        
            | 
            | 
           32 | 
              | 
        
        
            | 
            | 
           33 | 
             Scenario: Phone number setup form validation
  | 
        
        
            | 
            | 
           34 | 
               Given I set the field "Mobile number" to "++5555sss"
  | 
        
        
            | 
            | 
           35 | 
               And I press "Send code"
  | 
        
        
            | 
            | 
           36 | 
               And I should see "The phone number you provided is not in a valid format."
  | 
        
        
            | 
            | 
           37 | 
               And I set the field "Mobile number" to "0123456789"
  | 
        
        
            | 
            | 
           38 | 
               And I press "Send code"
  | 
        
        
            | 
            | 
           39 | 
               And I should see "The phone number you provided is not in a valid format."
  | 
        
        
            | 
            | 
           40 | 
               And I set the field "Mobile number" to "786-307-3615"
  | 
        
        
            | 
            | 
           41 | 
               And I press "Send code"
  | 
        
        
            | 
            | 
           42 | 
               And I should see "The phone number you provided is not in a valid format."
  | 
        
        
            | 
            | 
           43 | 
               When I set the field "Mobile number" to "649709233"
  | 
        
        
            | 
            | 
           44 | 
               And I press "Send code"
  | 
        
        
            | 
            | 
           45 | 
               Then I should see "The phone number you provided is not in a valid format."
  | 
        
        
            | 
            | 
           46 | 
              | 
        
        
            | 
            | 
           47 | 
             Scenario: Edit phone number
  | 
        
        
            | 
            | 
           48 | 
               Given I set the field "Mobile number" to "+34649709233"
  | 
        
        
            | 
            | 
           49 | 
               And I press "Send code"
  | 
        
        
            | 
            | 
           50 | 
               And I click on "Edit phone number" "link"
  | 
        
        
            | 
            | 
           51 | 
               And I should see "Mobile number"
  | 
        
        
            | 
            | 
           52 | 
               When I set the field "Mobile number" to "+34649709232"
  | 
        
        
            | 
            | 
           53 | 
               And I press "Send code"
  | 
        
        
            | 
            | 
           54 | 
               Then I should see "Enter code"
  | 
        
        
            | 
            | 
           55 | 
              | 
        
        
            | 
            | 
           56 | 
             Scenario: Code setup form validation
  | 
        
        
            | 
            | 
           57 | 
               Given I set the field "Mobile number" to "+34649709233"
  | 
        
        
            | 
            | 
           58 | 
               And I press "Send code"
  | 
        
        
            | 
            | 
           59 | 
               And I should see "Enter code"
  | 
        
        
            | 
            | 
           60 | 
               When I set the field "Enter code" to "555556"
  | 
        
        
            | 
            | 
           61 | 
               And I click on "Save" "button"
  | 
        
        
            | 
            | 
           62 | 
               And I should see "Wrong code. Try again"
  | 
        
        
            | 
            | 
           63 | 
               And I set the field "Enter code" to "ddddd5"
  | 
        
        
            | 
            | 
           64 | 
               And I click on "Save" "button"
  | 
        
        
            | 
            | 
           65 | 
               Then I should see "Wrong code. Try again"
  |