MDL-4782 course: Behat tests for stealth mode support
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
@block @block_main_menu
|
||||
@block @block_site_main_menu
|
||||
Feature: Add URL to main menu block
|
||||
In order to add helpful resources for students
|
||||
As a admin
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Behat steps definitions for block site main menu
|
||||
*
|
||||
* @package block_site_main_menu
|
||||
* @category test
|
||||
* @copyright 2016 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
|
||||
|
||||
require_once(__DIR__ . '/../../../../lib/behat/behat_base.php');
|
||||
|
||||
use Behat\Mink\Exception\ExpectationException as ExpectationException,
|
||||
Behat\Mink\Exception\DriverException as DriverException,
|
||||
Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException;
|
||||
|
||||
/**
|
||||
* Behat steps definitions for block site main menu
|
||||
*
|
||||
* @package block_site_main_menu
|
||||
* @category test
|
||||
* @copyright 2016 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class behat_block_site_main_menu extends behat_base {
|
||||
|
||||
/**
|
||||
* Returns the DOM node of the activity in the site menu block
|
||||
*
|
||||
* @throws ElementNotFoundException Thrown by behat_base::find
|
||||
* @param string $activityname The activity name
|
||||
* @return NodeElement
|
||||
*/
|
||||
protected function get_site_menu_activity_node($activityname) {
|
||||
$activityname = behat_context_helper::escape($activityname);
|
||||
$xpath = "//*[contains(concat(' ',normalize-space(@class),' '),' block_site_main_menu ')]//li[contains(., $activityname)]";
|
||||
|
||||
return $this->find('xpath', $xpath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the specified activity's action menu contains an item.
|
||||
*
|
||||
* @Then /^"(?P<activity_name_string>(?:[^"]|\\")*)" activity in site main menu block should have "(?P<icon_name_string>(?:[^"]|\\")*)" editing icon$/
|
||||
* @param string $activityname
|
||||
* @param string $iconname
|
||||
*/
|
||||
public function activity_in_site_main_menu_block_should_have_editing_icon($activityname, $iconname) {
|
||||
$activitynode = $this->get_site_menu_activity_node($activityname);
|
||||
|
||||
$notfoundexception = new ExpectationException('"' . $activityname . '" doesn\'t have a "' .
|
||||
$iconname . '" editing icon', $this->getSession());
|
||||
$this->find('named_partial', array('link', $iconname), $notfoundexception, $activitynode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the specified activity's action menu contains an item.
|
||||
*
|
||||
* @Then /^"(?P<activity_name_string>(?:[^"]|\\")*)" activity in site main menu block should not have "(?P<icon_name_string>(?:[^"]|\\")*)" editing icon$/
|
||||
* @param string $activityname
|
||||
* @param string $iconname
|
||||
*/
|
||||
public function activity_in_site_main_menu_block_should_not_have_editing_icon($activityname, $iconname) {
|
||||
$activitynode = $this->get_site_menu_activity_node($activityname);
|
||||
|
||||
try {
|
||||
$this->find('named_partial', array('link', $iconname), false, $activitynode);
|
||||
throw new ExpectationException('"' . $activityname . '" has a "' . $iconname .
|
||||
'" editing icon when it should not', $this->getSession());
|
||||
} catch (ElementNotFoundException $e) {
|
||||
// This is good, the menu item should not be there.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clicks on the specified element of the activity. You should be in the course page with editing mode turned on.
|
||||
*
|
||||
* @Given /^I click on "(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>(?:[^"]|\\")*)" in the "(?P<activity_name_string>(?:[^"]|\\")*)" activity in site main menu block$/
|
||||
* @param string $element
|
||||
* @param string $selectortype
|
||||
* @param string $activityname
|
||||
*/
|
||||
public function i_click_on_in_the_activity_in_site_main_menu_block($element, $selectortype, $activityname) {
|
||||
$element = $this->get_site_menu_activity_element($element, $selectortype, $activityname);
|
||||
$element->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clicks on the specified element inside the activity container.
|
||||
*
|
||||
* @throws ElementNotFoundException
|
||||
* @param string $element
|
||||
* @param string $selectortype
|
||||
* @param string $activityname
|
||||
* @return NodeElement
|
||||
*/
|
||||
protected function get_site_menu_activity_element($element, $selectortype, $activityname) {
|
||||
$activitynode = $this->get_site_menu_activity_node($activityname);
|
||||
|
||||
// Transforming to Behat selector/locator.
|
||||
list($selector, $locator) = $this->transform_selector($selectortype, $element);
|
||||
$exception = new ElementNotFoundException($this->getSession(), '"' . $element . '" "' .
|
||||
$selectortype . '" in "' . $activityname . '" ');
|
||||
|
||||
return $this->find($selector, $locator, $exception, $activitynode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the specified activity is hidden.
|
||||
*
|
||||
* @Then /^"(?P<activity_name_string>(?:[^"]|\\")*)" activity in site main menu block should be hidden$/
|
||||
* @param string $activityname
|
||||
*/
|
||||
public function activity_in_site_main_menu_block_should_be_hidden($activityname) {
|
||||
$this->get_site_menu_activity_element("a.dimmed", "css_element", $activityname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the specified activity is hidden.
|
||||
*
|
||||
* @Then /^"(?P<activity_name_string>(?:[^"]|\\")*)" activity in site main menu block should be available but hidden from course page$/
|
||||
* @param string $activityname
|
||||
*/
|
||||
public function activity_in_site_main_menu_block_should_be_available_but_hidden_from_course_page($activityname) {
|
||||
$this->get_site_menu_activity_element("a.stealth", "css_element", $activityname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens an activity actions menu if it is not already opened.
|
||||
*
|
||||
* @Given /^I open "(?P<activity_name_string>(?:[^"]|\\")*)" actions menu in site main menu block$/
|
||||
* @throws DriverException The step is not available when Javascript is disabled
|
||||
* @param string $activityname
|
||||
*/
|
||||
public function i_open_actions_menu_in_site_main_menu_block($activityname) {
|
||||
$activityname = behat_context_helper::escape($activityname);
|
||||
$xpath = "//*[contains(concat(' ',normalize-space(@class),' '),' block_site_main_menu ')]//li[contains(., $activityname)]";
|
||||
$this->execute('behat_action_menu::i_open_the_action_menu_in', [$xpath, 'xpath_element']);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
@block @block_main_menu
|
||||
@block @block_site_main_menu
|
||||
Feature: Edit activities in main menu block
|
||||
In order to use main menu block
|
||||
As an admin
|
||||
@@ -12,7 +12,7 @@ Feature: Edit activities in main menu block
|
||||
And I add the "Main menu" block
|
||||
When I add a "Forum" to section "0" and I fill the form with:
|
||||
| Forum name | My forum name |
|
||||
And I click on "Edit title" "link" in the "//*[contains(@class,'block_site_main_menu')]//li[contains(.,'My forum name')]" "xpath_element"
|
||||
And I click on "Edit title" "link" in the "My forum name" activity in site main menu block
|
||||
And I set the field "New name for activity My forum name" to "New forum name"
|
||||
And I press key "13" in the field "New name for activity My forum name"
|
||||
Then I should not see "My forum name"
|
||||
@@ -20,3 +20,49 @@ Feature: Edit activities in main menu block
|
||||
And I follow "New forum name"
|
||||
And I should not see "My forum name"
|
||||
And I should see "New forum name"
|
||||
|
||||
@javascript
|
||||
Scenario: Activities in main menu block can be made available but not visible on a course page
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| allowstealth | 1 |
|
||||
And I am on site homepage
|
||||
And I navigate to "Turn editing on" node in "Front page settings"
|
||||
And I add the "Main menu" block
|
||||
When I add a "Forum" to section "0" and I fill the form with:
|
||||
| Forum name | Visible forum |
|
||||
When I add a "Forum" to section "0" and I fill the form with:
|
||||
| Forum name | My forum name |
|
||||
And "My forum name" activity in site main menu block should have "Hide" editing icon
|
||||
And "My forum name" activity in site main menu block should not have "Show" editing icon
|
||||
And "My forum name" activity in site main menu block should not have "Make available" editing icon
|
||||
And "My forum name" activity in site main menu block should not have "Make unavailable" editing icon
|
||||
And I open "My forum name" actions menu in site main menu block
|
||||
And I click on "Hide" "link" in the "My forum name" activity in site main menu block
|
||||
And "My forum name" activity in site main menu block should be hidden
|
||||
And "My forum name" activity in site main menu block should not have "Hide" editing icon
|
||||
And "My forum name" activity in site main menu block should have "Show" editing icon
|
||||
And "My forum name" activity in site main menu block should have "Make available" editing icon
|
||||
And "My forum name" activity in site main menu block should not have "Make unavailable" editing icon
|
||||
And I open "My forum name" actions menu in site main menu block
|
||||
And I click on "Make available" "link" in the "My forum name" activity in site main menu block
|
||||
And "My forum name" activity in site main menu block should be available but hidden from course page
|
||||
And "My forum name" activity in site main menu block should not have "Hide" editing icon
|
||||
And "My forum name" activity in site main menu block should have "Show" editing icon
|
||||
And "My forum name" activity in site main menu block should not have "Make available" editing icon
|
||||
And "My forum name" activity in site main menu block should have "Make unavailable" editing icon
|
||||
# Make sure that "Visible" dropdown in the edit menu has three options.
|
||||
And I open "My forum name" actions menu in site main menu block
|
||||
And I click on "Edit settings" "link" in the "My forum name" activity in site main menu block
|
||||
And I expand all fieldsets
|
||||
And the "Visible" select box should contain "Show"
|
||||
And the "Visible" select box should contain "Hidden from students"
|
||||
And the "Visible" select box should not contain "Hide"
|
||||
And the field "Visible" matches value "Available but not displayed on course page"
|
||||
And I press "Save and return to course"
|
||||
And "My forum name" activity in site main menu block should be available but hidden from course page
|
||||
And I navigate to "Turn editing off" node in "Front page settings"
|
||||
And "My forum name" activity in site main menu block should be available but hidden from course page
|
||||
And I log out
|
||||
And I should not see "My forum name" in the "Main menu" "block"
|
||||
And I should see "Visible forum" in the "Main menu" "block"
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Behat steps definitions for block social activities
|
||||
*
|
||||
* @package block_social_activities
|
||||
* @category test
|
||||
* @copyright 2016 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
|
||||
|
||||
require_once(__DIR__ . '/../../../../lib/behat/behat_base.php');
|
||||
|
||||
use Behat\Mink\Exception\ExpectationException as ExpectationException,
|
||||
Behat\Mink\Exception\DriverException as DriverException,
|
||||
Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException;
|
||||
|
||||
/**
|
||||
* Behat steps definitions for block social activities
|
||||
*
|
||||
* @package block_social_activities
|
||||
* @category test
|
||||
* @copyright 2016 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class behat_block_social_activities extends behat_base {
|
||||
|
||||
/**
|
||||
* Returns the DOM node of the activity in the social activities block
|
||||
*
|
||||
* @throws ElementNotFoundException Thrown by behat_base::find
|
||||
* @param string $activityname The activity name
|
||||
* @return NodeElement
|
||||
*/
|
||||
protected function get_social_block_activity_node($activityname) {
|
||||
$activityname = behat_context_helper::escape($activityname);
|
||||
$xpath = "//*[contains(concat(' ',normalize-space(@class),' '),' block_social_activities ')]//li[contains(., $activityname)]";
|
||||
|
||||
return $this->find('xpath', $xpath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the specified activity's action menu contains an item.
|
||||
*
|
||||
* @Then /^"(?P<activity_name_string>(?:[^"]|\\")*)" activity in social activities block should have "(?P<icon_name_string>(?:[^"]|\\")*)" editing icon$/
|
||||
* @param string $activityname
|
||||
* @param string $iconname
|
||||
*/
|
||||
public function activity_in_social_activities_block_should_have_editing_icon($activityname, $iconname) {
|
||||
$activitynode = $this->get_social_block_activity_node($activityname);
|
||||
|
||||
$notfoundexception = new ExpectationException('"' . $activityname . '" doesn\'t have a "' .
|
||||
$iconname . '" editing icon', $this->getSession());
|
||||
$this->find('named_partial', array('link', $iconname), $notfoundexception, $activitynode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the specified activity's action menu contains an item.
|
||||
*
|
||||
* @Then /^"(?P<activity_name_string>(?:[^"]|\\")*)" activity in social activities block should not have "(?P<icon_name_string>(?:[^"]|\\")*)" editing icon$/
|
||||
* @param string $activityname
|
||||
* @param string $iconname
|
||||
*/
|
||||
public function activity_in_social_activities_block_should_not_have_editing_icon($activityname, $iconname) {
|
||||
$activitynode = $this->get_social_block_activity_node($activityname);
|
||||
|
||||
try {
|
||||
$this->find('named_partial', array('link', $iconname), false, $activitynode);
|
||||
throw new ExpectationException('"' . $activityname . '" has a "' . $iconname .
|
||||
'" editing icon when it should not', $this->getSession());
|
||||
} catch (ElementNotFoundException $e) {
|
||||
// This is good, the menu item should not be there.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clicks on the specified element of the activity. You should be in the course page with editing mode turned on.
|
||||
*
|
||||
* @Given /^I click on "(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>(?:[^"]|\\")*)" in the "(?P<activity_name_string>(?:[^"]|\\")*)" activity in social activities block$/
|
||||
* @param string $element
|
||||
* @param string $selectortype
|
||||
* @param string $activityname
|
||||
*/
|
||||
public function i_click_on_in_the_activity_in_social_activities_block($element, $selectortype, $activityname) {
|
||||
$element = $this->get_social_block_activity_element($element, $selectortype, $activityname);
|
||||
$element->click();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clicks on the specified element inside the activity container.
|
||||
*
|
||||
* @throws ElementNotFoundException
|
||||
* @param string $element
|
||||
* @param string $selectortype
|
||||
* @param string $activityname
|
||||
* @return NodeElement
|
||||
*/
|
||||
protected function get_social_block_activity_element($element, $selectortype, $activityname) {
|
||||
$activitynode = $this->get_social_block_activity_node($activityname);
|
||||
|
||||
// Transforming to Behat selector/locator.
|
||||
list($selector, $locator) = $this->transform_selector($selectortype, $element);
|
||||
$exception = new ElementNotFoundException($this->getSession(), '"' . $element . '" "' .
|
||||
$selectortype . '" in "' . $activityname . '" ');
|
||||
|
||||
return $this->find($selector, $locator, $exception, $activitynode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the specified activity is hidden.
|
||||
*
|
||||
* @Then /^"(?P<activity_name_string>(?:[^"]|\\")*)" activity in social activities block should be hidden$/
|
||||
* @param string $activityname
|
||||
*/
|
||||
public function activity_in_social_activities_block_should_be_hidden($activityname) {
|
||||
$this->get_social_block_activity_element("a.dimmed", "css_element", $activityname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the specified activity is hidden.
|
||||
*
|
||||
* @Then /^"(?P<activity_name_string>(?:[^"]|\\")*)" activity in social activities block should be available but hidden from course page$/
|
||||
* @param string $activityname
|
||||
*/
|
||||
public function activity_in_social_activities_block_should_be_available_but_hidden_from_course_page($activityname) {
|
||||
$this->get_social_block_activity_element("a.stealth", "css_element", $activityname);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens an activity actions menu if it is not already opened.
|
||||
*
|
||||
* @Given /^I open "(?P<activity_name_string>(?:[^"]|\\")*)" actions menu in social activities block$/
|
||||
* @throws DriverException The step is not available when Javascript is disabled
|
||||
* @param string $activityname
|
||||
*/
|
||||
public function i_open_actions_menu_in_social_activities_block($activityname) {
|
||||
$activityname = behat_context_helper::escape($activityname);
|
||||
$xpath = "//*[contains(concat(' ',normalize-space(@class),' '),' block_social_activities ')]//li[contains(., $activityname)]";
|
||||
$this->execute('behat_action_menu::i_open_the_action_menu_in', [$xpath, 'xpath_element']);
|
||||
}
|
||||
}
|
||||
@@ -1,27 +1,31 @@
|
||||
@block @block_social_activities
|
||||
@block @block_social_activities @format_social
|
||||
Feature: Edit activities in social activities block
|
||||
In order to use social activities block
|
||||
As a teacher
|
||||
I need to add and edit activities there
|
||||
|
||||
@javascript
|
||||
Scenario: Edit name of acitivity in-place in social activities block
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | social |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname |
|
||||
| user1 | User | One |
|
||||
| student1 | Student | One |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| user1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
|
||||
@javascript
|
||||
Scenario: Edit name of acitivity in-place in social activities block
|
||||
Given I log in as "user1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I set the field "Add an activity to section 'section 0'" to "Forum"
|
||||
And I set the field "Forum name" to "My forum name"
|
||||
And I press "Save and return to course"
|
||||
And I click on "Edit title" "link" in the "//*[contains(@class,'block_social_activities')]//li[contains(.,'My forum name')]" "xpath_element"
|
||||
And I click on "Edit title" "link" in the "My forum name" activity in social activities block
|
||||
And I set the field "New name for activity My forum name" to "New forum name"
|
||||
And I press key "13" in the field "New name for activity My forum name"
|
||||
Then I should not see "My forum name" in the "Social activities" "block"
|
||||
@@ -29,3 +33,56 @@ Feature: Edit activities in social activities block
|
||||
And I follow "New forum name"
|
||||
And I should not see "My forum name"
|
||||
And I should see "New forum name"
|
||||
|
||||
@javascript
|
||||
Scenario: Activities in social activities block can be made available but not visible on a course page
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| allowstealth | 1 |
|
||||
And I log out
|
||||
And I log in as "user1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I add the "Recent activity" block
|
||||
And I set the field "Add an activity to section 'section 0'" to "Forum"
|
||||
And I set the field "Forum name" to "My forum name"
|
||||
And I press "Save and return to course"
|
||||
And "My forum name" activity in social activities block should have "Hide" editing icon
|
||||
And "My forum name" activity in social activities block should not have "Show" editing icon
|
||||
And "My forum name" activity in social activities block should not have "Make available" editing icon
|
||||
And "My forum name" activity in social activities block should not have "Make unavailable" editing icon
|
||||
And I wait until the page is ready
|
||||
And I open "My forum name" actions menu in social activities block
|
||||
And I click on "Hide" "link" in the "My forum name" activity in social activities block
|
||||
And "My forum name" activity in social activities block should be hidden
|
||||
And "My forum name" activity in social activities block should not have "Hide" editing icon
|
||||
And "My forum name" activity in social activities block should have "Show" editing icon
|
||||
And "My forum name" activity in social activities block should have "Make available" editing icon
|
||||
And "My forum name" activity in social activities block should not have "Make unavailable" editing icon
|
||||
And I open "My forum name" actions menu in social activities block
|
||||
And I click on "Make available" "link" in the "My forum name" activity in social activities block
|
||||
And "My forum name" activity in social activities block should be available but hidden from course page
|
||||
And "My forum name" activity in social activities block should not have "Hide" editing icon
|
||||
And "My forum name" activity in social activities block should have "Show" editing icon
|
||||
And "My forum name" activity in social activities block should not have "Make available" editing icon
|
||||
And "My forum name" activity in social activities block should have "Make unavailable" editing icon
|
||||
# Make sure that "Visible" dropdown in the edit menu has three options.
|
||||
And I open "My forum name" actions menu in social activities block
|
||||
And I click on "Edit settings" "link" in the "My forum name" activity in social activities block
|
||||
And I expand all fieldsets
|
||||
And the "Visible" select box should contain "Show"
|
||||
And the "Visible" select box should contain "Hidden from students"
|
||||
And the "Visible" select box should not contain "Hide"
|
||||
And the field "Visible" matches value "Available but not displayed on course page"
|
||||
And I press "Save and return to course"
|
||||
And "My forum name" activity in social activities block should be available but hidden from course page
|
||||
And I turn editing mode off
|
||||
And "My forum name" activity in social activities block should be available but hidden from course page
|
||||
And I log out
|
||||
# Student will not see the module on the course page but can access it from other reports and blocks:
|
||||
And I log in as "student1"
|
||||
And I follow "Course 1"
|
||||
And I should not see "My forum name" in the "Social activities" "block"
|
||||
And I click on "My forum name" "link" in the "Recent activity" "block"
|
||||
And I should see "My forum name" in the ".breadcrumb" "css_element"
|
||||
And I log out
|
||||
|
||||
@@ -42,7 +42,8 @@ Feature: Restrict activity availability through date conditions
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
Then I should see "Available from 31 December 2037"
|
||||
And "Test assignment 1" activity should be hidden
|
||||
And "Test assignment 1" activity should be dimmed
|
||||
And "Test assignment 1" "link" should not exist
|
||||
And I log out
|
||||
|
||||
@javascript
|
||||
|
||||
@@ -44,7 +44,8 @@ Feature: Restrict activity availability through grade conditions
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
Then I should see "Not available unless: You achieve a required score in Grade assignment"
|
||||
And "Test page name" activity should be hidden
|
||||
And "Test page name" activity should be dimmed
|
||||
And "Test page name" "link" should not exist
|
||||
And I follow "Grade assignment"
|
||||
And I press "Add submission"
|
||||
And I set the following fields to these values:
|
||||
|
||||
@@ -25,35 +25,62 @@ Feature: Toggle activities visibility from the course page
|
||||
| Description | Test forum description |
|
||||
| Visible | Show |
|
||||
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
|
||||
And "Test forum name" actions menu should not have "Make unavailable" item
|
||||
And I click on "Hide" "link" in the "Test forum name" activity
|
||||
Then "Test forum name" activity should be hidden
|
||||
And "Test forum name" activity should be hidden
|
||||
And I open "Test forum name" actions menu
|
||||
And "Test forum name" actions menu should not have "Hide" item
|
||||
# Stealth behaviour is not available by default:
|
||||
And "Test forum name" actions menu should not have "Make available" item
|
||||
And "Test forum name" actions menu should not have "Make unavailable" item
|
||||
And I click on "Show" "link" in the "Test forum name" activity
|
||||
And "Test forum name" activity should be visible
|
||||
And I open "Test forum name" actions menu
|
||||
And "Test forum name" actions menu should not have "Show" item
|
||||
And "Test forum name" actions menu should not have "Make available" item
|
||||
And "Test forum name" actions menu should not have "Make unavailable" item
|
||||
And I click on "Hide" "link" in the "Test forum name" activity
|
||||
And "Test forum name" activity should be hidden
|
||||
And I reload the page
|
||||
And "Test forum name" activity should be hidden
|
||||
# Make sure that "Visible" dropdown in the edit menu has two options: Show/Hide.
|
||||
And I open "Test forum name" actions menu
|
||||
And I click on "Edit settings" "link" in the "Test forum name" activity
|
||||
And I expand all fieldsets
|
||||
And the "Visible" select box should not contain "Hidden from students"
|
||||
And the "Visible" select box should not contain "Available but not displayed on course page"
|
||||
And the "Visible" select box should contain "Show"
|
||||
And the field "Visible" matches value "Hide"
|
||||
And I press "Save and return to course"
|
||||
And "Test forum name" activity should be hidden
|
||||
And I turn editing mode off
|
||||
And "Test forum name" activity should be hidden
|
||||
And I log out
|
||||
# Student should not see this activity.
|
||||
And I log in as "student1"
|
||||
And I follow "Course 1"
|
||||
And "Test forum name" activity should be hidden
|
||||
And I should not see "Test forum name"
|
||||
And I log out
|
||||
|
||||
@javascript
|
||||
Scenario: Activities can be shown and hidden inside a hidden section
|
||||
Scenario: Activities can be made available and unavailable inside a hidden section
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format | numsections |
|
||||
| Course 1 | C1 | topics | 2 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I turn 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 |
|
||||
@@ -61,11 +88,39 @@ Feature: Toggle activities visibility from the course page
|
||||
When I hide section "2"
|
||||
Then "Test forum name" activity should be hidden
|
||||
And I open "Test forum name" actions menu
|
||||
And I click on "Show" "link" in the "Test forum name" activity
|
||||
And "Test forum name" activity should be visible
|
||||
And "Test forum name" actions menu should not have "Show" item
|
||||
And "Test forum name" actions menu should not have "Hide" item
|
||||
And "Test forum name" actions menu should not have "Make unavailable" item
|
||||
And I click on "Make available" "link" in the "Test forum name" activity
|
||||
And "Test forum name" activity should be available but hidden from course page
|
||||
And I open "Test forum name" actions menu
|
||||
And I click on "Hide" "link" in the "Test forum name" activity
|
||||
And "Test forum name" actions menu should not have "Show" item
|
||||
And "Test forum name" actions menu should not have "Hide" item
|
||||
And "Test forum name" actions menu should not have "Make available" item
|
||||
And I click on "Make unavailable" "link" in the "Test forum name" activity
|
||||
And "Test forum name" activity should be hidden
|
||||
# Make sure that "Visible" dropdown in the edit menu has three options.
|
||||
And I open "Test forum name" actions menu
|
||||
And I click on "Edit settings" "link" in the "Test forum name" activity
|
||||
And I expand all fieldsets
|
||||
And the "Visible" select box should contain "Hidden from students"
|
||||
And the "Visible" select box should contain "Available but not displayed on course page"
|
||||
And the "Visible" select box should not contain "Hide"
|
||||
And the "Visible" select box should not contain "Show"
|
||||
And I set the field "Visible" to "Available but not displayed on course page"
|
||||
And I press "Save and return to course"
|
||||
And "Test forum name" activity should be available but hidden from course page
|
||||
And I turn editing mode off
|
||||
And "Test forum name" activity should be available but hidden from course page
|
||||
And I log out
|
||||
# Student will not see the module on the course page but can access it from other reports and blocks:
|
||||
And I log in as "student1"
|
||||
And I follow "Course 1"
|
||||
And "Test forum name" activity should be hidden
|
||||
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 shown and hidden inside an orphaned section
|
||||
@@ -88,8 +143,74 @@ Feature: Toggle activities visibility from the course page
|
||||
When I click on ".reduce-sections" "css_element"
|
||||
Then "Test forum name" activity should be visible
|
||||
And I open "Test forum name" actions menu
|
||||
And "Test forum name" actions menu should not have "Show" item
|
||||
And "Test forum name" actions menu should not have "Make available" item
|
||||
And "Test forum name" actions menu should not have "Make unavailable" item
|
||||
And I click on "Hide" "link" in the "Test forum name" activity
|
||||
And "Test forum name" activity should be hidden
|
||||
And I open "Test forum name" actions menu
|
||||
And "Test forum name" actions menu should not have "Hide" item
|
||||
And "Test forum name" actions menu should not have "Make available" item
|
||||
And "Test forum name" actions menu should not have "Make unavailable" item
|
||||
And I click on "Show" "link" in the "Test forum name" activity
|
||||
And "Test forum name" activity should be visible
|
||||
|
||||
@javascript
|
||||
Scenario: Activities can be made available but not visible on a course page
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format | numsections |
|
||||
| Course 1 | C1 | topics | 2 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I set the following administration settings values:
|
||||
| allowstealth | 1 |
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I add the "Recent activity" block
|
||||
And I add a "Assignment" to section "2" and I fill the form with:
|
||||
| Assignment name | Test assignment name |
|
||||
| Description | Test assignment description |
|
||||
| Visible | Show |
|
||||
When I open "Test assignment name" actions menu
|
||||
Then "Test assignment name" actions menu should not have "Show" item
|
||||
And "Test assignment name" actions menu should have "Hide" item
|
||||
And "Test assignment name" actions menu should not have "Make available" item
|
||||
And "Test assignment name" actions menu should not have "Make unavailable" item
|
||||
And I click on "Hide" "link" in the "Test assignment name" activity
|
||||
And "Test assignment name" activity should be hidden
|
||||
And I open "Test assignment name" actions menu
|
||||
And "Test assignment name" actions menu should have "Show" item
|
||||
And "Test assignment name" actions menu should not have "Hide" item
|
||||
And "Test assignment name" actions menu should not have "Make unavailable" item
|
||||
And I click on "Make available" "link" in the "Test assignment name" activity
|
||||
And "Test assignment name" activity should be available but hidden from course page
|
||||
# Make sure that "Visible" dropdown in the edit menu has three options.
|
||||
And I open "Test assignment name" actions menu
|
||||
And I click on "Edit settings" "link" in the "Test assignment name" activity
|
||||
And I expand all fieldsets
|
||||
And the "Visible" select box should contain "Show"
|
||||
And the "Visible" select box should contain "Hidden from students"
|
||||
And the "Visible" select box should not contain "Hide"
|
||||
And the field "Visible" matches value "Available but not displayed on course page"
|
||||
And I press "Save and return to course"
|
||||
And "Test assignment name" activity should be available but hidden from course page
|
||||
And I turn editing mode off
|
||||
And "Test assignment name" activity should be available but hidden from course page
|
||||
And I log out
|
||||
# Student will not see the module on the course page but can access it from other reports and blocks:
|
||||
And I log in as "student1"
|
||||
And I follow "Course 1"
|
||||
And "Test assignment name" activity should be hidden
|
||||
And I click on "Test assignment name" "link" in the "Recent activity" "block"
|
||||
And I should see "Test assignment name"
|
||||
And I should see "Submission status"
|
||||
And I log out
|
||||
|
||||
@@ -623,9 +623,67 @@ class behat_course extends behat_base {
|
||||
// All ok.
|
||||
}
|
||||
|
||||
// The 'Hide' button should be available.
|
||||
$nohideexception = new ExpectationException('"' . $activityname . '" don\'t have a "' . get_string('hide') . '" icon', $this->getSession());
|
||||
$this->find('named_partial', array('link', get_string('hide')), $nohideexception, $activitynode);
|
||||
// Additional check if this is a teacher in editing mode.
|
||||
if ($this->is_editing_on()) {
|
||||
// The 'Hide' button should be available.
|
||||
$nohideexception = new ExpectationException('"' . $activityname . '" doesn\'t have a "' .
|
||||
get_string('hide') . '" icon', $this->getSession());
|
||||
$this->find('named_partial', array('link', get_string('hide')), $nohideexception, $activitynode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the specified activity is visible. You need to be in the course page.
|
||||
* It can be used being logged as a student and as a teacher on editing mode.
|
||||
*
|
||||
* @Then /^"(?P<activity_or_resource_string>(?:[^"]|\\")*)" activity should be available but hidden from course page$/
|
||||
* @param string $activityname
|
||||
* @throws ExpectationException
|
||||
*/
|
||||
public function activity_should_be_available_but_hidden_from_course_page($activityname) {
|
||||
|
||||
if ($this->is_course_editor()) {
|
||||
|
||||
// The activity must exists and be visible.
|
||||
$activitynode = $this->get_activity_node($activityname);
|
||||
|
||||
// The activity should not be dimmed.
|
||||
try {
|
||||
$xpath = "/descendant-or-self::a[contains(concat(' ', normalize-space(@class), ' '), ' dimmed ')] | " .
|
||||
"/descendant-or-self::div[contains(concat(' ', normalize-space(@class), ' '), ' dimmed_text ')]";
|
||||
$this->find('xpath', $xpath, false, $activitynode);
|
||||
throw new ExpectationException('"' . $activityname . '" is hidden', $this->getSession());
|
||||
} catch (ElementNotFoundException $e) {
|
||||
// All ok.
|
||||
}
|
||||
|
||||
// Should has "stealth" class.
|
||||
$exception = new ExpectationException('"' . $activityname . '" does not have CSS class "stealth"', $this->getSession());
|
||||
$xpath = "/descendant-or-self::a[contains(concat(' ', normalize-space(@class), ' '), ' stealth ')]";
|
||||
$this->find('xpath', $xpath, $exception, $activitynode);
|
||||
|
||||
// Additional check if this is a teacher in editing mode.
|
||||
if ($this->is_editing_on()) {
|
||||
// Also has either 'Hide' or 'Make unavailable' edit control.
|
||||
$nohideexception = new ExpectationException('"' . $activityname . '" has neither "' . get_string('hide') .
|
||||
'" nor "' . get_string('makeunavailable') . '" icons', $this->getSession());
|
||||
try {
|
||||
$this->find('named_partial', array('link', get_string('hide')), false, $activitynode);
|
||||
} catch (ElementNotFoundException $e) {
|
||||
$this->find('named_partial', array('link', get_string('makeunavailable')), $nohideexception, $activitynode);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// Student should not see the activity at all.
|
||||
try {
|
||||
$this->get_activity_node($activityname);
|
||||
throw new ExpectationException('The "' . $activityname . '" should not appear', $this->getSession());
|
||||
} catch (ElementNotFoundException $e) {
|
||||
// This is good, the activity should not be there.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -649,15 +707,23 @@ class behat_course extends behat_base {
|
||||
"/descendant-or-self::div[contains(concat(' ', normalize-space(@class), ' '), ' dimmed_text ')]";
|
||||
$this->find('xpath', $xpath, $exception, $activitynode);
|
||||
|
||||
// Also 'Show' icon.
|
||||
$noshowexception = new ExpectationException('"' . $activityname . '" don\'t have a "' . get_string('show') . '" icon', $this->getSession());
|
||||
$this->find('named_partial', array('link', get_string('show')), $noshowexception, $activitynode);
|
||||
// Additional check if this is a teacher in editing mode.
|
||||
if ($this->is_editing_on()) {
|
||||
// Also has either 'Show' or 'Make available' edit control.
|
||||
$noshowexception = new ExpectationException('"' . $activityname . '" has neither "' . get_string('show') .
|
||||
'" nor "' . get_string('makeavailable') . '" icons', $this->getSession());
|
||||
try {
|
||||
$this->find('named_partial', array('link', get_string('show')), false, $activitynode);
|
||||
} catch (ElementNotFoundException $e) {
|
||||
$this->find('named_partial', array('link', get_string('makeavailable')), $noshowexception, $activitynode);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// It should not exist at all.
|
||||
try {
|
||||
$this->find_link($activityname);
|
||||
$this->get_activity_node($activityname);
|
||||
throw new ExpectationException('The "' . $activityname . '" should not appear', $this->getSession());
|
||||
} catch (ElementNotFoundException $e) {
|
||||
// This is good, the activity should not be there.
|
||||
@@ -666,6 +732,26 @@ class behat_course extends behat_base {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the specified activity is dimmed. You need to be in the course page.
|
||||
*
|
||||
* @Then /^"(?P<activity_or_resource_string>(?:[^"]|\\")*)" activity should be dimmed$/
|
||||
* @param string $activityname
|
||||
* @throws ExpectationException
|
||||
*/
|
||||
public function activity_should_be_dimmed($activityname) {
|
||||
|
||||
// The activity should exist.
|
||||
$activitynode = $this->get_activity_node($activityname);
|
||||
|
||||
// Should be hidden.
|
||||
$exception = new ExpectationException('"' . $activityname . '" is not dimmed', $this->getSession());
|
||||
$xpath = "/descendant-or-self::a[contains(concat(' ', normalize-space(@class), ' '), ' dimmed ')] | ".
|
||||
"/descendant-or-self::div[contains(concat(' ', normalize-space(@class), ' '), ' dimmed_text ')]";
|
||||
$this->find('xpath', $xpath, $exception, $activitynode);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the specified activity to the first slot of a section. This step is experimental when using it in Javascript tests. Editing mode should be on.
|
||||
*
|
||||
@@ -803,6 +889,42 @@ class behat_course extends behat_base {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the specified activity's action menu contains an item.
|
||||
*
|
||||
* @Then /^"(?P<activity_name_string>(?:[^"]|\\")*)" actions menu should have "(?P<menu_item_string>(?:[^"]|\\")*)" item$/
|
||||
* @throws DriverException The step is not available when Javascript is disabled
|
||||
* @param string $activityname
|
||||
* @param string $menuitem
|
||||
*/
|
||||
public function actions_menu_should_have_item($activityname, $menuitem) {
|
||||
$activitynode = $this->get_activity_node($activityname);
|
||||
|
||||
$notfoundexception = new ExpectationException('"' . $activityname . '" doesn\'t have a "' .
|
||||
$menuitem . '" item', $this->getSession());
|
||||
$this->find('named_partial', array('link', $menuitem), $notfoundexception, $activitynode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the specified activity's action menu does not contains an item.
|
||||
*
|
||||
* @Then /^"(?P<activity_name_string>(?:[^"]|\\")*)" actions menu should not have "(?P<menu_item_string>(?:[^"]|\\")*)" item$/
|
||||
* @throws DriverException The step is not available when Javascript is disabled
|
||||
* @param string $activityname
|
||||
* @param string $menuitem
|
||||
*/
|
||||
public function actions_menu_should_not_have_item($activityname, $menuitem) {
|
||||
$activitynode = $this->get_activity_node($activityname);
|
||||
|
||||
try {
|
||||
$this->find('named_partial', array('link', $menuitem), false, $activitynode);
|
||||
throw new ExpectationException('"' . $activityname . '" has a "' . $menuitem .
|
||||
'" item when it should not', $this->getSession());
|
||||
} catch (ElementNotFoundException $e) {
|
||||
// This is good, the menu item should not be there.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Indents to the right the activity or resource specified by it's name. Editing mode should be on.
|
||||
*
|
||||
@@ -1159,6 +1281,15 @@ class behat_course extends behat_base {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the user can edit the course contents and the editing mode is on.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function is_editing_on() {
|
||||
return $this->getSession()->getPage()->findButton(get_string('turneditingoff')) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the id of the category with the given idnumber.
|
||||
*
|
||||
|
||||
@@ -55,6 +55,13 @@ class behat_action_menu extends behat_base {
|
||||
}
|
||||
// Gets the node based on the requested selector type and locator.
|
||||
$node = $this->get_node_in_container("css_element", "[role=menuitem][aria-haspopup=true]", $selectortype, $element);
|
||||
|
||||
// Check if it is not already opened.
|
||||
$menunode = $this->find('css', '[aria-labelledby='.$node->getAttribute('id').']');
|
||||
if ($menunode->getAttribute('aria-hidden') === 'false') {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->ensure_node_is_visible($node);
|
||||
$node->click();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@mod @mod_label
|
||||
|
||||
Feature: Check label visibility works
|
||||
In order to check label visibility works
|
||||
As a teacher
|
||||
@@ -9,29 +10,89 @@ Feature: Check label visibility works
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Test | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher | Teacher | Frist | teacher1@example.com |
|
||||
| student | Student | First | student1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| admin | C1 | editingteacher |
|
||||
Given I log in as "admin"
|
||||
| teacher | C1 | editingteacher |
|
||||
| student | C1 | student |
|
||||
Given I log in as "teacher"
|
||||
And I follow "Test"
|
||||
And I turn editing mode on
|
||||
When I add a "label" to section "1" and I fill the form with:
|
||||
| Label text | Swanky label |
|
||||
| Visible | Hide |
|
||||
Then "Swanky label" activity should be hidden
|
||||
And I turn editing mode off
|
||||
And "Swanky label" activity should be hidden
|
||||
And I log out
|
||||
And I log in as "student"
|
||||
And I follow "Test"
|
||||
And I should not see "Swanky label"
|
||||
And I log out
|
||||
|
||||
@javascript
|
||||
Scenario: Visible label activity should be shown as visible.
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Test | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher | Teacher | Frist | teacher1@example.com |
|
||||
| student | Student | First | student1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| admin | C1 | editingteacher |
|
||||
Given I log in as "admin"
|
||||
| teacher | C1 | editingteacher |
|
||||
| student | C1 | student |
|
||||
Given I log in as "teacher"
|
||||
And I follow "Test"
|
||||
And I turn editing mode on
|
||||
When I add a "label" to section "1" and I fill the form with:
|
||||
| Label text | Swanky label |
|
||||
| Visible | Show |
|
||||
Then "Swanky label" activity should be visible
|
||||
And I log out
|
||||
And I log in as "student"
|
||||
And I follow "Test"
|
||||
And "Swanky label" activity should be visible
|
||||
And I log out
|
||||
|
||||
@javascript
|
||||
Scenario: Teacher can not show label inside the hidden section
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Test | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher | Teacher | Frist | teacher1@example.com |
|
||||
| student | Student | First | student1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher | C1 | editingteacher |
|
||||
| student | C1 | student |
|
||||
Given I log in as "teacher"
|
||||
And I follow "Test"
|
||||
And I turn editing mode on
|
||||
When I add a "label" to section "1" and I fill the form with:
|
||||
| Label text | Swanky label |
|
||||
| Visible | Show |
|
||||
And I hide section "1"
|
||||
Then "Swanky label" activity should be dimmed
|
||||
And I open "Swanky label" actions menu
|
||||
And "Swanky label" actions menu should not have "Show" item
|
||||
And "Swanky label" actions menu should not have "Hide" item
|
||||
And "Swanky label" actions menu should not have "Make available" item
|
||||
And "Swanky label" actions menu should not have "Make unavailable" item
|
||||
And I click on "Edit settings" "link" in the "Swanky label" activity
|
||||
And I expand all fieldsets
|
||||
And the "Visible" select box should contain "Hidden from students"
|
||||
And the "Visible" select box should not contain "Available but not displayed on course page"
|
||||
And the "Visible" select box should not contain "Hide"
|
||||
And the "Visible" select box should not contain "Show"
|
||||
And I log out
|
||||
And I log in as "student"
|
||||
And I follow "Test"
|
||||
And I should not see "Swanky label"
|
||||
And I log out
|
||||
|
||||
@@ -40,6 +40,12 @@ class behat_theme_boost_behat_action_menu extends behat_action_menu {
|
||||
public function i_open_the_action_menu_in($element, $selectortype) {
|
||||
// Gets the node based on the requested selector type and locator.
|
||||
$node = $this->get_node_in_container("css_element", "[role=button][aria-haspopup=true]", $selectortype, $element);
|
||||
|
||||
// Check if it is not already opened.
|
||||
if ($node->getAttribute('aria-expanded') === 'true') {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->ensure_node_is_visible($node);
|
||||
$node->click();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user