[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/tests/behat/ -> behat_general.php (summary)

General use steps definitions.

Copyright: 2012 David Monllaó
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1585 lines (70 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 lib/behat/behat_base.php

Defines 1 class

behat_general:: (61 methods):
  i_am_on_homepage()
  i_am_on_site_homepage()
  reload()
  i_wait_to_be_redirected()
  switch_to_iframe()
  switch_to_the_main_frame()
  switch_to_window()
  switch_to_the_main_window()
  accept_currently_displayed_alert_dialog()
  dismiss_currently_displayed_alert_dialog()
  click_link()
  i_wait_seconds()
  wait_until_the_page_is_ready()
  wait_until_exists()
  wait_until_does_not_exists()
  i_hover()
  i_click_on()
  i_take_focus_off_field()
  i_click_on_confirming_the_dialogue()
  i_click_on_dismissing_the_dialogue()
  i_click_on_in_the()
  i_drag_and_i_drop_it_in()
  should_be_visible()
  should_not_be_visible()
  in_the_should_be_visible()
  in_the_should_not_be_visible()
  assert_page_contains_text()
  assert_page_not_contains_text()
  assert_element_contains_text()
  assert_element_not_contains_text()
  should_appear_before()
  should_appear_after()
  the_element_should_be_disabled()
  the_element_should_be_enabled()
  the_element_should_be_readonly()
  the_element_should_not_be_readonly()
  should_exist()
  should_not_exist()
  i_trigger_cron()
  i_run_the_scheduled_task()
  should_exist_in_the()
  should_not_exist_in_the()
  i_change_window_size_to()
  the_attribute_of_should_contain()
  the_attribute_of_should_not_contain()
  row_column_of_table_should_contain()
  row_column_of_table_should_not_contain()
  following_should_exist_in_the_table()
  following_should_not_exist_in_the_table()
  download_file_from_link()
  following_should_download_bytes()
  following_should_download_between_and_bytes()
  i_start_watching_to_see_if_a_new_page_loads()
  a_new_page_should_have_loaded_since_i_started_watching()
  a_new_page_should_not_have_loaded_since_i_started_watching()
  get_page_load_xpath()
  i_pause_scenario_executon()
  i_press_in_the_browser()
  i_press_key_in_element()
  i_post_tab_key_in_element()
  database_family_used_is_one_of_the_following()


Class: behat_general  - X-Ref

Cross component steps definitions.

Basic web application definitions from MinkExtension and
BehatchExtension. Definitions modified according to our needs
when necessary and including only the ones we need to avoid
overlapping and confusion.

i_am_on_homepage()   X-Ref
Opens Moodle homepage.


i_am_on_site_homepage()   X-Ref
Opens Moodle site homepage.


reload()   X-Ref
Reloads the current page.


i_wait_to_be_redirected()   X-Ref
Follows the page redirection. Use this step after any action that shows a message and waits for a redirection


switch_to_iframe($iframename)   X-Ref
Switches to the specified iframe.

param: string $iframename

switch_to_the_main_frame()   X-Ref
No description

switch_to_window($windowname)   X-Ref
Switches to the specified window. Useful when interacting with popup windows.

param: string $windowname

switch_to_the_main_window()   X-Ref
Switches to the main Moodle window. Useful when you finish interacting with popup windows.


accept_currently_displayed_alert_dialog()   X-Ref
Accepts the currently displayed alert dialog. This step does not work in all the browsers, consider it experimental.


dismiss_currently_displayed_alert_dialog()   X-Ref
Dismisses the currently displayed alert dialog. This step does not work in all the browsers, consider it experimental.


click_link($link)   X-Ref
Clicks link with specified id|title|alt|text.

param: string $link

i_wait_seconds($seconds)   X-Ref
Waits X seconds. Required after an action that requires data from an AJAX request.

param: int $seconds

wait_until_the_page_is_ready()   X-Ref
Waits until the page is completely loaded. This step is auto-executed after every step.


wait_until_exists($element, $selectortype)   X-Ref
Waits until the provided element selector exists in the DOM

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.
param: string $element
param: string $selector
return: void

wait_until_does_not_exists($element, $selectortype)   X-Ref
Waits until the provided element does not exist in the DOM

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.
param: string $element
param: string $selector
return: void

i_hover($element, $selectortype)   X-Ref
Generic mouse over action. Mouse over a element of the specified type.

param: string $element Element we look for
param: string $selectortype The type of what we look for

i_click_on($element, $selectortype)   X-Ref
Generic click action. Click on the element of the specified type.

param: string $element Element we look for
param: string $selectortype The type of what we look for

i_take_focus_off_field($element, $selectortype)   X-Ref
Sets the focus and takes away the focus from an element, generating blur JS event.

param: string $element Element we look for
param: string $selectortype The type of what we look for

i_click_on_confirming_the_dialogue($element, $selectortype)   X-Ref
Clicks the specified element and confirms the expected dialogue.

param: string $element Element we look for
param: string $selectortype The type of what we look for

i_click_on_dismissing_the_dialogue($element, $selectortype)   X-Ref
Clicks the specified element and dismissing the expected dialogue.

param: string $element Element we look for
param: string $selectortype The type of what we look for

i_click_on_in_the($element, $selectortype, $nodeelement, $nodeselectortype)   X-Ref
Click on the element of the specified type which is located inside the second element.

param: string $element Element we look for
param: string $selectortype The type of what we look for
param: string $nodeelement Element we look in
param: string $nodeselectortype The type of selector where we look in

i_drag_and_i_drop_it_in($element, $selectortype, $containerelement, $containerselectortype)   X-Ref
Drags and drops the specified element to the specified container. This step does not work in all the browsers, consider it experimental.

The steps definitions calling this step as part of them should
manage the wait times by themselves as the times and when the
waits should be done depends on what is being dragged & dropper.

param: string $element
param: string $selectortype
param: string $containerelement
param: string $containerselectortype

should_be_visible($element, $selectortype)   X-Ref
Checks, that the specified element is visible. Only available in tests using Javascript.

param: string $element
param: string $selectortype
return: void

should_not_be_visible($element, $selectortype)   X-Ref
Checks, that the existing element is not visible. Only available in tests using Javascript.

As a "not" method, it's performance could not be good, but in this
case the performance is good because the element must exist,
otherwise there would be a ElementNotFoundException, also here we are
not spinning until the element is visible.

param: string $element
param: string $selectortype
return: void

in_the_should_be_visible($element, $selectortype, $nodeelement, $nodeselectortype)   X-Ref
Checks, that the specified element is visible inside the specified container. Only available in tests using Javascript.

param: string $element Element we look for
param: string $selectortype The type of what we look for
param: string $nodeelement Element we look in
param: string $nodeselectortype The type of selector where we look in

in_the_should_not_be_visible($element, $selectortype, $nodeelement, $nodeselectortype)   X-Ref
Checks, that the existing element is not visible inside the existing container. Only available in tests using Javascript.

As a "not" method, it's performance could not be good, but in this
case the performance is good because the element must exist,
otherwise there would be a ElementNotFoundException, also here we are
not spinning until the element is visible.

param: string $element Element we look for
param: string $selectortype The type of what we look for
param: string $nodeelement Element we look in
param: string $nodeselectortype The type of selector where we look in

assert_page_contains_text($text)   X-Ref
Checks, that page contains specified text. It also checks if the text is visible when running Javascript tests.

param: string $text

assert_page_not_contains_text($text)   X-Ref
No description

assert_element_contains_text($text, $element, $selectortype)   X-Ref
No description

assert_element_not_contains_text($text, $element, $selectortype)   X-Ref
No description

should_appear_before($preelement, $preselectortype, $postelement, $postselectortype)   X-Ref
No description

should_appear_after($postelement, $postselectortype, $preelement, $preselectortype)   X-Ref
Checks, that the first specified element appears after the second one.

param: string $postelement The locator of the latest element
param: string $postselectortype The selector type of the latest element
param: string $preelement The locator of the preceding element
param: string $preselectortype The locator of the preceding element

the_element_should_be_disabled($element, $selectortype)   X-Ref
Checks, that element of specified type is disabled.

param: string $element Element we look in
param: string $selectortype The type of element where we are looking in.

the_element_should_be_enabled($element, $selectortype)   X-Ref
Checks, that element of specified type is enabled.

param: string $element Element we look on
param: string $selectortype The type of where we look

the_element_should_be_readonly($element, $selectortype)   X-Ref
Checks the provided element and selector type are readonly on the current page.

param: string $element Element we look in
param: string $selectortype The type of element where we are looking in.

the_element_should_not_be_readonly($element, $selectortype)   X-Ref
Checks the provided element and selector type are not readonly on the current page.

param: string $element Element we look in
param: string $selectortype The type of element where we are looking in.

should_exist($element, $selectortype)   X-Ref
Checks the provided element and selector type exists in the current page.

This step is for advanced users, use it if you don't find anything else suitable for what you need.

param: string $element The locator of the specified selector
param: string $selectortype The selector type

should_not_exist($element, $selectortype)   X-Ref
Checks that the provided element and selector type not exists in the current page.

This step is for advanced users, use it if you don't find anything else suitable for what you need.

param: string $element The locator of the specified selector
param: string $selectortype The selector type

i_trigger_cron()   X-Ref
No description

i_run_the_scheduled_task($taskname)   X-Ref
Runs a scheduled task immediately, given full class name.

This is faster and more reliable than running cron (running cron won't
work more than once in the same test, for instance). However it is
a little less 'realistic'.

While the task is running, we suppress mtrace output because it makes
the Behat result look ugly.

Note: Most of the code relating to running a task is based on
admin/tool/task/cli/schedule_task.php.

param: string $taskname Name of task e.g. 'mod_whatever\task\do_something'

should_exist_in_the($element, $selectortype, $containerelement, $containerselectortype)   X-Ref
Checks that an element and selector type exists in another element and selector type on the current page.

This step is for advanced users, use it if you don't find anything else suitable for what you need.

param: string $element The locator of the specified selector
param: string $selectortype The selector type
param: string $containerelement The container selector type
param: string $containerselectortype The container locator

should_not_exist_in_the($element, $selectortype, $containerelement, $containerselectortype)   X-Ref
Checks that an element and selector type does not exist in another element and selector type on the current page.

This step is for advanced users, use it if you don't find anything else suitable for what you need.

param: string $element The locator of the specified selector
param: string $selectortype The selector type
param: string $containerelement The container selector type
param: string $containerselectortype The container locator

i_change_window_size_to($windowviewport, $windowsize)   X-Ref
Change browser window size small: 640x480, medium: 1024x768, large: 2560x1600, custom: widthxheight

Example: I change window size to "small" or I change window size to "1024x768"
or I change viewport size to "800x600". The viewport option is useful to guarantee that the
browser window has same viewport size even when you run Behat on multiple operating systems.

param: string $windowsize size of the window (small|medium|large|wxh).

the_attribute_of_should_contain($attribute, $element, $selectortype, $text)   X-Ref
Checks whether there is an attribute on the given element that contains the specified text.

param: string $attribute Name of attribute
param: string $element The locator of the specified selector
param: string $selectortype The selector type
param: string $text Expected substring

the_attribute_of_should_not_contain($attribute, $element, $selectortype, $text)   X-Ref
Checks that the attribute on the given element does not contain the specified text.

param: string $attribute Name of attribute
param: string $element The locator of the specified selector
param: string $selectortype The selector type
param: string $text Expected substring

row_column_of_table_should_contain($row, $column, $table, $value)   X-Ref
Checks the provided value exists in specific row/column of table.

param: string $row row text which will be looked in.
param: string $column column text to search (or numeric value for the column position)
param: string $table table id/class/caption
param: string $value text to check.

row_column_of_table_should_not_contain($row, $column, $table, $value)   X-Ref
Checks the provided value should not exist in specific row/column of table.

param: string $row row text which will be looked in.
param: string $column column text to search
param: string $table table id/class/caption
param: string $value text to check.

following_should_exist_in_the_table($table, TableNode $data)   X-Ref
Checks that the provided value exist in table.
More info in http://docs.moodle.org/dev/Acceptance_testing#Providing_values_to_steps.

First row may contain column headers or numeric indexes of the columns
(syntax -1- is also considered to be column index). Column indexes are
useful in case of multirow headers and/or presence of cells with colspan.

param: string $table name of table
param: TableNode $data table with first row as header and following values

following_should_not_exist_in_the_table($table, TableNode $data)   X-Ref
Checks that the provided value exist in table.
More info in http://docs.moodle.org/dev/Acceptance_testing#Providing_values_to_steps.

param: string $table name of table
param: TableNode $data table with first row as header and following values

download_file_from_link($link)   X-Ref
Given the text of a link, download the linked file and return the contents.

This is a helper method used by {@link following_should_download_bytes()}
and {@link following_should_download_between_and_bytes()}

param: string $link the text of the link.
return: string the content of the downloaded file.

following_should_download_bytes($link, $expectedsize)   X-Ref
Downloads the file from a link on the page and checks the size.

Only works if the link has an href attribute. Javascript downloads are
not supported. Currently, the href must be an absolute URL.

param: string $link the text of the link.
param: number $expectedsize the expected file size in bytes.

following_should_download_between_and_bytes($link, $minexpectedsize, $maxexpectedsize)   X-Ref
No description

i_start_watching_to_see_if_a_new_page_loads()   X-Ref
No description

a_new_page_should_have_loaded_since_i_started_watching()   X-Ref
Verify that a new page has loaded (or the same page has reloaded) since the
last "I start watching to see if a new page loads" step.


a_new_page_should_not_have_loaded_since_i_started_watching()   X-Ref
Verify that a new page has not loaded (or the same page has reloaded) since the
last "I start watching to see if a new page loads" step.


get_page_load_xpath()   X-Ref
Helper used by {@link a_new_page_should_have_loaded_since_i_started_watching}
and {@link a_new_page_should_not_have_loaded_since_i_started_watching}

return: string xpath expression.

i_pause_scenario_executon()   X-Ref
Wait unit user press Enter/Return key. Useful when debugging a scenario.


i_press_in_the_browser($button)   X-Ref
Presses a given button in the browser.
NOTE: Phantomjs and goutte driver reloads page while navigating back and forward.

param: string $button the button to press.

i_press_key_in_element($key, $element, $selectortype)   X-Ref
Trigger a keydown event for a key on a specific element.

param: string $key either char-code or character itself,
param: string $element Element we look for
param: string $selectortype The type of what we look for

i_post_tab_key_in_element($element, $selectortype)   X-Ref
Press tab key on a specific element.

param: string $element Element we look for
param: string $selectortype The type of what we look for

database_family_used_is_one_of_the_following(TableNode $databasefamilies)   X-Ref
Checks if database family used is using one of the specified, else skip. (mysql, postgres, mssql, oracle, etc.)

param: TableNode $databasefamilies list of database.
return: void.



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1