Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
behat_course Class Reference
Inheritance diagram for behat_course:
behat_base behat_session_interface behat_theme_classic_behat_course

Public Member Functions

 actions_menu_should_be_open ($activityname)
 Checks that the specified activity's action menu is open. More...
 
 actions_menu_should_have_item ($activityname, $menuitem)
 Checks that the specified activity's action menu contains an item. More...
 
 actions_menu_should_not_have_item ($activityname, $menuitem)
 Checks that the specified activity's action menu does not contains an item. More...
 
 activity_should_be_available_but_hidden_from_course_page ($activityname)
 Checks that the specified activity is visible. More...
 
 activity_should_be_dimmed ($activityname)
 Checks that the specified activity is dimmed. More...
 
 activity_should_be_hidden ($activityname)
 Checks that the specified activity is hidden. More...
 
 activity_should_be_visible ($activityname)
 Checks that the specified activity is visible. More...
 
 category_actions_menu_should_have_item ($name, $menuitem)
 Checks that the specified category actions menu contains an item. More...
 
 category_actions_menu_should_not_have_item ($name, $menuitem)
 Checks that the specified category actions menu does not contain an item. More...
 
 category_in_management_listing_should_be_dimmed ($idnumber)
 Checks that a category within the management interface is dimmed. More...
 
 category_in_management_listing_should_be_visible ($idnumber)
 Checks that a category within the management interface is visible. More...
 
 course_in_management_listing_should_be_dimmed ($idnumber)
 Checks that a course within the management interface is dimmed. More...
 
 course_in_management_listing_should_be_visible ($idnumber)
 Checks that a course within the management interface is visible. More...
 
 getSession ($name=null)
 Returns the Mink session. More...
 
 i_add_to_section ($activity, $section)
 Opens the activity chooser and opens the activity/resource form page. More...
 
 i_add_to_section_and_i_fill_the_form_with ($activity, $section, TableNode $data)
 Adds the selected activity/resource filling the form data with the specified field/value pairs. More...
 
 i_change_activity_name_to ($activityname, $newactivityname)
 Edits the activity name through the edit activity; this step only works with Javascript enabled. More...
 
 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. More...
 
 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. More...
 
 i_click_on_category_in_the_management_category_listing ($name)
 Clicks on a category in the management interface. More...
 
 i_click_on_category_in_the_management_interface ($name)
 Clicks on a category in the management interface. More...
 
 i_click_on_course_in_the_management_interface ($name)
 Clicks on a course in the management interface. More...
 
 i_click_on_in_the_activity ($element, $selectortype, $activityname)
 Clicks on the specified element of the activity. More...
 
 i_click_to_expand_category_in_the_management_interface ($idnumber)
 Click to expand a category revealing its sub categories within the management UI. More...
 
 i_click_to_move_category_by_one ($idnumber, $direction)
 Moves a category displayed in the management interface up or down one place. More...
 
 i_click_to_move_course_by_one ($idnumber, $direction)
 Moves a course displayed in the management interface up or down one place. More...
 
 i_close_actions_menu ($activityname)
 Closes an activity actions menu if it is not already closed. More...
 
 i_create_a_course_with (TableNode $table)
 Creates a new course with the provided table data matching course settings names with the desired values. More...
 
 i_delete_activity ($activityname)
 Deletes the activity or resource specified by it's name. More...
 
 i_delete_section ($sectionnumber)
 Deletes course section. More...
 
 i_duplicate_activity ($activityname)
 Duplicates the activity or resource specified by it's name. More...
 
 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. More...
 
 i_edit_the_section ($sectionnumber)
 Go to editing section page for specified section number. More...
 
 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. More...
 
 i_go_to_the_courses_management_page ()
 Goes to the system courses/categories management page. More...
 
 i_hide_section ($sectionnumber)
 Hides the specified visible section. More...
 
 i_indent_left_activity ($activityname)
 Indents to the left the activity or resource specified by it's name. More...
 
 i_indent_right_activity ($activityname)
 Indents to the right the activity or resource specified by it's name. More...
 
 i_move_activity_to_section ($activityname, $sectionnumber)
 Moves the specified activity to the first slot of a section. More...
 
 i_move_category_to_top_level_in_the_management_interface ($name)
 Move selected categories to top level in the management interface. More...
 
 i_move_down_section ($sectionnumber)
 Moves down the specified section, this step only works with Javascript disabled. More...
 
 i_move_up_section ($sectionnumber)
 Moves up the specified section, this step only works with Javascript disabled. More...
 
 i_navigate_to_course_participants ()
 Go to the course participants. More...
 
 i_open_actions_menu ($activityname)
 Opens an activity actions menu if it is not already opened. More...
 
 i_open_section_edit_menu ($sectionnumber)
 Opens a section edit menu if it is not already opened. More...
 
 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. More...
 
 i_open_the_activity_chooser ()
 Open the activity chooser in a course. More...
 
 i_select_category_in_the_management_interface ($name)
 Clicks on a category checkbox in the management interface, if not checked. More...
 
 i_select_course_in_the_management_interface ($name)
 Clicks course checkbox in the management interface, if not checked. More...
 
 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. More...
 
 i_should_not_see_teacher_after ($fteacher, $pteacher)
 Check that one teacher oes not appears after another in the course contacts. More...
 
 i_should_see_category_as_subcategory_of_in_the_management_interface ($subcatidnumber, $catidnumber)
 Checks that a category is a subcategory of specific category. More...
 
 i_should_see_category_listing_before ($preceedingcategory, $followingcategory)
 Check that one category appears before another in the course category management listings. More...
 
 i_should_see_course_listing_before ($preceedingcourse, $followingcourse)
 Check that one course appears before another in the course category management listings. More...
 
 i_should_see_teacher_before ($pteacher, $fteacher)
 Check that one teacher appears before another in the course contacts. More...
 
 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. More...
 
 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. More...
 
 i_show_section ($sectionnumber)
 Shows the specified hidden section. More...
 
 i_toggle_category_children_visibility_in_frontpage ($categoryname)
 Clicks to expand or collapse a category displayed on the frontpage. More...
 
 i_toggle_visibility_of_category_in_management_listing ($idnumber)
 Toggles the visibility of a category in the management UI. More...
 
 i_toggle_visibility_of_course_in_management_listing ($idnumber)
 Toggles the visibility of a course in the management UI. More...
 
 i_turn_editing_mode_off ()
 Turns editing mode off. More...
 
 i_turn_editing_mode_on ()
 Turns editing mode on. More...
 
 i_turn_section_highlighting_off ($sectionnumber)
 Turns course section highlighting off. More...
 
 i_turn_section_highlighting_on ($sectionnumber)
 Turns course section highlighting on. More...
 
 i_unselect_category_in_the_management_interface ($name)
 Clicks on a category checkbox in the management interface, if checked. More...
 
 i_unselect_course_in_the_management_interface ($name)
 Clicks course checkbox in the management interface, if checked. More...
 
 i_wait_until_section_is_available ($sectionnumber)
 Waits until the section is available to interact with it. More...
 
 section_activities_should_be_hidden ($sectionnumber)
 Checks that all actiities in the specified section are hidden. More...
 
 section_should_be_hidden ($sectionnumber)
 Checks that the specified section is visible. More...
 
 section_should_be_highlighted ($sectionnumber)
 Checks if the specified course section hightlighting is turned on. More...
 
 section_should_be_visible ($sectionnumber)
 Checks that the specified section is visible. More...
 
 section_should_not_be_highlighted ($sectionnumber)
 Checks if the specified course section highlighting is turned off. More...
 

