Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)

Classes

class  behat_course
 Behat course-related steps definitions. More...
 

Functions

 actions_menu_should_be_open ($activityname)
 Checks that the specified activity's action menu is open.
 
 actions_menu_should_have_item ($activityname, $menuitem)
 Checks that the specified activity's action menu contains an item.
 
 actions_menu_should_not_have_item ($activityname, $menuitem)
 Checks that the specified activity's action menu does not contains an item.
 
 activity_date_in_activity_should_contain_text (string $activityname, string $text)
 Checks the presence of the given text in the activity's displayed dates.
 
 activity_dates_information_in_activity_should_exist (string $activityname)
 Checks the presence of activity dates information in the activity information output component.
 
 activity_dates_information_in_activity_should_not_exist (string $activityname)
 Checks the absence of activity dates information in the activity information output component.
 
 activity_should_be_available_but_hidden_from_course_page ($activityname)
 Checks that the specified activity is visible.
 
 activity_should_be_hidden ($activityname)
 Checks that the specified activity is hidden.
 
 activity_should_be_visible ($activityname)
 Checks that the specified activity is visible.
 
 category_actions_menu_should_have_item ($name, $menuitem)
 Checks that the specified category actions menu contains an item.
 
 category_actions_menu_should_not_have_item ($name, $menuitem)
 Checks that the specified category actions menu does not contain an item.
 
 category_in_management_listing_should_be_dimmed ($idnumber)
 Checks that a category within the management interface is dimmed.
 
 category_in_management_listing_should_be_visible ($idnumber)
 Checks that a category within the management interface is visible.
 
 course_in_management_listing_should_be_dimmed ($idnumber)
 Checks that a course within the management interface is dimmed.
 
 course_in_management_listing_should_be_visible ($idnumber)
 Checks that a course within the management interface is visible.
 
 get_activity_action_menu_node ($activityname)
 Returns the DOM node of the activity action menu.
 
 get_activity_element ($element, $selectortype, $activityname)
 Clicks on the specified element inside the activity container.
 
 get_activity_name ($activitynode)
 Gets the activity instance name from the activity node.
 
 get_activity_node ($activityname)
 Returns the DOM node of the activity from .
 
 get_course_format ()
 Gets the current course format.
 
 get_management_category_listing_node_by_idnumber ($idnumber)
 Returns the category node from within the listing on the management page.
 
 get_management_category_listing_node_by_name ($name, $link=false)
 Returns a category node from within the management interface.
 
 get_management_course_listing_node_by_idnumber ($idnumber)
 Returns the course node from within the listing on the management page.
 
 get_management_course_listing_node_by_name ($name, $link=false)
 Returns a course node from within the management interface.
 
 get_section_activities ($sectionxpath)
 Gets the section's activites DOM nodes.
 
 hide_section_link_exists ($sectionnumber)
 Returns the hide section icon link if it exists or throws exception.
 
 i_add_to_course_section (string $activity, string $coursefullname, string $sectionnum)
 Open a add activity form page.
 
 i_add_to_course_section_and_i_fill_the_form_with ($activity, $coursefullname, $section, TableNode $data)
 Adds the selected activity/resource filling the form data with the specified field/value pairs.
 
 i_add_to_section_using_the_activity_chooser ($activityname, $sectionnum)
 Opens the activity chooser and opens the activity/resource link form page.
 
 i_change_activity_name_to ($activityname, $newactivityname)
 Edits the activity name through the edit activity; this step only works with Javascript enabled.
 
 i_click_on_action_for_item_in_management_category_listing ($action, $name)
 Locates a category in the course category management interface and then triggers an action for it.
 
 i_click_on_action_for_item_in_management_course_listing ($action, $name)
 Locates a course in the course category management interface and then triggers an action for it.
 
 i_click_on_category_in_the_management_category_listing ($name)
 Clicks on a category in the management interface.
 
 i_click_on_category_in_the_management_interface ($name)
 Clicks on a category in the management interface.
 
 i_click_on_course_in_the_management_interface ($name)
 Clicks on a course in the management interface.
 
 i_click_on_in_the_activity ($element, $selectortype, $activityname)
 Clicks on the specified element of the activity.
 
 i_click_to_expand_category_in_the_management_interface ($idnumber)
 Click to expand a category revealing its sub categories within the management UI.
 
 i_click_to_move_category_by_one ($idnumber, $direction)
 Moves a category displayed in the management interface up or down one place.
 
 i_click_to_move_course_by_one ($idnumber, $direction)
 Moves a course displayed in the management interface up or down one place.
 
 i_close_actions_menu ($activityname)
 Closes an activity actions menu if it is not already closed.
 
 i_delete_activity ($activityname)
 Deletes the activity or resource specified by it's name.
 
 i_delete_section ($sectionnumber)
 Deletes course section.
 
 i_duplicate_activity ($activityname)
 Duplicates the activity or resource specified by it's name.
 
 i_duplicate_activity_editing_the_new_copy_with ($activityname, TableNode $data)
 Duplicates the activity or resource and modifies the new activity with the provided data.
 
 i_edit_the_section ($sectionnumber)
 Go to editing section page for specified section number.
 
 i_edit_the_section_and_i_fill_the_form_with ($sectionnumber, TableNode $data)
 Edit specified section and fill the form data with the specified field/value pairs.
 
 i_hide_section ($sectionnumber)
 Hides the specified visible section.
 
 i_indent_left_activity ($activityname)
 Indents to the left the activity or resource specified by it's name.
 
 i_indent_right_activity ($activityname)
 Indents to the right the activity or resource specified by it's name.
 
 i_move_activity_to_section ($activityname, $sectionnumber)
 Moves the specified activity to the first slot of a section.
 
 i_move_activity_to_section_yui ($activityname, $sectionnumber)
 Moves the specified activity to the first slot of a section using the YUI course format.
 
 i_move_category_to_top_level_in_the_management_interface ($name)
 Move selected categories to top level in the management interface.
 
 i_move_down_section ($sectionnumber)
 Moves down the specified section, this step only works with Javascript disabled.
 
 i_move_up_section ($sectionnumber)
 Moves up the specified section, this step only works with Javascript disabled.
 
 i_navigate_to_course_participants ()
 Go to the course participants.
 
 i_open_actions_menu ($activityname)
 Opens an activity actions menu if it is not already opened.
 
 i_open_section_edit_menu ($sectionnumber)
 Opens a section edit menu if it is not already opened.
 
 i_open_the_action_menu_for_item_in_management_category_listing ($name)
 Locates a category in the course category management interface and then opens action menu for it.
 
 i_open_the_activity_chooser ()
 Open the activity chooser in a course.
 
 i_select_category_in_the_management_interface ($name)
 Clicks on a category checkbox in the management interface, if not checked.
 
 i_select_course_in_the_management_interface ($name)
 Clicks course checkbox in the management interface, if not checked.
 
 i_should_not_see_category_as_subcategory_of_in_the_management_interface ($subcatidnumber, $catidnumber)
 Checks that a category is not a subcategory of specific category.
 
 i_should_not_see_teacher_after ($fteacher, $pteacher)
 Check that one teacher oes not appears after another in the course contacts.
 
 i_should_see_category_as_subcategory_of_in_the_management_interface ($subcatidnumber, $catidnumber)
 Checks that a category is a subcategory of specific category.
 
 i_should_see_category_listing_before ($preceedingcategory, $followingcategory)
 Check that one category appears before another in the course category management listings.
 
 i_should_see_course_listing_before ($preceedingcourse, $followingcourse)
 Check that one course appears before another in the course category management listings.
 
 i_should_see_teacher_before ($pteacher, $fteacher)
 Check that one teacher appears before another in the course contacts.
 
 i_should_see_the_courses_management_page ($mode)
 Checks that we are on the course management page that we expect to be on and that no course has been selected.
 
 i_should_see_the_courses_management_page_with_a_course_selected ($mode)
 Checks that we are on the course management page that we expect to be on and that a course has been selected.
 
 i_show_section ($sectionnumber)
 Shows the specified hidden section.
 
 i_toggle_category_children_visibility_in_frontpage ($categoryname)
 Clicks to expand or collapse a category displayed on the frontpage.
 
 i_toggle_visibility_of_category_in_management_listing ($idnumber)
 Toggles the visibility of a category in the management UI.
 
 i_toggle_visibility_of_course_in_management_listing ($idnumber)
 Toggles the visibility of a course in the management UI.
 
 i_turn_section_highlighting_off ($sectionnumber)
 Turns course section highlighting off.
 
 i_turn_section_highlighting_on ($sectionnumber)
 Turns course section highlighting on.
 
 i_unselect_category_in_the_management_interface ($name)
 Clicks on a category checkbox in the management interface, if checked.
 
 i_unselect_course_in_the_management_interface ($name)
 Clicks course checkbox in the management interface, if checked.
 
 i_wait_until_section_is_available ($sectionnumber)
 Waits until the section is available to interact with it.
 
 is_course_editor ()
 Returns whether the user can edit the course contents or not.
 
 is_editing_on ()
 Returns whether the user can edit the course contents and the editing mode is on.
 
 label_should_be_hidden ($activityname)
 Checks that the specified label is hidden from students.
 
 listing_is_highlighted ($self, $selector)
 Used by spin to determine the callback has been highlighted.
 
 section_activities_should_be_hidden ($sectionnumber)
 Checks that all actiities in the specified section are hidden.
 
 section_exists ($sectionnumber)
 Checks if the course section exists.
 
 section_should_be_hidden ($sectionnumber)
 Checks that the specified section is visible.
 
 section_should_be_highlighted ($sectionnumber)
 Checks if the specified course section hightlighting is turned on.
 
 section_should_be_visible ($sectionnumber)
 Checks that the specified section is visible.
 
 section_should_not_be_highlighted ($sectionnumber)
 Checks if the specified course section highlighting is turned off.
 
 show_section_link_exists ($sectionnumber)
 Returns the show section icon or throws an exception.
 
 user_clicks_on_management_listing_action ($listingtype, $listingnode, $action)
 Finds the node to use for a management listitem action and clicks it.
 
 user_moves_listing_by_one ($listingtype, $listingnode, $direction, $highlight=true)
 Moves a course or category listing within the management interface up or down by one.
 

