Merge branch 'MDL-71610-master' of git://github.com/bmbrands/moodle

This commit is contained in:
Ilya Tregubov 2021-09-29 15:40:39 +02:00
commit 34a0ba3232
110 changed files with 769 additions and 265 deletions

View file

@ -17,12 +17,15 @@ Feature: Toggle activities visibility from the course page
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exists:
| activity | forum |
| course | C1 |
| idnumber | C1F1 |
| name | Test forum name |
| intro | Test forum description |
| visible | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
| Availability | Show on course page |
When I open "Test forum name" actions menu
Then "Test forum name" actions menu should not have "Show" item
And "Test forum name" actions menu should not have "Make available" item
@ -60,7 +63,6 @@ Feature: Toggle activities visibility from the course page
And I log in as "student1"
And I am on "Course 1" course homepage
And I should not see "Test forum name"
And I log out
@javascript
Scenario: Activities can be made available and unavailable inside a hidden section
@ -75,13 +77,17 @@ Feature: Toggle activities visibility from the course page
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exists:
| activity | forum |
| course | C1 |
| idnumber | C1F1 |
| section | 2 |
| name | Test forum name |
| intro | Test forum description |
| visible | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add the "Recent activity" block
And I add a "Forum" to section "2" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
| Availability | Show on course page |
When I hide section "2"
Then "Test forum name" activity should be hidden
And I open "Test forum name" actions menu
@ -116,7 +122,6 @@ Feature: Toggle activities visibility from the course page
And I click on "Test forum name" "link" in the "Recent activity" "block"
And I should see "Test forum name"
And I should see "(There are no discussion topics yet in this forum)"
And I log out
@javascript
Scenario: Activities can be made available but not visible on a course page

View file

@ -82,32 +82,6 @@ class behat_course extends behat_base {
];
}
/**
* Turns editing mode on.
* @Given /^I turn editing mode on$/
*/
public function i_turn_editing_mode_on() {
try {
$this->execute("behat_forms::press_button", get_string('turneditingon'));
} catch (Exception $e) {
$this->execute("behat_navigation::i_navigate_to_in_current_page_administration", [get_string('turneditingon')]);
}
}
/**
* Turns editing mode off.
* @Given /^I turn editing mode off$/
*/
public function i_turn_editing_mode_off() {
try {
$this->execute("behat_forms::press_button", get_string('turneditingoff'));
} catch (Exception $e) {
$this->execute("behat_navigation::i_navigate_to_in_current_page_administration", [get_string('turneditingoff')]);
}
}
/**
* Creates a new course with the provided table data matching course settings names with the desired values.
*
@ -733,9 +707,7 @@ class behat_course extends behat_base {
* @throws ExpectationException
*/
public function activity_should_be_hidden($activityname) {
if ($this->is_course_editor()) {
// The activity should exist.
$activitynode = $this->get_activity_node($activityname);
@ -758,7 +730,6 @@ class behat_course extends behat_base {
}
} else {
// It should not exist at all.
try {
$this->get_activity_node($activityname);
@ -1310,15 +1281,13 @@ class behat_course extends behat_base {
*
* @return bool
*/
protected function is_course_editor() {
// We don't need to behat_base::spin() here as all is already loaded.
if (!$this->getSession()->getPage()->findButton(get_string('turneditingoff')) &&
!$this->getSession()->getPage()->findButton(get_string('turneditingon'))) {
protected function is_course_editor(): bool {
try {
$this->find('field', get_string('editmode'), false, false, 0);
return true;
} catch (ElementNotFoundException $e) {
return false;
}
return true;
}
/**
@ -1327,7 +1296,8 @@ class behat_course extends behat_base {
* @return bool
*/
protected function is_editing_on() {
return $this->getSession()->getPage()->findButton(get_string('turneditingoff')) ? true : false;
$body = $this->find('xpath', "//body", false, false, 0);
return $body->hasClass('editing');
}
/**

View file

@ -47,7 +47,7 @@ Feature: Tagging courses
And I press "Save and display"
And I log out
And I log in as "user1"
And I press "Customise this page"
And I turn editing mode on
# TODO MDL-57120 "Tags" link not accessible without navigation block.
And I add the "Navigation" block if not present
And I click on "Site pages" "list_item" in the "Navigation" "block"
@ -84,7 +84,7 @@ Feature: Tagging courses
And I press "Save changes"
And I log out
And I log in as "user1"
And I press "Customise this page"
And I turn editing mode on
# TODO MDL-57120 "Tags" link not accessible without navigation block.
And I add the "Navigation" block if not present
And I click on "Site pages" "list_item" in the "Navigation" "block"

View file

@ -23,23 +23,23 @@ Feature: Front page topic section
| assign | Acceptance test site | 1 | Frontpage assignment | Assignment description | assign0 |
And I log in as "admin"
And I am on site homepage
And I navigate to "Turn editing on" in current page administration
And I turn editing mode on
And I click on "Edit summary" "link" in the "region-main" "region"
And I click on "Custom" "checkbox"
And I set the field "New value for Section name" to "New section name"
When I press "Save changes"
And I should see "New section name" in the "region-main" "region"
Then I navigate to "Turn editing off" in current page administration
Then I turn editing mode off
And I should see "New section name" in the "region-main" "region"
@javascript
Scenario: Topic description appears in the frontpage
Given I log in as "admin"
And I am on site homepage
And I navigate to "Turn editing on" in current page administration
And I turn editing mode on
And I click on "Edit summary" "link" in the "region-main" "region"
And I set the field "Summary" to "New section description"
When I press "Save changes"
And I should see "New section description" in the "region-main" "region"
Then I navigate to "Turn editing off" in current page administration
Then I turn editing mode off
And I should see "New section description" in the "region-main" "region"