Class representing a named selector that can be used in Behat tests.
Copyright: | 2019 Andrew Nicols <andrew@nicols.co.uk> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 124 lines (5 kb) |
Included or required: | 1 time |
Referenced: | 0 times |
Includes or requires: | 0 files |
behat_component_named_selector:: (5 methods):
__construct()
is_text_selector()
get_name()
get_alias()
get_combined_xpath()
Class: behat_component_named_selector - X-Ref
Class representing a named selector that can be used in Behat tests.__construct(string $alias, array $xpaths, bool $istextselector = true) X-Ref |
Create the selector definition. As an example, if you define new behat_component_named_selector('Message', [".//*[@data-conversation-id]//img[contains(@alt, %locator%)]/.."]) in get_partial_named_selectors in behat_message in message/tests/behat/behat_message.php, then steps like When "Group 1" "core_message > Message" should exist will work. Text selectors are things that contain other things (e.g. some particular text), e.g. Then I can see "Some text" in the "Whatever" "text_selector" whereas non-text selectors are atomic things, like When I click the "Whatever" "widget". param: string $alias The 'friendly' name of the thing. This will be prefixed with the component name. param: array $xpaths A list of xpaths one or more XPaths that the selector gets transformed into. param: bool $istextselector Whether this selector can also be used as a text selector. |
is_text_selector() X-Ref |
Whether this is a text selector. return: bool |
get_name(string $component) X-Ref |
Get the name of the selector. This is a back-end feature and contains a namespaced md5 of the human-readable name. param: string $component return: string |
get_alias(string $component) X-Ref |
Get the alias of the selector. This is the human-readable name that you would typically interact with. param: string $component return: string |
get_combined_xpath() X-Ref |
Get the list of combined xpaths. return: string The list of xpaths combined with the xpath | (OR) operator |