Detailed Description

Function Documentation

◆ actions_menu_should_be_open()

actions_menu_should_be_open ( $activityname)

Checks that the specified activity's action menu is open.

@Then /^"(?P<activity_name_string>(?:[^"]|::")*)" actions menu should be open$/

Exceptions
DriverExceptionThe step is not available when Javascript is disabled
Parameters
string$activityname

◆ actions_menu_should_have_item()

actions_menu_should_have_item ( $activityname,
$menuitem )

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$/

Exceptions
DriverExceptionThe step is not available when Javascript is disabled
Parameters
string$activityname
string$menuitem

◆ actions_menu_should_not_have_item()

actions_menu_should_not_have_item ( $activityname,
$menuitem )

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$/

Exceptions
DriverExceptionThe step is not available when Javascript is disabled
Parameters
string$activityname
string$menuitem

◆ activity_date_in_activity_should_contain_text()

activity_date_in_activity_should_contain_text ( string $activityname,
string $text )

Checks the presence of the given text in the activity's displayed dates.

@Given /^the activity date in "(?P<activityname>(?:[^"]|::")*)" should contain "(?P<text>(?:[^"]|")*)"$/

Parameters
string$activitynameThe activity name.
string$textThe text to be searched in the activity date.

◆ activity_dates_information_in_activity_should_exist()

