MDL-56511 theme_boost: Fixing minor behat failures
[moodle.git] / auth / tests / behat / displayloginfailures.feature
CommitLineData
fa30dd8c
JD
1@core @core_auth
2Feature: Test the 'showlogfailures' feature works.
3 In order to see my recent login failures when logging in
4 As a user
5 I need to have at least one failed login attempt and then log in
6
7 Background:
8 Given the following "users" exist:
9 | username |
10 | teacher1 |
11 And the following config values are set as admin:
12 | displayloginfailures | 1 |
13
14 # Given the user has at least one failed login attempt, when they login, then they should see both header and footer notices.
15 Scenario: Check that 'displayloginfailures' works without javascript for teachers.
16 # Simulate a log in failure for the teacher.
17 Given I am on homepage
18 And I click on "Log in" "link" in the ".logininfo" "css_element"
19 And I set the field "Username" to "teacher1"
20 And I set the field "Password" to "wrongpass"
21 And I press "Log in"
22 And I should see "Invalid login, please try again"
23 # Now, log in with the correct credentials.
24 When I set the field "Username" to "teacher1"
25 And I set the field "Password" to "teacher1"
26 And I press "Log in"
27 # Confirm the notices are displayed.
f5779bb1 28 Then I should see "1 failed logins since your last login" in the "nav.navbar" "css_element"
fa30dd8c
JD
29 And I should see "1 failed logins since your last login" in the "page-footer" "region"
30 # Confirm the notices disappear when navigating to another page.
31 And I am on homepage
f5779bb1 32 And I should not see "1 failed logins since your last login" in the "nav.navbar" "css_element"
fa30dd8c
JD
33 And I should not see "1 failed logins since your last login" in the "page-footer" "region"
34
35 # Given the user has at least one failed login attempt, when they login, then they should see both header and footer notices.
36 Scenario: Check that 'displayloginfailures' works without javascript for admins.
37 # Simulate a log in failure for the teacher.
38 Given I am on homepage
39 And I click on "Log in" "link" in the ".logininfo" "css_element"
40 And I set the field "Username" to "admin"
41 And I set the field "Password" to "wrongpass"
42 And I press "Log in"
43 And I should see "Invalid login, please try again"
44 # Now, log in with the correct credentials.
45 When I set the field "Username" to "admin"
46 And I set the field "Password" to "admin"
47 And I press "Log in"
48 # Confirm the notices are displayed.
f5779bb1 49 Then I should see "1 failed logins since your last login" in the "nav.navbar" "css_element"
fa30dd8c
JD
50 And I should see "1 failed logins since your last login (Logs)" in the "page-footer" "region"
51 # Confirm that the link works and that the notices disappear when navigating to another page.
52 And I click on "Logs" "link" in the "page-footer" "region"
53 And I should see "User login failed" in the "table.reportlog" "css_element"
f5779bb1 54 And I should not see "1 failed logins since your last login" in the "nav.navbar" "css_element"
fa30dd8c 55 And I should not see "1 failed logins since your last login (Logs)" in the "page-footer" "region"