Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | List of all members
behat_theme_classic_behat_course Class Reference
Inheritance diagram for behat_theme_classic_behat_course:
behat_course behat_base

Public Member Functions

 __call ($name, $arguments)
 Finds DOM nodes in the page using named selectors. More...
 
 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_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...
 
 escape ($string)
 Escapes the double quote character. More...
 
 evaluate_script (string $script)
 Evaluate the supplied script in the current session, returning the result. More...
 
 execute_script (string $script)
 Execute the supplied script in the current session. More...
 
 get_sesskey ()
 Get the session key for the current session via Javascript. More...
 
 has_tag (string $tag)
 Checks if the current scenario, or its feature, has a specified tag. 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.
 
 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_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...
 
 look_for_exceptions ()
 Internal step definition to find exceptions, debugging() messages and PHP debug messages. More...
 
 normalise_selector (string $selector, $locator, Element $container)
 Normalise the locator and selector. 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...
 
 wait_for_pending_js ()
 Waits for all the JS to be loaded. More...
 

Static Public Member Functions

static evaluate_script_in_session (Session $session, string $script)
 Evaluate the supplied script in the specified session, returning the result. More...
 
static execute_script_in_session (Session $session, string $script)
 Excecute the supplied script in the specified session. More...
 
static get_exact_named_selectors ()
 Return a list of the exact named selectors for the component. More...
 
static get_extended_timeout ()
 Gets the extended timeout. More...
 
static get_named_replacements ()
 Return a list of the Mink named replacements for the component. More...
 
static get_partial_named_selectors ()
 Return a list of the partial named selectors for the component. More...
 
static get_reduced_timeout ()
 Gets the reduced timeout. More...
 
static get_timeout ()
 Gets the default timeout. More...
 
static set_user ($user=null)
 Set current $USER, reset access cache. More...
 