activity_dates_information_in_activity_should_exist ( string $activityname)

Checks the presence of activity dates information in the activity information output component.

@Given /^the activity date information in "(?P<activityname>(?:[^"]|::")*)" should exist$/

Parameters
string$activitynameThe activity name.

◆ activity_dates_information_in_activity_should_not_exist()

activity_dates_information_in_activity_should_not_exist ( string $activityname)

Checks the absence of activity dates information in the activity information output component.

@Given /^the activity date information in "(?P<activityname>(?:[^"]|::")*)" should not exist$/

Parameters
string$activitynameThe activity name.

◆ activity_should_be_available_but_hidden_from_course_page()

activity_should_be_available_but_hidden_from_course_page ( $activityname)

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$/

Parameters
string$activityname
Exceptions
ExpectationException

◆ activity_should_be_hidden()

activity_should_be_hidden ( $activityname)

Checks that the specified activity is hidden.

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 hidden$/

Parameters
string$activityname
Exceptions
ExpectationException

◆ activity_should_be_visible()

activity_should_be_visible ( $activityname)

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 visible$/

Parameters
string$activityname
Exceptions
ExpectationException

◆ category_actions_menu_should_have_item()

category_actions_menu_should_have_item ( $name,
$menuitem )

Checks that the specified category actions menu contains an item.

@Then /^"(?P<name_string>(?:[^"]|::")*)" category actions menu should have "(?P<menu_item_string>(?:[^"]|")*)" item$/

Parameters
string$name
string$menuitem
Exceptions
Behat\Mink\Exception\ExpectationException

◆ category_actions_menu_should_not_have_item()

category_actions_menu_should_not_have_item ( $name,
$menuitem )

Checks that the specified category actions menu does not contain an item.

@Then /^"(?P<name_string>(?:[^"]|::")*)" category actions menu should not have "(?P<menu_item_string>(?:[^"]|")*)" item$/

Parameters
string$name
string$menuitem
Exceptions
Behat\Mink\Exception\ExpectationException

◆ category_in_management_listing_should_be_dimmed()

category_in_management_listing_should_be_dimmed ( $idnumber)

Checks that a category within the management interface is dimmed.

@Given /^category in management listing should be dimmed "(?P<idnumber_string>(?:[^"]|::")*)"$/

Parameters
string$idnumber

◆ category_in_management_listing_should_be_visible()

category_in_management_listing_should_be_visible ( $idnumber)

Checks that a category within the management interface is visible.

@Given /^category in management listing should be visible "(?P<idnumber_string>(?:[^"]|::")*)"$/

Parameters
string$idnumber

◆ course_in_management_listing_should_be_dimmed()

course_in_management_listing_should_be_dimmed ( $idnumber)

Checks that a course within the management interface is dimmed.

@Given /^course in management listing should be dimmed "(?P<idnumber_string>(?:[^"]|::")*)"$/

Parameters
string$idnumber

◆ course_in_management_listing_should_be_visible()

course_in_management_listing_should_be_visible ( $idnumber)

Checks that a course within the management interface is visible.

@Given /^course in management listing should be visible "(?P<idnumber_string>(?:[^"]|::")*)"$/

Parameters
string$idnumber

◆ get_activity_action_menu_node()

get_activity_action_menu_node ( $activityname)
protected

Returns the DOM node of the activity action menu.

Exceptions
ElementNotFoundExceptionThrown by behat_base\find
Parameters
string$activitynameThe activity name
Return values
Behat\Mink\Element\NodeElement

◆ get_activity_element()

get_activity_element ( $element,
$selectortype,
$activityname )
protected

Clicks on the specified element inside the activity container.

Exceptions
ElementNotFoundException
Parameters
string$element
string$selectortype
string$activityname
Return values
NodeElement

◆ get_activity_name()

get_activity_name ( $activitynode)
protected

Gets the activity instance name from the activity node.

Exceptions
ElementNotFoundException
Parameters
NodeElement$activitynode
Return values
string

◆ get_activity_node()

get_activity_node ( $activityname)
protected

Returns the DOM node of the activity from .

Exceptions
ElementNotFoundExceptionThrown by behat_base\find
Parameters
string$activitynameThe activity name
Return values
NodeElement

◆ get_course_format()

get_course_format ( )
protected

Gets the current course format.

Exceptions
ExpectationExceptionIf we are not in the course view page.
Return values
stringThe course format in a frankenstyled name.

◆ get_management_category_listing_node_by_idnumber()

get_management_category_listing_node_by_idnumber ( $idnumber)
protected

Returns the category node from within the listing on the management page.

Parameters
string$idnumber
Return values
Behat\Mink\Element\NodeElement

◆ get_management_category_listing_node_by_name()

get_management_category_listing_node_by_name ( $name,
$link = false )
protected

Returns a category node from within the management interface.

Parameters
string$nameThe name of the category.
bool$linkIf set to true we'll resolve to the link rather than just the node.
Return values
Behat\Mink\Element\NodeElement

◆ get_management_course_listing_node_by_idnumber()

get_management_course_listing_node_by_idnumber ( $idnumber)
protected

Returns the course node from within the listing on the management page.

Parameters
string$idnumber
Return values
Behat\Mink\Element\NodeElement

◆ get_management_course_listing_node_by_name()

get_management_course_listing_node_by_name ( $name,
$link = false )
protected

Returns a course node from within the management interface.

Parameters
string$nameThe name of the course.
bool$linkIf set to true we'll resolve to the link rather than just the node.
Return values
Behat\Mink\Element\NodeElement

◆ get_section_activities()

get_section_activities ( $sectionxpath)
protected

Gets the section's activites DOM nodes.

Parameters
string$sectionxpath
Return values
arrayNodeElement instances

◆ hide_section_link_exists()

hide_section_link_exists ( $sectionnumber)
protected

Returns the hide section icon link if it exists or throws exception.

Exceptions
ElementNotFoundExceptionThrown by behat_base\find
Parameters
int$sectionnumber
Return values
NodeElement

◆ i_add_to_course_section()

i_add_to_course_section ( string $activity,
string $coursefullname,
string $sectionnum )

Open a add activity form page.

@Given I add a :activity activity to course :coursefullname section :sectionnum @Given I add an :activity activity to course :coursefullname section :sectionnum

Exceptions
coding_exception
Parameters
string$activityThe activity name.
string$coursefullnameThe course full name of the course.
string$sectionnumThe section number.

◆ i_add_to_course_section_and_i_fill_the_form_with()

i_add_to_course_section_and_i_fill_the_form_with ( $activity,
$coursefullname,
$section,
TableNode $data )

Adds the selected activity/resource filling the form data with the specified field/value pairs.

Sections 0 and 1 are also allowed on frontpage.

@Given I add a :activity activity to course :coursefullname section :sectionnum and I fill the form with: @Given I add an :activity activity to course :coursefullname section :sectionnum and I fill the form with:

Parameters
string$activityThe activity name
string$coursefullnameThe course full name of the course.
int$sectionThe section number
TableNode$dataThe activity field/value data

◆ i_add_to_section_using_the_activity_chooser()

i_add_to_section_using_the_activity_chooser ( $activityname,
$sectionnum )

Opens the activity chooser and opens the activity/resource link form page.

Sections 0 and 1 are also allowed on frontpage.

This step require javascript enabled and it is used mainly to click activities or resources by name, not by plugin name. Use the standard behat_course\i_add_to_course_section step instead unless the plugin create extra entries into the activity chooser (like LTI).

@Given I add a :activityname to section :sectionnum using the activity chooser @Given I add an :activityname to section :sectionnum using the activity chooser

Exceptions
ElementNotFoundExceptionThrown by behat_base\find
Parameters
string$activityname
int$sectionnum

◆ i_change_activity_name_to()

i_change_activity_name_to ( $activityname,
$newactivityname )

Edits the activity name through the edit activity; this step only works with Javascript enabled.

Editing mode should be on.

@Given /^I change "(?P<activity_name_string>(?:[^"]|::")*)" activity name to "(?P<new_name_string>(?:[^"]|")*)"$/

Exceptions
DriverExceptionStep not available when Javascript is disabled
Parameters
string$activityname
string$newactivityname

◆ i_click_on_action_for_item_in_management_category_listing()