Static Public Member Functions

static get_named_replacements ()
 Return a list of the Mink named replacements for the component. More...
 
static get_partial_named_selectors ()
 Return the list of partial named selectors. More...
 

Public Attributes

const EXTENDED_TIMEOUT = 10
 And extended timeout for specific cases. More...
 
const PAGE_READY_JS
 The JS code to check that the page is ready. More...
 
const REDUCED_TIMEOUT = 2
 Small timeout. More...
 
const TIMEOUT = 6
 The timeout for each Behat step (load page, wait for an element to load...). More...
 

Protected Member Functions

 get_activity_element ($element, $selectortype, $activityname)
 Clicks on the specified element inside the activity container. More...
 
 get_activity_name ($activitynode)
 Gets the activity instance name from the activity node. More...
 
 get_activity_node ($activityname)
 Returns the DOM node of the activity from . More...
 
 get_course_format ()
 Gets the current course format. More...
 
 get_management_category_listing_node_by_idnumber ($idnumber)
 Returns the category node from within the listing on the management page. More...
 
 get_management_category_listing_node_by_name ($name, $link=false)
 Returns a category node from within the management interface. More...
 
 get_management_course_listing_node_by_idnumber ($idnumber)
 Returns the course node from within the listing on the management page. More...
 
 get_management_course_listing_node_by_name ($name, $link=false)
 Returns a course node from within the management interface. More...
 
 get_section_activities ($sectionxpath)
 Gets the section's activites DOM nodes. More...
 
 hide_section_link_exists ($sectionnumber)
 Returns the hide section icon link if it exists or throws exception. More...
 
 is_course_editor ()
 Returns whether the user can edit the course contents or not. More...
 
 is_editing_on ()
 Returns whether the user can edit the course contents and the editing mode is on. More...
 
 listing_is_highlighted ($self, $selector)
 Used by spin to determine the callback has been highlighted. More...
 
 section_exists ($sectionnumber)
 Checks if the course section exists. More...
 
 show_section_link_exists ($sectionnumber)
 Returns the show section icon or throws an exception. More...
 
 user_clicks_on_management_listing_action ($listingtype, $listingnode, $action)
 Finds the node to use for a management listitem action and clicks it. More...
 
 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. More...
 

Member Function Documentation

◆ actions_menu_should_be_open()

behat_course::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()

behat_course::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()

behat_course::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_should_be_available_but_hidden_from_course_page()

behat_course::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_dimmed()

behat_course::activity_should_be_dimmed (   $activityname)

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

Parameters
string$activityname
Exceptions
ExpectationException

◆ activity_should_be_hidden()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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_element()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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_named_replacements()

static behat_course::get_named_replacements ( )
static

Return a list of the Mink named replacements for the component.

Named replacements allow you to define parts of an xpath that can be reused multiple times, or in multiple xpaths.

This method should return a list of behat_component_named_replacement and the docs on that class explain how it works.

Return values
behat_component_named_replacement[]

◆ get_partial_named_selectors()

static behat_course::get_partial_named_selectors ( )
static

Return the list of partial named selectors.

Return values
array

◆ get_section_activities()

behat_course::get_section_activities (   $sectionxpath)
protected

Gets the section's activites DOM nodes.

Parameters
string$sectionxpath
Return values
arrayNodeElement instances

◆ getSession()

behat_session_interface::getSession (   $name = null)
inherited

Returns the Mink session.

Parameters
string | null$namename of the session OR active session will be used
Return values
Behat::Mink::Session

Implemented in behat_form_field.

◆ hide_section_link_exists()

behat_course::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_section()

behat_course::i_add_to_section (   $activity,
  $section 
)

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

Sections 0 and 1 are also allowed on frontpage.

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

Exceptions
ElementNotFoundExceptionThrown by behat_base::find
Parameters
string$activity
int$section

◆ i_add_to_section_and_i_fill_the_form_with()

behat_course::i_add_to_section_and_i_fill_the_form_with (   $activity,
  $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.

@When /^I add a "(?P<activity_or_resource_name_string>(?:[^"]|::")*)" to section "(?P<section_number>\d+)" and I fill the form with:$/

Parameters
string$activityThe activity name
int$sectionThe section number
TableNode$dataThe activity field/value data

◆ i_change_activity_name_to()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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_create_a_course_with()

behat_course::i_create_a_course_with ( TableNode  $table)

Creates a new course with the provided table data matching course settings names with the desired values.

@Given /^I create a course with:$/

Parameters
TableNode$tableThe course data

◆ i_delete_activity()

behat_course::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()

behat_course::i_delete_section (   $sectionnumber)

Deletes course section.

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

Parameters
int$sectionnumberThe section number

◆ i_duplicate_activity()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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_go_to_the_courses_management_page()

behat_course::i_go_to_the_courses_management_page ( )

Goes to the system courses/categories management page.

@Given /^I go to the courses management page$/

◆ i_hide_section()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::i_move_activity_to_section (   $activityname,
  $sectionnumber 
)

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.

@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_category_to_top_level_in_the_management_interface()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::i_navigate_to_course_participants ( )

Go to the course participants.

@Given /^I navigate to course participants$/

Reimplemented in behat_theme_classic_behat_course.

◆ i_open_actions_menu()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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_editing_mode_off()

behat_course::i_turn_editing_mode_off ( )

Turns editing mode off.

@Given /^I turn editing mode off$/

◆ i_turn_editing_mode_on()

behat_course::i_turn_editing_mode_on ( )

Turns editing mode on.

@Given /^I turn editing mode on$/

◆ i_turn_section_highlighting_off()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::is_course_editor ( )
protected

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

Return values
bool

◆ is_editing_on()

behat_course::is_editing_on ( )
protected

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

Return values
bool

◆ listing_is_highlighted()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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()

behat_course::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.

Member Data Documentation

◆ EXTENDED_TIMEOUT

const behat_session_interface::EXTENDED_TIMEOUT = 10
inherited

And extended timeout for specific cases.

Deprecated:
since Moodle 3.7 MDL-64979 - please use get_extended_timeout() instead
Todo:
MDL-64982 This will be deleted in Moodle 3.11
See also
behat_base::get_extended_timeout()

◆ PAGE_READY_JS

const behat_session_interface::PAGE_READY_JS
inherited
Initial value:
= "document.readyState === 'complete' && " .
"(typeof M !== 'object' || typeof M.util !== 'object' || " .
"typeof M.util.pending_js === 'undefined' || M.util.pending_js.length === 0)"

The JS code to check that the page is ready.

The document must be complete and either M.util.pending_js must be empty, or it must not be defined at all.

◆ REDUCED_TIMEOUT

const behat_session_interface::REDUCED_TIMEOUT = 2
inherited

Small timeout.

A reduced timeout for cases where self::TIMEOUT is too much and a simple $this->getSession()->getPage()->find() could not be enough.

Deprecated:
since Moodle 3.7 MDL-64979 - please use get_reduced_timeout() instead
Todo:
MDL-64982 This will be deleted in Moodle 3.11
See also
behat_base::get_reduced_timeout()

◆ TIMEOUT

const behat_session_interface::TIMEOUT = 6
inherited

The timeout for each Behat step (load page, wait for an element to load...).

Deprecated:
since Moodle 3.7 MDL-64979 - please use get_timeout() instead
Todo:
MDL-64982 This will be deleted in Moodle 3.11
See also
behat_base::get_timeout()

The documentation for this class was generated from the following file: