Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
Public Member Functions | |
getSession ($name=null) | |
Returns the Mink session. More... | |
i_click_on_item_in_the_autocomplete_list ($item) | |
Select item from autocomplete list. More... | |
i_expand_all_fieldsets () | |
Expands all moodleform's fields, including collapsed fieldsets and advanced fields if they are present. More... | |
i_expand_the_autocomplete ($field) | |
Expand the given autocomplete list. More... | |
i_open_the_autocomplete_suggestions_list ($container=null, $containertype=null) | |
Open the auto-complete suggestions list (Assuming there is only one on the page.). More... | |
i_press_key_in_the_field ($key, $field) | |
Press the key in the field to trigger the javascript keypress event. More... | |
i_select_from_the_singleselect ($option, $singleselect) | |
Select a value from single select and redirect. More... | |
i_set_the_field_in_container_to ($field, $containerelement, $containerselectortype, $value) | |
Sets the specified value to the field. More... | |
i_set_the_field_to ($field, $value) | |
Sets the specified value to the field. More... | |
i_set_the_field_to_local_url ($field, $path) | |
Sets the field to wwwroot plus the given path. More... | |
i_set_the_field_to_multiline ($field, PyStringNode $value) | |
Sets the specified value to the field. More... | |
i_set_the_field_with_xpath_to ($fieldxpath, $value) | |
Sets the specified value to the field with xpath. More... | |
i_set_the_following_fields_in_container_to_these_values ( $containerelement, $containerselectortype, TableNode $data) | |
Fills a form with field/value data. More... | |
i_set_the_following_fields_to_these_values (TableNode $data) | |
Fills a form with field/value data. More... | |
i_should_see_in_the_list_of_option_for_the_autocomplete ($option, $field) | |
Assert the given option exist in the given autocomplete list. More... | |
press_button ($button) | |
Presses button with specified id|name|title|alt|value. More... | |
press_button_and_switch_to_main_window ($button) | |
Press button with specified id|name|title|alt|value and switch to main window. More... | |
set_field_node_value (NodeElement $fieldnode, string $value) | |
Generic field setter to be used by chainable steps. More... | |
the_field_does_not_match_value ($field, $value) | |
Checks, the field does not match the value. More... | |
the_field_in_container_does_not_match_value ($field, $containerelement, $containerselectortype, $value) | |
Checks, the field does not match the value. More... | |
the_field_in_container_matches_value ($field, $containerelement, $containerselectortype, $value) | |
Checks, the field matches the value. More... | |
the_field_matches_multiline ($field, PyStringNode $value) | |
Checks, the field matches the value. More... | |
the_field_matches_value ($field, $value) | |
Checks, the field matches the value. More... | |
the_field_with_xpath_does_not_match_value ($fieldxpath, $value) | |
Checks, the field does not match the value. More... | |
the_field_with_xpath_matches_value ($fieldxpath, $value) | |
Checks, the field matches the value. More... | |
the_following_fields_do_not_match_these_values (TableNode $data) | |
Checks that the provided field/value pairs don't match. More... | |
the_following_fields_in_container_do_not_match_these_values ( $containerelement, $containerselectortype, TableNode $data) | |
Checks that the provided field/value pairs don't match. More... | |
the_following_fields_in_container_match_these_values ( $containerelement, $containerselectortype, TableNode $data) | |
Checks, the provided field/value matches. More... | |
the_following_fields_match_these_values (TableNode $data) | |
Checks, the provided field/value matches. More... | |
the_select_box_should_contain ($select, $option) | |
Checks, that given select box contains the specified option. More... | |
the_select_box_should_not_contain ($select, $option) | |
Checks, that given select box does not contain the specified option. 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 | |
expand_all_fields () | |
Expands all moodle form fieldsets if they exists. More... | |
set_field_value ($fieldlocator, $value) | |
Generic field setter. More... | |
set_field_value_in_container ($fieldlocator, $value, $containerselectortype, $containerelement) | |
Generic field setter. More... | |
|
protected |
Expands all moodle form fieldsets if they exists.
Externalized from i_expand_all_fields to call it from other form-related steps without having to use steps-group calls.
ElementNotFoundException | Thrown by behat_base::find_all |
void |
|
inherited |
Returns the Mink session.
string | null | $name | name of the session OR active session will be used |
Behat::Mink::Session |
Implemented in behat_form_field.
behat_forms::i_click_on_item_in_the_autocomplete_list | ( | $item | ) |
Select item from autocomplete list.
@Given /^I click on "([^"]*)" item in the autocomplete list$/
string | $item |
behat_forms::i_expand_all_fieldsets | ( | ) |
Expands all moodleform's fields, including collapsed fieldsets and advanced fields if they are present.
@Given /^I expand all fieldsets$/
behat_forms::i_expand_the_autocomplete | ( | $field | ) |
Expand the given autocomplete list.
@Given /^I expand the "(?P<field_string>(?:[^"]|::")*)" autocomplete$/
string | $field | Field name |
behat_forms::i_open_the_autocomplete_suggestions_list | ( | $container = null , |
|
$containertype = null |
|||
) |
Open the auto-complete suggestions list (Assuming there is only one on the page.).
@Given I open the autocomplete suggestions list @Given I open the autocomplete suggestions list in the :container :containertype
behat_forms::i_press_key_in_the_field | ( | $key, | |
$field | |||
) |
Press the key in the field to trigger the javascript keypress event.
Note that the character key will not actually be typed in the input field
@Given /^I press key "(?P<key_string>(?:[^"]|::")*)" in the field "(?P<field_string>(?:[^"]|")*)"$/
ElementNotFoundException | Thrown by behat_base::find |
string | $key | either char-code or character itself, may optionally be prefixed with ctrl-, alt-, shift- or meta- |
string | $field |
void |
behat_forms::i_select_from_the_singleselect | ( | $option, | |
$singleselect | |||
) |
Select a value from single select and redirect.
@Given /^I select "(?P<singleselect_option_string>(?:[^"]|::")*)" from the "(?P<singleselect_name_string>(?:[^"]|")*)" singleselect$/
behat_forms::i_set_the_field_in_container_to | ( | $field, | |
$containerelement, | |||
$containerselectortype, | |||
$value | |||
) |
Sets the specified value to the field.
@Given /^I set the field "(?P<field_string>(?:[^"]|::")*)" in the "(?P<element_container_string>(?:[^"]|")*)" "(?P<text_selector_string>[^"]*)" to "(?P<field_value_string>(?:[^"]|::")*)"$/
ElementNotFoundException | Thrown by behat_base::find |
string | $field | |
string | $containerelement | Element we look in |
string | $containerselectortype | The type of selector where we look in |
string | $value |
behat_forms::i_set_the_field_to | ( | $field, | |
$value | |||
) |
Sets the specified value to the field.
@Given /^I set the field "(?P<field_string>(?:[^"]|::")*)" to "(?P<field_value_string>(?:[^"]|")*)"$/
ElementNotFoundException | Thrown by behat_base::find |
string | $field | |
string | $value |
void |
behat_forms::i_set_the_field_to_local_url | ( | $field, | |
$path | |||
) |
Sets the field to wwwroot plus the given path.
Include the first slash.
@Given /^I set the field "(?P<field_string>(?:[^"]|::")*)" to local url "(?P<field_path_string>(?:[^"]|")*)"$/
ElementNotFoundException | Thrown by behat_base::find |
string | $field | |
string | $path |
void |
behat_forms::i_set_the_field_to_multiline | ( | $field, | |
PyStringNode | $value | ||
) |
Sets the specified value to the field.
@Given /^I set the field "(?P<field_string>(?:[^"]|::")*)" to multiline:$/
ElementNotFoundException | Thrown by behat_base::find |
string | $field | |
PyStringNode | $value |
void |
behat_forms::i_set_the_field_with_xpath_to | ( | $fieldxpath, | |
$value | |||
) |
Sets the specified value to the field with xpath.
@Given /^I set the field with xpath "(?P<fieldxpath_string>(?:[^"]|::")*)" to "(?P<field_value_string>(?:[^"]|")*)"$/
ElementNotFoundException | Thrown by behat_base::find |
string | $field | |
string | $value |
void |
behat_forms::i_set_the_following_fields_in_container_to_these_values | ( | $containerelement, | |
$containerselectortype, | |||
TableNode | $data | ||
) |
Fills a form with field/value data.
@Given /^I set the following fields in the "(?P<element_container_string>(?:[^"]|::")*)" "(?P<text_selector_string>[^"]*)" to these values:$/
ElementNotFoundException | Thrown by behat_base::find |
string | $containerelement | Element we look in |
string | $containerselectortype | The type of selector where we look in |
TableNode | $data |
behat_forms::i_set_the_following_fields_to_these_values | ( | TableNode | $data | ) |
Fills a form with field/value data.
@Given /^I set the following fields to these values:$/
ElementNotFoundException | Thrown by behat_base::find |
TableNode | $data |
behat_forms::i_should_see_in_the_list_of_option_for_the_autocomplete | ( | $option, | |
$field | |||
) |
Assert the given option exist in the given autocomplete list.
@Given /^I should see "(?P<option_string>(?:[^"]|::")*)" in the list of options for the "(?P<field_string>(?:[^"]|")*)" autocomplete$$/
string | $option | Name of option |
string | $field | Field name |
behat_forms::press_button | ( | $button | ) |
Presses button with specified id|name|title|alt|value.
@When /^I press "(?P<button_string>(?:[^"]|::")*)"$/
ElementNotFoundException | Thrown by behat_base::find |
string | $button |
behat_forms::press_button_and_switch_to_main_window | ( | $button | ) |
Press button with specified id|name|title|alt|value and switch to main window.
@When /^I press "(?P<button_string>(?:[^"]|::")*)" and switch to main window$/
ElementNotFoundException | Thrown by behat_base::find |
string | $button |
behat_forms::set_field_node_value | ( | NodeElement | $fieldnode, |
string | $value | ||
) |
Generic field setter to be used by chainable steps.
NodeElement | $fieldnode | |
string | $value |
|
protected |
Generic field setter.
Internal API method, a generic I set "VALUE" to "FIELD" field could be created based on it.
string | $fieldlocator | The pointer to the field, it will depend on the field type. |
string | $value |
void |
|
protected |
Generic field setter.
Internal API method, a generic I set "VALUE" to "FIELD" field could be created based on it.
string | $fieldlocator | The pointer to the field, it will depend on the field type. |
string | $value | the value to set |
string | $containerselectortype | The type of selector where we look in |
string | $containerelement | Element we look in |
behat_forms::the_field_does_not_match_value | ( | $field, | |
$value | |||
) |
Checks, the field does not match the value.
@Then /^the field "(?P<field_string>(?:[^"]|::")*)" does not match value "(?P<field_value_string>(?:[^"]|")*)"$/
ExpectationException | |
ElementNotFoundException | Thrown by behat_base::find |
string | $field | |
string | $value |
behat_forms::the_field_in_container_does_not_match_value | ( | $field, | |
$containerelement, | |||
$containerselectortype, | |||
$value | |||
) |
Checks, the field does not match the value.
@Then /^the field "(?P<field_string>(?:[^"]|::")*)" in the "(?P<element_container_string>(?:[^"]|")*)" "(?P<text_selector_string>[^"]*)" does not match value "(?P<field_value_string>(?:[^"]|::")*)"$/
ExpectationException | |
ElementNotFoundException | Thrown by behat_base::find |
string | $field | |
string | $containerelement | Element we look in |
string | $containerselectortype | The type of selector where we look in |
string | $value |
behat_forms::the_field_in_container_matches_value | ( | $field, | |
$containerelement, | |||
$containerselectortype, | |||
$value | |||
) |
Checks, the field matches the value.
@Then /^the field "(?P<field_string>(?:[^"]|::")*)" in the "(?P<element_container_string>(?:[^"]|")*)" "(?P<text_selector_string>[^"]*)" matches value "(?P<field_value_string>(?:[^"]|::")*)"$/
ElementNotFoundException | Thrown by behat_base::find |
string | $field | |
string | $containerelement | Element we look in |
string | $containerselectortype | The type of selector where we look in |
string | $value |
behat_forms::the_field_matches_multiline | ( | $field, | |
PyStringNode | $value | ||
) |
Checks, the field matches the value.
@Then /^the field "(?P<field_string>(?:[^"]|::")*)" matches multiline:$/
ElementNotFoundException | Thrown by behat_base::find |
string | $field | |
PyStringNode | $value |
void |
behat_forms::the_field_matches_value | ( | $field, | |
$value | |||
) |
Checks, the field matches the value.
@Then /^the field "(?P<field_string>(?:[^"]|::")*)" matches value "(?P<field_value_string>(?:[^"]|")*)"$/
ElementNotFoundException | Thrown by behat_base::find |
string | $field | |
string | $value |
void |
behat_forms::the_field_with_xpath_does_not_match_value | ( | $fieldxpath, | |
$value | |||
) |
Checks, the field does not match the value.
@Then /^the field with xpath "(?P<xpath_string>(?:[^"]|::")*)" does not match value "(?P<field_value_string>(?:[^"]|")*)"$/
ExpectationException | |
ElementNotFoundException | Thrown by behat_base::find |
string | $fieldxpath | |
string | $value |
void |
behat_forms::the_field_with_xpath_matches_value | ( | $fieldxpath, | |
$value | |||
) |
Checks, the field matches the value.
@Then /^the field with xpath "(?P<xpath_string>(?:[^"]|::")*)" matches value "(?P<field_value_string>(?:[^"]|")*)"$/
ExpectationException | |
ElementNotFoundException | Thrown by behat_base::find |
string | $fieldxpath | |
string | $value |
void |
behat_forms::the_following_fields_do_not_match_these_values | ( | TableNode | $data | ) |
Checks that the provided field/value pairs don't match.
@Then /^the following fields do not match these values:$/
ExpectationException |
TableNode | $data | Pairs of | field | value | |
behat_forms::the_following_fields_in_container_do_not_match_these_values | ( | $containerelement, | |
$containerselectortype, | |||
TableNode | $data | ||
) |
Checks that the provided field/value pairs don't match.
@Then /^the following fields in the "(?P<element_container_string>(?:[^"]|::")*)" "(?P<text_selector_string>[^"]*)" do not match these values:$/
ExpectationException |
string | $containerelement | Element we look in |
string | $containerselectortype | The type of selector where we look in |
TableNode | $data | Pairs of | field | value | |
behat_forms::the_following_fields_in_container_match_these_values | ( | $containerelement, | |
$containerselectortype, | |||
TableNode | $data | ||
) |
Checks, the provided field/value matches.
@Then /^the following fields in the "(?P<element_container_string>(?:[^"]|::")*)" "(?P<text_selector_string>[^"]*)" match these values:$/
ExpectationException |
string | $containerelement | Element we look in |
string | $containerselectortype | The type of selector where we look in |
TableNode | $data | Pairs of | field | value | |
behat_forms::the_following_fields_match_these_values | ( | TableNode | $data | ) |
Checks, the provided field/value matches.
@Then /^the following fields match these values:$/
ExpectationException |
TableNode | $data | Pairs of | field | value | |
behat_forms::the_select_box_should_contain | ( | $select, | |
$option | |||
) |
Checks, that given select box contains the specified option.
@Then /^the "(?P<select_string>(?:[^"]|::")*)" select box should contain "(?P<option_string>(?:[^"]|")*)"$/
ExpectationException | |
ElementNotFoundException | Thrown by behat_base::find |
string | $select | The select element name |
string | $option | The option text/value. Plain value or comma separated values if multiple. Commas in multiple values escaped with backslash. |
behat_forms::the_select_box_should_not_contain | ( | $select, | |
$option | |||
) |
Checks, that given select box does not contain the specified option.
@Then /^the "(?P<select_string>(?:[^"]|::")*)" select box should not contain "(?P<option_string>(?:[^"]|")*)"$/
ExpectationException | |
ElementNotFoundException | Thrown by behat_base::find |
string | $select | The select element name |
string | $option | The option text/value. Plain value or comma separated values if multiple. Commas in multiple values escaped with backslash. |
|
inherited |
And extended timeout for specific cases.
|
inherited |
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.
|
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.
|
inherited |
The timeout for each Behat step (load page, wait for an element to load...).