i_click_on_action_for_item_in_management_category_listing ( $action,
$name )

Locates a category in the course category management interface and then triggers an action for it.

@Given /^I click on "(?P<action_string>(?:[^"]|::")*)" action for "(?P<name_string>(?:[^"]|")*)" in management category listing$/

Parameters
string$actionThe action to take. One of
string$nameThe name of the category as it is displayed in the management interface.

◆ i_click_on_action_for_item_in_management_course_listing()

i_click_on_action_for_item_in_management_course_listing ( $action,
$name )

Locates a course in the course category management interface and then triggers an action for it.

@Given /^I click on "(?P<action_string>(?:[^"]|::")*)" action for "(?P<name_string>(?:[^"]|")*)" in management course listing$/

Parameters
string$actionThe action to take. One of
string$nameThe name of the course as it is displayed in the management interface.

◆ i_click_on_category_in_the_management_category_listing()

i_click_on_category_in_the_management_category_listing ( $name)

Clicks on a category in the management interface.

@Given /^I click on "(?P<categoryname_string>(?:[^"]|::")*)" category in the management category listing$/

Parameters
string$nameThe name of the category to click.

◆ i_click_on_category_in_the_management_interface()

i_click_on_category_in_the_management_interface ( $name)

Clicks on a category in the management interface.

@Given /^I click on category "(?P<name_string>(?:[^"]|::")*)" in the management interface$/

Parameters
string$name

◆ i_click_on_course_in_the_management_interface()

i_click_on_course_in_the_management_interface ( $name)

Clicks on a course in the management interface.

@Given /^I click on course "(?P<name_string>(?:[^"]|::")*)" in the management interface$/

Parameters
string$name

◆ i_click_on_in_the_activity()

i_click_on_in_the_activity ( $element,
$selectortype,
$activityname )

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$/

Parameters
string$element
string$selectortype
string$activityname

◆ i_click_to_expand_category_in_the_management_interface()

i_click_to_expand_category_in_the_management_interface ( $idnumber)

Click to expand a category revealing its sub categories within the management UI.

@Given /^I click to expand category "(?P<idnumber_string>(?:[^"]|::")*)" in the management interface$/

Parameters
string$idnumber

◆ i_click_to_move_category_by_one()

i_click_to_move_category_by_one ( $idnumber,
$direction )

Moves a category displayed in the management interface up or down one place.

@Given /^I click to move category "(?P<idnumber_string>(?:[^"]|::")*)" (?P<direction>up|down) one$/

Parameters
string$idnumberThe category idnumber
string$directionThe direction to move in, either up or down

◆ i_click_to_move_course_by_one()

i_click_to_move_course_by_one ( $idnumber,
$direction )

Moves a course displayed in the management interface up or down one place.

@Given /^I click to move course "(?P<idnumber_string>(?:[^"]|::")*)" (?P<direction>up|down) one$/

Parameters
string$idnumberThe course idnumber
string$directionThe direction to move in, either up or down

◆ i_close_actions_menu()

i_close_actions_menu ( $activityname)

Closes an activity actions menu if it is not already closed.

@Given /^I close "(?P<activity_name_string>(?:[^"]|::")*)" actions menu$/

Exceptions
DriverExceptionThe step is not available when Javascript is disabled
Parameters
string$activityname

◆ i_delete_activity()

i_delete_activity ( $activityname)

Deletes the activity or resource specified by it's name.

This step is experimental when using it in Javascript tests. You should be in the course page with editing mode on.

@Given /^I delete "(?P<activity_name_string>(?:[^"]|::")*)" activity$/

Parameters
string$activityname

◆ i_delete_section()

i_delete_section ( $sectionnumber)

Deletes course section.

@Given /^I delete section "(?P<section_number>::d+)"$/

Parameters
int$sectionnumberThe section number

◆ i_duplicate_activity()

i_duplicate_activity ( $activityname)

Duplicates the activity or resource specified by it's name.

You should be in the course page with editing mode on.

@Given /^I duplicate "(?P<activity_name_string>(?:[^"]|::")*)" activity$/

Parameters
string$activityname

◆ i_duplicate_activity_editing_the_new_copy_with()

i_duplicate_activity_editing_the_new_copy_with ( $activityname,
TableNode $data )

Duplicates the activity or resource and modifies the new activity with the provided data.

You should be in the course page with editing mode on.

@Given /^I duplicate "(?P<activity_name_string>(?:[^"]|::")*)" activity editing the new copy with:$/

Parameters
string$activityname
TableNode$data

◆ i_edit_the_section()

i_edit_the_section ( $sectionnumber)

Go to editing section page for specified section number.

You need to be in the course page and on editing mode.

@Given /^I edit the section "(?P<section_number>::d+)"$/

Parameters
int$sectionnumber

◆ i_edit_the_section_and_i_fill_the_form_with()

i_edit_the_section_and_i_fill_the_form_with ( $sectionnumber,
TableNode $data )

Edit specified section and fill the form data with the specified field/value pairs.

@When /^I edit the section "(?P<section_number>::d+)" and I fill the form with:$/

Parameters
int$sectionnumberThe section number
TableNode$dataThe activity field/value data

◆ i_hide_section()

i_hide_section ( $sectionnumber)

Hides the specified visible section.

You need to be in the course page and on editing mode.

@Given /^I hide section "(?P<section_number>::d+)"$/

Parameters
int$sectionnumber

◆ i_indent_left_activity()

i_indent_left_activity ( $activityname)

Indents to the left the activity or resource specified by it's name.

Editing mode should be on.

@Given /^I indent left "(?P<activity_name_string>(?:[^"]|::")*)" activity$/

Parameters
string$activityname

◆ i_indent_right_activity()

i_indent_right_activity ( $activityname)

Indents to the right the activity or resource specified by it's name.

Editing mode should be on.

@Given /^I indent right "(?P<activity_name_string>(?:[^"]|::")*)" activity$/

Parameters
string$activityname

◆ i_move_activity_to_section()

i_move_activity_to_section ( $activityname,
$sectionnumber )

Moves the specified activity to the first slot of a section.

Editing mode should be on.

@Given /^I move "(?P<activity_name_string>(?:[^"]|::")*)" activity to section "(?P<section_number>\d+)"$/

Parameters
string$activitynameThe activity name
int$sectionnumberThe number of section

◆ i_move_activity_to_section_yui()

i_move_activity_to_section_yui ( $activityname,
$sectionnumber )

Moves the specified activity to the first slot of a section using the YUI course format.

This step is experimental when using it in Javascript tests. Editing mode should be on.

Parameters
string$activitynameThe activity name
int$sectionnumberThe number of section

◆ i_move_category_to_top_level_in_the_management_interface()

i_move_category_to_top_level_in_the_management_interface ( $name)

Move selected categories to top level in the management interface.

@Given /^I move category "(?P<name_string>(?:[^"]|::")*)" to top level in the management interface$/

Parameters
string$name

◆ i_move_down_section()

i_move_down_section ( $sectionnumber)

Moves down the specified section, this step only works with Javascript disabled.

Editing mode should be on.

@Given /^I move down section "(?P<section_number>::d+)"$/

Exceptions
DriverExceptionStep not available when Javascript is enabled
Parameters
int$sectionnumber

◆ i_move_up_section()

i_move_up_section ( $sectionnumber)

Moves up the specified section, this step only works with Javascript disabled.

Editing mode should be on.

@Given /^I move up section "(?P<section_number>::d+)"$/

Exceptions
DriverExceptionStep not available when Javascript is enabled
Parameters
int$sectionnumber

◆ i_navigate_to_course_participants()

i_navigate_to_course_participants ( )

Go to the course participants.

@Given /^I navigate to course participants$/

◆ i_open_actions_menu()

i_open_actions_menu ( $activityname)

Opens an activity actions menu if it is not already opened.

@Given /^I open "(?P<activity_name_string>(?:[^"]|::")*)" actions menu$/

Exceptions
DriverExceptionThe step is not available when Javascript is disabled
Parameters
string$activityname

◆ i_open_section_edit_menu()

i_open_section_edit_menu ( $sectionnumber)

Opens a section edit menu if it is not already opened.

@Given /^I open section "(?P<section_number>::d+)" edit menu$/

Exceptions
DriverExceptionThe step is not available when Javascript is disabled
Parameters
string$sectionnumber

◆ i_open_the_action_menu_for_item_in_management_category_listing()

i_open_the_action_menu_for_item_in_management_category_listing ( $name)

Locates a category in the course category management interface and then opens action menu for it.

@Given /^I open the action menu for "(?P<name_string>(?:[^"]|::")*)" in management category listing$/

Parameters
string$nameThe name of the category as it is displayed in the management interface.

◆ i_open_the_activity_chooser()

i_open_the_activity_chooser ( )

Open the activity chooser in a course.

@Given /^I open the activity chooser$/

◆ i_select_category_in_the_management_interface()

i_select_category_in_the_management_interface ( $name)

Clicks on a category checkbox in the management interface, if not checked.

@Given /^I select category "(?P<name_string>(?:[^"]|::")*)" in the management interface$/

Parameters
string$name

◆ i_select_course_in_the_management_interface()

i_select_course_in_the_management_interface ( $name)

Clicks course checkbox in the management interface, if not checked.

@Given /^I select course "(?P<name_string>(?:[^"]|::")*)" in the management interface$/

Parameters
string$name

◆ i_should_not_see_category_as_subcategory_of_in_the_management_interface()

i_should_not_see_category_as_subcategory_of_in_the_management_interface ( $subcatidnumber,
$catidnumber )

Checks that a category is not a subcategory of specific category.

@Given /^I should not see category "(?P<subcatidnumber_string>(?:[^"]|::")*)" as subcategory of "(?P<catidnumber_string>(?:[^"]|")*)" in the management interface$/

Exceptions
ExpectationException
Parameters
string$subcatidnumber
string$catidnumber

◆ i_should_not_see_teacher_after()

i_should_not_see_teacher_after ( $fteacher,
$pteacher )

Check that one teacher oes not appears after another in the course contacts.

@Given /^I should not see teacher "(?P<fteacher_string>(?:[^"]|::")*)" after "(?P<pteacher_string>(?:[^"]|")*)" in the course contact listing$/

Parameters
string$fteacherThe teacher that should not be found (after the other teacher)
string$pteacherThe teacher after who the other should not be found (this teacher must be found!)
Exceptions
ExpectationException

◆ i_should_see_category_as_subcategory_of_in_the_management_interface()

i_should_see_category_as_subcategory_of_in_the_management_interface ( $subcatidnumber,
$catidnumber )

Checks that a category is a subcategory of specific category.

@Given /^I should see category "(?P<subcatidnumber_string>(?:[^"]|::")*)" as subcategory of "(?P<catidnumber_string>(?:[^"]|")*)" in the management interface$/

Exceptions
ExpectationException
Parameters
string$subcatidnumber
string$catidnumber

◆ i_should_see_category_listing_before()

i_should_see_category_listing_before ( $preceedingcategory,
$followingcategory )

Check that one category appears before another in the course category management listings.

@Given /^I should see category listing "(?P<preceedingcategory_string>(?:[^"]|::")*)" before "(?P<followingcategory_string>(?:[^"]|")*)"$/

Parameters
string$preceedingcategoryThe first category to find
string$followingcategoryThe second category to find (should be after the first category)
Exceptions
ExpectationException

◆ i_should_see_course_listing_before()

i_should_see_course_listing_before ( $preceedingcourse,
$followingcourse )

Check that one course appears before another in the course category management listings.

@Given /^I should see course listing "(?P<preceedingcourse_string>(?:[^"]|::")*)" before "(?P<followingcourse_string>(?:[^"]|")*)"$/

Parameters
string$preceedingcourseThe first course to find
string$followingcourseThe second course to find (should be AFTER the first course)
Exceptions
ExpectationException

◆ i_should_see_teacher_before()

i_should_see_teacher_before ( $pteacher,
$fteacher )

Check that one teacher appears before another in the course contacts.

@Given /^I should see teacher "(?P<pteacher_string>(?:[^"]|::")*)" before "(?P<fteacher_string>(?:[^"]|")*)" in the course contact listing$/

Parameters
string$pteacherThe first teacher to find
string$fteacherThe second teacher to find (should be after the first teacher)
Exceptions
ExpectationException

◆ i_should_see_the_courses_management_page()

i_should_see_the_courses_management_page ( $mode)

Checks that we are on the course management page that we expect to be on and that no course has been selected.

@Given /^I should see the "(?P<mode_string>(?:[^"]|::")*)" management page$/

Parameters
string$modeThe mode to expected. One of 'Courses', 'Course categories' or 'Course categories and courses'

◆ i_should_see_the_courses_management_page_with_a_course_selected()

i_should_see_the_courses_management_page_with_a_course_selected ( $mode)

Checks that we are on the course management page that we expect to be on and that a course has been selected.

@Given /^I should see the "(?P<mode_string>(?:[^"]|::")*)" management page with a course selected$/

Parameters
string$modeThe mode to expected. One of 'Courses', 'Course categories' or 'Course categories and courses'

◆ i_show_section()

i_show_section ( $sectionnumber)

Shows the specified hidden section.

You need to be in the course page and on editing mode.

@Given /^I show section "(?P<section_number>::d+)"$/

Parameters
int$sectionnumber

◆ i_toggle_category_children_visibility_in_frontpage()

i_toggle_category_children_visibility_in_frontpage ( $categoryname)

Clicks to expand or collapse a category displayed on the frontpage.

@Given /^I toggle "(?P<categoryname_string>(?:[^"]|::")*)" category children visibility in frontpage$/

Exceptions
ExpectationException
Parameters
string$categoryname

◆ i_toggle_visibility_of_category_in_management_listing()

i_toggle_visibility_of_category_in_management_listing ( $idnumber)

Toggles the visibility of a category in the management UI.

If it was visible it will be hidden. If it is hidden it will be made visible.

@Given /^I toggle visibility of category "(?P<idnumber_string>(?:[^"]|::")*)" in management listing$/

◆ i_toggle_visibility_of_course_in_management_listing()

i_toggle_visibility_of_course_in_management_listing ( $idnumber)

Toggles the visibility of a course in the management UI.

If it was visible it will be hidden. If it is hidden it will be made visible.

@Given /^I toggle visibility of course "(?P<idnumber_string>(?:[^"]|::")*)" in management listing$/

Parameters
string$idnumber

◆ i_turn_section_highlighting_off()

i_turn_section_highlighting_off ( $sectionnumber)

Turns course section highlighting off.

@Given /^I turn section "(?P<section_number>::d+)" highlighting off$/

Parameters
int$sectionnumberThe section number

◆ i_turn_section_highlighting_on()

