Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
behat_form_date Class Reference
Inheritance diagram for behat_form_date:
behat_form_group behat_form_field behat_session_interface behat_form_date_time

Public Member Functions

 get_attribute ($name)
 Get the value of an attribute set on this field. More...
 
 get_value ()
 Returns the current value of the select element. More...
 
 getSession ($name=null)
 Returns the Mink session. More...
 
 key_press ($char, $modifier=null)
 Presses specific keyboard key. More...
 
 matches ($expectedvalue)
 Generic match implementation. More...
 
 set_value ($value)
 Sets the value to a date field. 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_field_instance_for_element (NodeElement $element)
 Returns the appropriate form field object for a given node element. More...
 
 get_field_locator ($locatortype=false)
 Gets the field locator. More...
 
 get_internal_field_id ()
 Gets the field internal id used by selenium wire protocol. More...
 
 get_mapped_fields (int $timestamp)
 Returns the date field identifiers and the values that should be assigned to them. More...
 
 running_javascript ()
 Returns whether the scenario is running in a browser that can run Javascript or not. More...
 
 text_matches ($expectedvalue)
 Checks if the provided text matches the field value. More...
 
 wait_for_pending_js ()
 Waits for all the JS activity to be completed. More...
 

Protected Attributes

NodeElement $field
 The field DOM node to interact with.
 
string $fieldlocator = false
 The field's locator.
 
Session $session
 Behat session.
 

Member Function Documentation

◆ get_attribute()

behat_form_field::get_attribute (   $name)
inherited

Get the value of an attribute set on this field.

Parameters
string$nameThe attribute name
Return values
stringThe attribute value

◆ get_field_instance_for_element()

behat_form_field::get_field_instance_for_element ( NodeElement  $element)
protectedinherited

Returns the appropriate form field object for a given node element.

Parameters
NodeElement$elementThe node element
Return values
behat_form_field

◆ get_field_locator()

behat_form_field::get_field_locator (   $locatortype = false)
protectedinherited

Gets the field locator.

Defaults to the field label but you can specify other locators if you are interested.

Public visibility as in most cases will be hard to use this method in a generic way, as fields can be selected using multiple ways (label, id, name...).

Exceptions
coding_exception
Parameters
string$locatortype
Return values
string

◆ get_internal_field_id()

behat_form_field::get_internal_field_id ( )
protectedinherited

Gets the field internal id used by selenium wire protocol.

Only available when running_javascript().

Exceptions
coding_exception
Return values
int

◆ get_mapped_fields()

behat_form_date::get_mapped_fields ( int  $timestamp)
protected

Returns the date field identifiers and the values that should be assigned to them.

Parameters
int$timestampThe UNIX timestamp
Return values
array

Reimplemented in behat_form_date_time.

◆ get_value()

behat_form_field::get_value ( )
inherited

Returns the current value of the select element.

Return values
string

Reimplemented in behat_form_checkbox, behat_form_filemanager, behat_form_radio, behat_form_select, and behat_form_text.

◆ getSession()

behat_form_field::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

Implements behat_session_interface.

◆ key_press()

behat_form_field::key_press (   $char,
  $modifier = null 
)
inherited

Presses specific keyboard key.

Parameters
mixed$charcould be either char ('b') or char-code (98)
string$modifierkeyboard modifier (could be 'ctrl', 'alt', 'shift' or 'meta')

◆ matches()

behat_form_field::matches (   $expectedvalue)
inherited

Generic match implementation.

Will work well with text-based fields, extension required for most of the other cases.

Parameters
string$expectedvalue
Return values
boolThe provided value matches the field value?

Reimplemented in behat_form_editor, behat_form_filemanager, behat_form_select, behat_form_text, and behat_form_checkbox.

◆ running_javascript()

behat_form_field::running_javascript ( )
protectedinherited

Returns whether the scenario is running in a browser that can run Javascript or not.

Return values
bool

◆ set_value()

behat_form_date::set_value (   $value)

Sets the value to a date field.

Parameters
string$valueThe value to be assigned to the date selector field. The string value must be either parsable into a UNIX timestamp or equal to 'disabled' (if disabling the date selector).
Return values
void
Exceptions
ExpectationExceptionIf the value is invalid.

Reimplemented from behat_form_field.

◆ text_matches()

behat_form_field::text_matches (   $expectedvalue)
protectedinherited

Checks if the provided text matches the field value.

Parameters
string$expectedvalue
Return values
bool

◆ wait_for_pending_js()

behat_form_field::wait_for_pending_js ( )
protectedinherited

Waits for all the JS activity to be completed.

Return values
boolWhether any JS is still pending completion.

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: