MDL-62950 behat: Correct navbar references
[moodle.git] / auth / tests / behat / displayloginfailures.feature
blob4b6e2a9d21e656b20a012b38e878a728bcb6de06
1 @core @core_auth
2 Feature: 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
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 |
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.
28     Then I should see "1 failed logins since your last login" in the ".navbar" "css_element"
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
32     And I should not see "1 failed logins since your last login" in the ".navbar" "css_element"
33     And I should not see "1 failed logins since your last login" in the "page-footer" "region"
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.
49     Then I should see "1 failed logins since your last login" in the ".navbar" "css_element"
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"
54     And I should not see "1 failed logins since your last login" in the ".navbar" "css_element"
55     And I should not see "1 failed logins since your last login (Logs)" in the "page-footer" "region"