i_turn_section_highlighting_on ( $sectionnumber)

Turns course section highlighting on.

@Given /^I turn section "(?P<section_number>::d+)" highlighting on$/

Parameters
int$sectionnumberThe section number

◆ i_unselect_category_in_the_management_interface()

i_unselect_category_in_the_management_interface ( $name)

Clicks on a category checkbox in the management interface, if checked.

@Given /^I unselect category "(?P<name_string>(?:[^"]|::")*)" in the management interface$/

Parameters
string$name

◆ i_unselect_course_in_the_management_interface()

i_unselect_course_in_the_management_interface ( $name)

Clicks course checkbox in the management interface, if checked.

@Given /^I unselect course "(?P<name_string>(?:[^"]|::")*)" in the management interface$/

Parameters
string$name

◆ i_wait_until_section_is_available()

i_wait_until_section_is_available ( $sectionnumber)

Waits until the section is available to interact with it.

Useful when the section is performing an action and the section is overlayed with a loading layout.

Using the protected method as this method will be usually called by other methods which are not returning a set of steps and performs the actions directly, so it would not be executed if it returns another step.

Hopefully we would not require test writers to use this step and we will manage it from other step definitions.

@Given /^I wait until section "(?P<section_number>::d+)" is available$/

Parameters
int$sectionnumber
Return values
void

◆ is_course_editor()

is_course_editor ( )
protected

Returns whether the user can edit the course contents or not.

Return values
bool

◆ is_editing_on()

is_editing_on ( )
protected

Returns whether the user can edit the course contents and the editing mode is on.

Return values
bool

◆ label_should_be_hidden()

label_should_be_hidden ( $activityname)

Checks that the specified label is hidden from students.

You need to be in the course page.

@Then /^"(?P<activity_or_resource_string>(?:[^"]|::")*)" label should be hidden$/

Parameters
string$activityname
Exceptions
ExpectationException

◆ listing_is_highlighted()

listing_is_highlighted ( $self,
$selector )
protected

Used by spin to determine the callback has been highlighted.

Parameters
behat_course$selfA self reference (default first arg from a spin callback)
Behat\Mink\Element\NodeElement$selector
Return values
bool

◆ section_activities_should_be_hidden()

section_activities_should_be_hidden ( $sectionnumber)

Checks that all actiities in the specified section are hidden.

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 /^all activities in section "(?P<section_number>::d+)" should be hidden$/

Exceptions
ExpectationException
ElementNotFoundExceptionThrown by behat_base\find
Parameters
int$sectionnumber

◆ section_exists()

section_exists ( $sectionnumber)
protected

Checks if the course section exists.

Exceptions
ElementNotFoundExceptionThrown by behat_base\find
Parameters
int$sectionnumber
Return values
stringThe xpath of the section.

◆ section_should_be_hidden()

section_should_be_hidden ( $sectionnumber)

Checks that the specified section 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 /^section "(?P<section_number>::d+)" should be hidden$/

Exceptions
ExpectationException
ElementNotFoundExceptionThrown by behat_base\find
Parameters
int$sectionnumber

◆ section_should_be_highlighted()

section_should_be_highlighted ( $sectionnumber)

Checks if the specified course section hightlighting is turned on.

You need to be in the course page on editing mode.

@Then /^section "(?P<section_number>::d+)" should be highlighted$/

Exceptions
ExpectationException
Parameters
int$sectionnumberThe section number

◆ section_should_be_visible()

section_should_be_visible ( $sectionnumber)

Checks that the specified section 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 /^section "(?P<section_number>::d+)" should be visible$/

Exceptions
ExpectationException
Parameters
int$sectionnumber

◆ section_should_not_be_highlighted()

section_should_not_be_highlighted ( $sectionnumber)

Checks if the specified course section highlighting is turned off.

You need to be in the course page on editing mode.

@Then /^section "(?P<section_number>::d+)" should not be highlighted$/

Exceptions
ExpectationException
Parameters
int$sectionnumberThe section number

◆ show_section_link_exists()

show_section_link_exists ( $sectionnumber)
protected

Returns the show section icon or throws an exception.

Exceptions
ElementNotFoundExceptionThrown by behat_base\find
Parameters
int$sectionnumber
Return values
NodeElement

◆ user_clicks_on_management_listing_action()

user_clicks_on_management_listing_action ( $listingtype,
$listingnode,
$action )
protected

Finds the node to use for a management listitem action and clicks it.

Parameters
string$listingtypeEither course or category.
Behat\Mink\Element\NodeElement$listingnode
string$actionThe action being taken
Exceptions
Behat\Mink\Exception\ExpectationException

◆ user_moves_listing_by_one()

user_moves_listing_by_one ( $listingtype,
$listingnode,
$direction,
$highlight = true )
protected

Moves a course or category listing within the management interface up or down by one.

Parameters
string$listingtypeOne of course or category
Behat\Mink\Element\NodeElement$listingnode
string$directionOne of up or down.
bool$highlightIf set to false we don't check the node has been highlighted.