Skip to content

Commit

Permalink
Tests: Fix broken Behat scenario 'A student attempts to access the pa…
Browse files Browse the repository at this point in the history
…ge activity with the activity link, but cancels the popup'.
  • Loading branch information
abias committed Aug 24, 2024
1 parent c6c5160 commit c70a774
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ moodle-availability_password
Changes
-------

### Unreleased

* 2024-08-24 - Tests: Fix broken Behat scenario 'A student attempts to access the page activity with the activity link, but cancels the popup'.

### v4.3-r2

* 2024-08-11 - Add section for scheduled tasks to README
Expand Down
28 changes: 12 additions & 16 deletions tests/behat/availability_password.feature
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,19 @@ Feature: When a teacher configures a password restriction a student cannot acces
Then I should see "Restricted page"
And I should see "Not available unless: You enter the correct password"

# This scenario broke on Moodle 4.0 for unknown reasons.
# However, when tested manually, clicking the activity link works without problems.
# The scenario is left commented out until the reason for this misbehaviour is found.
#
# Scenario: A student attempts to access the page activity with the activity link, but cancels the popup
# When I log in as "student1"
# And I am on "Course 1" course homepage
# And I click on "Restricted page" "text"
# Then I should not see "Some page content"
# And I should see "is protected with a password"
# And I click on "Cancel" "button" in the "Password protection" "dialogue"
# And I should see "Not available unless: You enter the correct password"
Scenario: A student attempts to access the page activity with the activity link, but cancels the popup
When I log in as "student1"
And I am on "Course 1" course homepage
And I click on "Restricted page" "text" in the ".modtype_page .activity-name-area" "css_element"
Then I should not see "Some page content"
And I should see "is protected with a password"
And I click on "Cancel" "button" in the "Password protection" "dialogue"
And I should see "Not available unless: You enter the correct password"

Scenario: A student attempts to access the page activity with the availability link, but cancels the popup
When I log in as "student1"
And I am on "Course 1" course homepage
And I click on "You enter the correct password" "text"
And I click on "You enter the correct password" "text" in the ".modtype_page .activity-availability" "css_element"
Then I should not see "Some page content"
And I should see "is protected with a password"
And I click on "Cancel" "button" in the "Password protection" "dialogue"
Expand All @@ -63,7 +59,7 @@ Feature: When a teacher configures a password restriction a student cannot acces
Scenario: A student attempts to access the page activity and enters a wrong password
When I log in as "student1"
And I am on "Course 1" course homepage
And I click on "You enter the correct password" "text"
And I click on "You enter the correct password" "text" in the ".modtype_page .activity-availability" "css_element"
And I set the field "availability_password_input" to "Guess 1"
And I press "Submit"
Then I should see "Password incorrect"
Expand All @@ -76,7 +72,7 @@ Feature: When a teacher configures a password restriction a student cannot acces
| remember | db | availability_password |
When I log in as "student1"
And I am on "Course 1" course homepage
And I click on "You enter the correct password" "text"
And I click on "You enter the correct password" "text" in the ".modtype_page .activity-availability" "css_element"
And I set the field "availability_password_input" to "Testing123"
And I press "Submit"
And I wait to be redirected
Expand All @@ -95,7 +91,7 @@ Feature: When a teacher configures a password restriction a student cannot acces
| remember | session | availability_password |
When I log in as "student1"
And I am on "Course 1" course homepage
And I click on "You enter the correct password" "text"
And I click on "You enter the correct password" "text" in the ".modtype_page .activity-availability" "css_element"
And I set the field "availability_password_input" to "Testing123"
And I press "Submit"
And I wait to be redirected
Expand Down

0 comments on commit c70a774

Please sign in to comment.