static wait_for_pending_js_in_session (Session $session)
 Waits for all the JS to be loaded. 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

 ensure_editors_are_loaded ()
 Ensures that all the page's editors are loaded. More...
 
 ensure_element_does_not_exist ($locator, $selectortype)
 Spins until the element does not exist. More...
 
 ensure_element_exists ($locator, $selectortype)
 Spins around an element until it exists. More...
 
 ensure_element_is_visible ($element, $selectortype)
 Ensures that the provided element is visible and we can interact with it. More...
 
 ensure_node_attribute_is_set ($node, $attribute, $attributevalue)
 Ensures that the provided node has a attribute value set. More...
 
 ensure_node_is_visible ($node)
 Ensures that the provided node is visible and we can interact with it. More...
 
 execute ($contextapi, $params=array())
 Helper function to execute api in a given context. More...
 
 find ($selector, $locator, $exception=false, $node=false, $timeout=false)
 Returns the first matching element. More...
 
 find_all ($selector, $locator, $exception=false, $container=false, $timeout=false)
 Returns all matching elements. More...
 
 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_category_id ($idnumber)
 Returns the id of the category with the given idnumber. More...
 
 get_course_format ()
 Gets the current course format. More...
 
 get_course_id ($idnumber)
 Returns the id of the course with the given idnumber. More...
 
 get_debug_text ($html)
 Converts HTML tags to line breaks to display the info in CLI. 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_node_in_container ($selectortype, $element, $containerselectortype, $containerelement)
 Gets the requested element inside the specified container. More...
 
 get_section_activities ($sectionxpath)
 Gets the section's activites DOM nodes. More...
 
 get_selected_node ($selectortype, $element)
 Gets a NodeElement based on the locator and selector type received as argument from steps definitions. More...
 
 get_session_user ()
 Get the actual user in the behat session (note $USER does not correspond to the behat session's user). More...
 
 get_text_selector_node ($selectortype, $element)
 Gets a NodeElement based on the locator and selector type received as argument from steps definitions. 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...
 
 is_in_app ()
 Checks if the current page is part of the mobile app. More...
 
 js_trigger_click ($node)
 Trigger click on node via javascript instead of actually clicking on it via pointer. More...
 
 listing_is_highlighted ($self, $selector)
 Used by spin to determine the callback has been highlighted. More...
 
 locate_path ($path)
 Locates url, based on provided path. More...
 
 require_javascript ()
 Require that javascript be available in the current Session. More...
 
 resize_window ($windowsize, $viewport=false)
 Change browser window size. More...
 
 resolve_page_instance_url (string $type, string $identifier)
 Convert page names to URLs for steps like 'When I am on the "[identifier]" "[page type]" page'. More...
 
 resolve_page_url (string $page)
 Convert page names to URLs for steps like 'When I am on the "[page name]" page'. More...
 
 running_javascript ()
 Whether Javascript is available in the current Session. 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...
 
 spin ($lambda, $args=false, $timeout=false, $exception=false, $microsleep=false)
 Executes the passed closure until returns true or time outs. More...
 
 transform_selector ($selectortype, $element)
 Transforms from step definition's argument style to Mink format. More...
 
 transform_text_selector ($selectortype, $element)
 Transforms from step definition's argument style to Mink format. 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...
 

Static Protected Member Functions

static get_real_timeout (int $timeout)
 Gets the required timeout in seconds. More...
 
static require_javascript_in_session (Session $session)
 Require that javascript be available for the specified Session. More...
 
static running_javascript_in_session (Session $session)
 Whether Javascript is available in the specified Session. More...
 

Member Function Documentation

◆ __call()

behat_base::__call (   $name,
  $arguments 
)
inherited

Finds DOM nodes in the page using named selectors.

The point of using this method instead of Mink ones is the spin method of behat_base::find() that looks for the element until it is available or it timeouts, this avoids the false failures received when selenium tries to execute commands on elements that are not ready to be used.

All steps that requires elements to be available before interact with them should use one of the find* methods.

The methods calls requires a {'find_' . $elementtype}($locator) format, like find_link($locator), find_select($locator), find_button($locator)...

@externalurl http://mink.behat.org/#named-selectors

Exceptions
coding_exception
Parameters
string$nameThe name of the called method
mixed$arguments
Return values
NodeElement

◆ actions_menu_should_be_open()

behat_course::actions_menu_should_be_open (   $activityname)
inherited

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 
)
inherited

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 
)
inherited

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)
inherited

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)
inherited

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)
inherited

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)
inherited

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_in_management_listing_should_be_dimmed()

behat_course::category_in_management_listing_should_be_dimmed (   $idnumber)
inherited

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)
inherited

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)
inherited

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)
inherited

Checks that a course within the management interface is visible.

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

Parameters
string$idnumber

◆ ensure_editors_are_loaded()

behat_base::ensure_editors_are_loaded ( )
protectedinherited

Ensures that all the page's editors are loaded.

Deprecated:
since Moodle 2.7 MDL-44084 - please do not use this function any more.
Exceptions
ElementNotFoundException
ExpectationException
Return values
void

◆ ensure_element_does_not_exist()

behat_base::ensure_element_does_not_exist (   $locator,
  $selectortype 
)
protectedinherited

Spins until the element does not exist.

Exceptions
ExpectationException
Parameters
string$locator
string$selectortype
Return values
void

◆ ensure_element_exists()

behat_base::ensure_element_exists (   $locator,
  $selectortype 
)
protectedinherited

Spins around an element until it exists.

Exceptions
ExpectationException
Parameters
string$locator
string$selectortype
Return values
void

◆ ensure_element_is_visible()

behat_base::ensure_element_is_visible (   $element,
  $selectortype 
)
protectedinherited

Ensures that the provided element is visible and we can interact with it.

Returns the node in case other actions are interested in using it.

Exceptions
ExpectationException
Parameters
string$element
string$selectortype
Return values
NodeElementThrows an exception if it times out without being visible

◆ ensure_node_attribute_is_set()

behat_base::ensure_node_attribute_is_set (   $node,
  $attribute,
  $attributevalue 
)
protectedinherited

Ensures that the provided node has a attribute value set.

This step can be used to check if specific JS has finished modifying the node.

Exceptions
ExpectationException
Parameters
NodeElement$node
string$attributeattribute name
string$attributevalueattribute value to check.
Return values
voidThrows an exception if it times out without the element being visible

◆ ensure_node_is_visible()

behat_base::ensure_node_is_visible (   $node)
protectedinherited

Ensures that the provided node is visible and we can interact with it.

Exceptions
ExpectationException
Parameters
NodeElement$node
Return values
voidThrows an exception if it times out without the element being visible

◆ escape()

behat_base::escape (   $string)
inherited

Escapes the double quote character.

Double quote is the argument delimiter, it can be escaped with a backslash, but we auto-remove this backslashes before the step execution, this method is useful when using arguments as arguments for other steps.

Parameters
string$string
Return values
string

◆ evaluate_script()

behat_base::evaluate_script ( string  $script)
inherited

Evaluate the supplied script in the current session, returning the result.

Parameters
string$script
Return values
mixed

◆ evaluate_script_in_session()

static behat_base::evaluate_script_in_session ( Session  $session,
string  $script 
)
staticinherited

Evaluate the supplied script in the specified session, returning the result.

Parameters
Session$session
string$script
Return values
mixed

◆ execute()

behat_base::execute (   $contextapi,
  $params = array() 
)
protectedinherited

Helper function to execute api in a given context.

Parameters
string$contextapicontext in which api is defined.
array$paramslist of params to pass.
Exceptions
Exception

◆ execute_script()

behat_base::execute_script ( string  $script)
inherited

Execute the supplied script in the current session.

No result will be returned.

Parameters
string$script

◆ execute_script_in_session()

static behat_base::execute_script_in_session ( Session  $session,
string  $script 
)
staticinherited

Excecute the supplied script in the specified session.

No result will be returned.

Parameters
Session$session
string$script

◆ find()

behat_base::find (   $selector,
  $locator,
  $exception = false,
  $node = false,
  $timeout = false 
)
protectedinherited

Returns the first matching element.

@externalurl http://mink.behat.org/#traverse-the-page-selectors

Parameters
string$selectorThe selector type (css, xpath, named...)
mixed$locatorIt depends on the $selector, can be the xpath, a name, a css locator...
Exception$exceptionOtherwise we throw exception with generic info
NodeElement$nodeSpins around certain DOM node instead of the whole page
int$timeoutForces a specific time out (in seconds).
Return values
NodeElement

◆ find_all()

behat_base::find_all (   $selector,
  $locator,
  $exception = false,
  $container = false,
  $timeout = false 
)
protectedinherited

Returns all matching elements.

Adapter to Behat\Mink\Element\Element::findAll() using the spin() method.

@externalurl http://mink.behat.org/#traverse-the-page-selectors

Parameters
string$selectorThe selector type (css, xpath, named...)
mixed$locatorIt depends on the $selector, can be the xpath, a name, a css locator...
Exception$exceptionOtherwise we throw expcetion with generic info
NodeElement$containerRestrict the search to just children of the specified container
int$timeoutForces a specific time out (in seconds). If 0 is provided the default timeout will be applied.
Return values
arrayNodeElements list

◆ get_activity_element()

behat_course::get_activity_element (   $element,
  $selectortype,
  $activityname 
)
protectedinherited

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)
protectedinherited

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)
protectedinherited

Returns the DOM node of the activity from .

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

◆ get_category_id()

behat_course::get_category_id (   $idnumber)
protectedinherited

Returns the id of the category with the given idnumber.

Please note that this function requires the category to exist. If it does not exist an ExpectationException is thrown.

Parameters
string$idnumber
Return values
string
Exceptions
ExpectationException

◆ get_course_format()

behat_course::get_course_format ( )
protectedinherited

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_course_id()

behat_course::get_course_id (   $idnumber)
protectedinherited

Returns the id of the course with the given idnumber.

Please note that this function requires the category to exist. If it does not exist an ExpectationException is thrown.

Parameters
string$idnumber
Return values
string
Exceptions
ExpectationException

◆ get_debug_text()

behat_base::get_debug_text (   $html)
protectedinherited

Converts HTML tags to line breaks to display the info in CLI.

Parameters
string$html
Return values
string

◆ get_exact_named_selectors()

static behat_base::get_exact_named_selectors ( )
staticinherited

Return a list of the exact named selectors for the component.

Named selectors are what make Behat steps like Then I should see "Useful text" in the "General" "fieldset" work. Here, "fieldset" is the named selector, and "General" is the locator.

If you override this method in your plugin (e.g. mod_mymod), to define new selectors specific to your plugin. For example, if you returned new behat_component_named_selector('Thingy', [".//some/xpath//img[contains(@alt, %locator%)]/.."]) then Then I should see "Useful text" in the "Whatever" "mod_mymod > Thingy" would work.

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

Return values
behat_component_named_selector[]

◆ get_extended_timeout()

static behat_base::get_extended_timeout ( )
staticinherited

Gets the extended timeout.

A longer timeout for cases where the normal timeout is not enough.

Return values
intTimeout in seconds

◆ get_management_category_listing_node_by_idnumber()

behat_course::get_management_category_listing_node_by_idnumber (   $idnumber)
protectedinherited

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

Parameters
string$idnumber
Return values
Behat

◆ get_management_category_listing_node_by_name()

behat_course::get_management_category_listing_node_by_name (   $name,
  $link = false 
)
protectedinherited

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

◆ get_management_course_listing_node_by_idnumber()

behat_course::get_management_course_listing_node_by_idnumber (   $idnumber)
protectedinherited

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

Parameters
string$idnumber
Return values
Behat

◆ get_management_course_listing_node_by_name()

behat_course::get_management_course_listing_node_by_name (   $name,
  $link = false 
)
protectedinherited

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

◆ get_named_replacements()

static behat_base::get_named_replacements ( )
staticinherited

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[]

Reimplemented in behat_message.

◆ get_node_in_container()

behat_base::get_node_in_container (   $selectortype,
  $element,
  $containerselectortype,
  $containerelement 
)
protectedinherited

Gets the requested element inside the specified container.

Exceptions
ElementNotFoundExceptionThrown by behat_base::find
Parameters
mixed$selectortypeThe element selector type.
mixed$elementThe element locator.
mixed$containerselectortypeThe container selector type.
mixed$containerelementThe container locator.
Return values
NodeElement

◆ get_partial_named_selectors()

static behat_base::get_partial_named_selectors ( )
staticinherited

Return a list of the partial named selectors for the component.

Like the exact named selectors above, but the locator only needs to match part of the text. For example, the standard "button" is a partial selector, so: When I click "Save" "button" will activate "Save changes".

Return values
behat_component_named_selector[]

Reimplemented in behat_message.

◆ get_real_timeout()

static behat_base::get_real_timeout ( int  $timeout)
staticprotectedinherited

Gets the required timeout in seconds.

Parameters
int$timeoutOne of the TIMEOUT constants
Return values
intActual timeout (in seconds)

◆ get_reduced_timeout()

static behat_base::get_reduced_timeout ( )
staticinherited

Gets the reduced timeout.

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

Return values
intTimeout in seconds

◆ get_section_activities()

behat_course::get_section_activities (   $sectionxpath)
protectedinherited

Gets the section's activites DOM nodes.

Parameters
string$sectionxpath
Return values
arrayNodeElement instances

◆ get_selected_node()

behat_base::get_selected_node (   $selectortype,
  $element 
)
protectedinherited

Gets a NodeElement based on the locator and selector type received as argument from steps definitions.

Use behat_base::get_text_selector_node() for text-based selectors.

Exceptions
ElementNotFoundExceptionThrown by behat_base::find
Parameters
string$selectortype
string$element
Return values
NodeElement

◆ get_session_user()

behat_base::get_session_user ( )
protectedinherited

Get the actual user in the behat session (note $USER does not correspond to the behat session's user).

Return values
mixed
Exceptions
coding_exception

◆ get_sesskey()

behat_base::get_sesskey ( )
inherited

Get the session key for the current session via Javascript.

Return values
string

◆ get_text_selector_node()

behat_base::get_text_selector_node (   $selectortype,
  $element 
)
protectedinherited

Gets a NodeElement based on the locator and selector type received as argument from steps definitions.

Exceptions
ElementNotFoundExceptionThrown by behat_base::find
Parameters
string$selectortype
string$element
Return values
NodeElement

◆ get_timeout()

static behat_base::get_timeout ( )
staticinherited

Gets the default timeout.

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

Return values
intTimeout in seconds

◆ has_tag()

behat_base::has_tag ( string  $tag)
inherited

Checks if the current scenario, or its feature, has a specified tag.

Parameters
string$tagTag to check
Return values
boolTrue if the tag exists in scenario or feature

◆ hide_section_link_exists()

behat_course::hide_section_link_exists (   $sectionnumber)
protectedinherited

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 
)
inherited

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 
)
inherited

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 
)
inherited

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 
)
inherited

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 
)
inherited

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)
inherited

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)
inherited

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)
inherited

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 
)
inherited

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)
inherited

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 
)
inherited

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 
)
inherited

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)
inherited

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)
inherited

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)
inherited

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)
inherited

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)
inherited

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 
)
inherited

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)
inherited

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 
)
inherited

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 ( )
inherited

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)
inherited

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)
inherited

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)
inherited

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 
)
inherited

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)
inherited

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)
inherited

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)
inherited

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_open_actions_menu()

behat_course::i_open_actions_menu (   $activityname)
inherited

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)
inherited

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_select_category_in_the_management_interface()

behat_course::i_select_category_in_the_management_interface (   $name)
inherited

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)
inherited

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 
)
inherited

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 
)
inherited

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 
)
inherited

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 
)
inherited

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 
)
inherited

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 
)
inherited

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)
inherited

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)
inherited

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)
inherited

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)
inherited

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)
inherited

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)
inherited

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 ( )
inherited

Turns editing mode off.

@Given /^I turn editing mode off$/

◆ i_turn_editing_mode_on()

behat_course::i_turn_editing_mode_on ( )
inherited

Turns editing mode on.

@Given /^I turn editing mode on$/

◆ i_turn_section_highlighting_off()

behat_course::i_turn_section_highlighting_off (   $sectionnumber)
inherited

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)
inherited

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)
inherited

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)
inherited

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)
inherited

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 ( )
protectedinherited

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

Return values
bool

◆ is_editing_on()

behat_course::is_editing_on ( )
protectedinherited

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

Return values
bool

◆ is_in_app()

behat_base::is_in_app ( )
protectedinherited

Checks if the current page is part of the mobile app.

Return values
boolTrue if it's in the app

◆ js_trigger_click()

behat_base::js_trigger_click (   $node)
protectedinherited

Trigger click on node via javascript instead of actually clicking on it via pointer.

This function resolves the issue of nested elements with click listeners or links - in these cases clicking via the pointer may accidentally cause a click on the wrong element. Example of issue: clicking to expand navigation nodes when the config value linkadmincategories is enabled.

Parameters
NodeElement$node

◆ listing_is_highlighted()

behat_course::listing_is_highlighted (   $self,
  $selector 
)
protectedinherited

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

◆ locate_path()

behat_base::locate_path (   $path)
protectedinherited

Locates url, based on provided path.

Override to provide custom routing mechanism.

See also
Behat\MinkExtension\Context\MinkContext
Parameters
string$path
Return values
string

◆ look_for_exceptions()

behat_base::look_for_exceptions ( )
inherited

Internal step definition to find exceptions, debugging() messages and PHP debug messages.

Part of behat_hooks class as is part of the testing framework, is auto-executed after each step so no features will splicitly use it.

Exceptions
ExceptionUnknown type, depending on what we caught in the hook or basic Exception.
See also
Moodle\BehatExtension\Tester\MoodleStepTester

◆ normalise_selector()

behat_base::normalise_selector ( string  $selector,
  $locator,
Element  $container 
)
inherited

Normalise the locator and selector.

Parameters
string$selectorThe type of thing to search
mixed$locatorThe locator value. Can be an array, but is more likely a string.
Element$containerAn optional container to search within
Return values
arrayThe selector, locator, and container to search within

◆ require_javascript()

behat_base::require_javascript ( )
protectedinherited

Require that javascript be available in the current Session.

Exceptions
DriverException

◆ require_javascript_in_session()

static behat_base::require_javascript_in_session ( Session  $session)
staticprotectedinherited

Require that javascript be available for the specified Session.

Parameters
Session$session
Exceptions
DriverException

◆ resize_window()

behat_base::resize_window (   $windowsize,
  $viewport = false 
)
protectedinherited

Change browser window size.

  • small: 640x480
  • medium: 1024x768
  • large: 2560x1600
Parameters
string$windowsizesize of window.
bool$viewportIf true, changes viewport rather than window size
Exceptions
ExpectationException

◆ resolve_page_instance_url()

behat_base::resolve_page_instance_url ( string  $type,
string  $identifier 
)
protectedinherited

Convert page names to URLs for steps like 'When I am on the "[identifier]" "[page type]" page'.

A typical example might be: When I am on the "Test quiz" "mod_quiz > Responses report" page which would cause this method in behat_mod_quiz to be called with arguments 'Responses report', 'Test quiz'.

You should override this as appropriate for your plugin. The method behat_navigation::resolve_core_page_instance_url() is a good example.

Your overridden method should document the recognised page types with a table like this:

Recognised page names are: | Type | identifier meaning | Description |

Parameters
string$typeidentifies which type of page this is, e.g. 'Attempt review'.
string$identifieridentifies the particular page, e.g. 'Test quiz > student > Attempt 1'.
Return values
moodle_urlthe corresponding URL.
Exceptions
Exceptionwith a meaningful error message if the specified page cannot be found.

Reimplemented in behat_mod_quiz, and behat_core_form.

◆ resolve_page_url()

behat_base::resolve_page_url ( string  $page)
protectedinherited

Convert page names to URLs for steps like 'When I am on the "[page name]" page'.

You should override this as appropriate for your plugin. The method behat_navigation::resolve_core_page_url() is a good example.

Your overridden method should document the recognised page types with a table like this:

Recognised page names are: | Page | Description |

Parameters
string$pagename of the page, with the component name removed e.g. 'Admin notification'.
Return values
moodle_urlthe corresponding URL.
Exceptions
Exceptionwith a meaningful error message if the specified page cannot be found.

Reimplemented in behat_mod_quiz, and behat_core_form.

◆ running_javascript()

behat_base::running_javascript ( )
protectedinherited

Whether Javascript is available in the current Session.

Return values
boolean

◆ running_javascript_in_session()

static behat_base::running_javascript_in_session ( Session  $session)
staticprotectedinherited

Whether Javascript is available in the specified Session.

Parameters
Session$session
Return values
boolean

◆ section_activities_should_be_hidden()

behat_course::section_activities_should_be_hidden (   $sectionnumber)
inherited

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)
protectedinherited

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)
inherited

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)
inherited

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)
inherited

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)
inherited

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

◆ set_user()

static behat_base::set_user (   $user = null)
staticinherited

Set current $USER, reset access cache.

In some cases, behat will execute the code as admin but in many cases we need to set an specific user as some API's might rely on the logged user to take some action.

Parameters
null | int | stdClass$useruser record, null or 0 means non-logged-in, positive integer means userid

◆ show_section_link_exists()

behat_course::show_section_link_exists (   $sectionnumber)
protectedinherited

Returns the show section icon or throws an exception.

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

◆ spin()

behat_base::spin (   $lambda,
  $args = false,
  $timeout = false,
  $exception = false,
  $microsleep = false 
)
protectedinherited

Executes the passed closure until returns true or time outs.

In most cases the document.readyState === 'complete' will be enough, but sometimes JS requires more time to be completely loaded or an element to be visible or whatever is required to perform some action on an element; this method receives a closure which should contain the required statements to ensure the step definition actions and assertions have all their needs satisfied and executes it until they are satisfied or it timeouts. Redirects the return of the closure to the caller.

The closures requirements to work well with this spin method are:

  • Must return false, null or '' if something goes wrong
  • Must return something != false if finishes as expected, this will be the (mixed) value returned by spin()

The arguments of the closure are mixed, use $args depending on your needs.

You can provide an exception to give more accurate feedback to tests writers, otherwise the closure exception will be used, but you must provide an exception if the closure does not throw an exception.

Exceptions
ExceptionIf it timeouts without receiving something != false from the closure
Parameters
Function | array | string$lambdaThe function to execute or an array passed to call_user_func (maps to a class method)
mixed$argsArguments to pass to the closure
int$timeoutTimeout in seconds
Exception$exceptionThe exception to throw in case it time outs.
bool$microsleepIf set to true it'll sleep micro seconds rather than seconds.
Return values
mixedThe value returned by the closure

◆ transform_selector()

behat_base::transform_selector (   $selectortype,
  $element 
)
protectedinherited

Transforms from step definition's argument style to Mink format.

Mink has 3 different selectors css, xpath and named, where named selectors includes link, button, field... to simplify and group multiple steps in one we use the same interface, considering all link, buttons... at the same level as css selectors and xpath; this method makes the conversion from the arguments received by the steps to the selectors and locators required to interact with Mink.

Exceptions
ExpectationException
Parameters
string$selectortypeIt can be css, xpath or any of the named selectors.
string$elementThe locator (or string) we are looking for.
Return values
arrayContains the selector and the locator expected by Mink.

◆ transform_text_selector()

behat_base::transform_text_selector (   $selectortype,
  $element 
)
protectedinherited

Transforms from step definition's argument style to Mink format.

Delegates all the process to behat_base::transform_selector() checking the provided $selectortype.

Exceptions
ExpectationException
Parameters
string$selectortypeIt can be css, xpath or any of the named selectors.
string$elementThe locator (or string) we are looking for.
Return values
arrayContains the selector and the locator expected by Mink.

◆ user_clicks_on_management_listing_action()

behat_course::user_clicks_on_management_listing_action (   $listingtype,
  $listingnode,
  $action 
)
protectedinherited

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

◆ user_moves_listing_by_one()

behat_course::user_moves_listing_by_one (   $listingtype,
  $listingnode,
  $direction,
  $highlight = true 
)
protectedinherited

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.

◆ wait_for_pending_js()

behat_base::wait_for_pending_js ( )
inherited

Waits for all the JS to be loaded.

Return values
boolWhether any JS is still pending completion.

◆ wait_for_pending_js_in_session()

static behat_base::wait_for_pending_js_in_session ( Session  $session)
staticinherited

Waits for all the JS to be loaded.

Parameters
Session$sessionThe Mink Session where JS can be run
Return values
boolWhether any JS is still pending completion.

Member Data Documentation

◆ EXTENDED_TIMEOUT

const behat_base::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 4.1
See also
behat_base::get_extended_timeout()

◆ PAGE_READY_JS

const behat_base::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_base::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 4.1
See also
behat_base::get_reduced_timeout()

◆ TIMEOUT

const behat_base::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 4.1
See also
behat_base::get_timeout()

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