Actions

Difference between revisions of "Testing Area/Behat Testing/Steps"

From Mahara Wiki

< Testing Area‎ | Behat Testing
m
m
Line 1: Line 1:
 +
<br>Use these steps to create Behat tests
 +
<br>Copy and paste the steps in the order your need into a text editor (ie gedit or vim) to create your tests.
 +
 
{{note|Replace the "And" with "Given, When, Then" where necessary|reminder}}
 
{{note|Replace the "And" with "Given, When, Then" where necessary|reminder}}
  
Line 14: Line 17:
 
<br>If you want to set a user up with aditional admin permissions you have to do that manually.|reminder}}
 
<br>If you want to set a user up with aditional admin permissions you have to do that manually.|reminder}}
  
   @Given the following "users" exist:
+
   And the following "users" exist:
 
       | firstname | lastname | username |  
 
       | firstname | lastname | username |  
 
       | Student | User | student |
 
       | Student | User | student |
Line 22: Line 25:
  
 
Checks, that current page PATH is equal to specified. eg; And I should be on "Profile" would be written as; And I should be on "artefact/internal/index.php"  
 
Checks, that current page PATH is equal to specified. eg; And I should be on "Profile" would be written as; And I should be on "artefact/internal/index.php"  
   @Then I should be on "page path"
+
   And I should be on "page path"
  
 
Opens user profile.
 
Opens user profile.
   @Given I am on user profile
+
   And I am on user profile
  
 
Opens homepage.
 
Opens homepage.
   @When I go to the homepage
+
   And I go to the homepage
  
 
Opens Mahara homepage.
 
Opens Mahara homepage.
   @Given I am on homepage
+
   And I am on homepage
  
 
      
 
      
 
Checks, that current page is the homepage.
 
Checks, that current page is the homepage.
   @Then I should be on the homepage
+
   And I should be on the homepage
 
      
 
      
  
 
Reloads the current page.
 
Reloads the current page.
   @Given I reload the page
+
   And I reload the page
  
 
Waits until the page is completely loaded. This step is auto-executed after every step.
 
Waits until the page is completely loaded. This step is auto-executed after every step.
   @Given I wait until the page is ready
+
   And I wait until the page is ready
 
      
 
      
 
Opens specified page.
 
Opens specified page.
   @Given I am on "page
+
   And I am on "page
  
 
Opens specified page.
 
Opens specified page.
   @When I go to "page"
+
   And I go to "page"
  
 
Moves backward one page in history.
 
Moves backward one page in history.
   @When I move backward one page
+
   And I move backward one page
  
 
Moves forward one page in history
 
Moves forward one page in history
   @When I move forward one page
+
   And I move forward one page
 
      
 
      
 
Checks, that current page response status is equal to specified.
 
Checks, that current page response status is equal to specified.
   @Then the response status code should be 404
+
   And the response status code should be 404
 
      
 
      
 
      
 
      
 
Checks, that current page response status is not equal to specified.
 
Checks, that current page response status is not equal to specified.
   @Then the response status code should not be 404
+
   And the response status code should not be 404
  
 
      
 
      
Line 70: Line 73:
  
 
Switches to the specified iframe.
 
Switches to the specified iframe.
   @Given I switch to "$iframename" iframe
+
   And I switch to "$iframename" iframe
  
  
 
Switches to the main Mahara frame.
 
Switches to the main Mahara frame.
   @Given I switch to the main frame
+
   And I switch to the main frame
  
  
 
Switches to the specified window. Useful when interacting with popup windows.
 
Switches to the specified window. Useful when interacting with popup windows.
   @Given I switch to “windowname” windows
+
   And I switch to “windowname” windows
  
  
 
Switches to the main Mahara window. Useful when you finish interacting with popup windows.
 
Switches to the main Mahara window. Useful when you finish interacting with popup windows.
@Given I switch to the main window
+
  And I switch to the main window
 
   
 
   
  
Line 89: Line 92:
 
      
 
      
 
Waits X seconds. Required after an action that requires data from an AJAX request.
 
Waits X seconds. Required after an action that requires data from an AJAX request.
   @Then I wait "$numberofseconds" seconds
+
   And I wait "$numberofseconds" seconds
 
   
 
   
  
  
 
Waits until the provided element selector exists in the DOM
 
Waits until the provided element selector exists in the DOM
   @Given I wait until "$element" "$selector" exists
+
   And I wait until "$element" "$selector" exists
  
 
      
 
      
 
Waits until the provided element does not exist in the DOM
 
Waits until the provided element does not exist in the DOM
   @Given I wait until "element_string" "selector_string" does not exist
+
   And I wait until "element_string" "selector_string" does not exist
  
  
Line 104: Line 107:
  
 
Click on the specified element inside a table row containing the specified text.
 
Click on the specified element inside a table row containing the specified text.
   @Given I click on "element_string" "selector_string" in the "row_text_string" table row
+
   And I click on "element_string" "selector_string" in the "row_text_string" table row
  
  
Line 111: Line 114:
  
 
Generic mouse over action. Mouse over a element of the specified type.
 
Generic mouse over action. Mouse over a element of the specified type.
   @When I hover "$element" "$selector"
+
   And I hover "$element" "$selector"
 
      
 
      
  
  
 
Click on the element of the specified type which is located inside the second element.
 
Click on the element of the specified type which is located inside the second element.
   @When I click on "$element" "$selector"
+
   And I click on "$element" "$selector"
 
   
 
   
  
  
 
Click on the specified element inside a table row containing the specified text.
 
Click on the specified element inside a table row containing the specified text.
   @Given I click on "$element" "$selector" in the table row
+
   And I click on "$element" "$selector" in the table row
 
      
 
      
  
 
Clicks link with specified id|title|alt|text.
 
Clicks link with specified id|title|alt|text.
   @When I follow "id|title|alt|text"
+
   And I follow "id|title|alt|text"
  
  
 
Presses button with specified id|name|title|alt|value.
 
Presses button with specified id|name|title|alt|value.
   @When I press "BUTTON_STRING"
+
   And I press "BUTTON_STRING"
  
 
Drags and drops the specified element to the specified container. This step does not work in all the browsers, consider it experimental.
 
Drags and drops the specified element to the specified container. This step does not work in all the browsers, consider it experimental.
   @Given I drag "$element" "$selector" and I drop it in "$containerelement" ”$selector"
+
   And I drag "$element" "$selector" and I drop it in "$containerelement" ”$selector"
  
  
Line 139: Line 142:
 
      
 
      
 
Fills in form field with specified id|name|label|value.
 
Fills in form field with specified id|name|label|value.
   @When I fill in "field" with "value"
+
   And I fill in "field" with "value"
  
  
 
Fills in form field with specified id|name|label|value.
 
Fills in form field with specified id|name|label|value.
   @When I fill in "value" for "field"
+
   And I fill in "value" for "field"
 
      
 
      
 
      
 
      
 
Fills in form fields with provided table.
 
Fills in form fields with provided table.
   @When I fill in the following:
+
   And I fill in the following:
 
      
 
      
 
    
 
    
 
Selects option in select field with specified id|name|label|value.
 
Selects option in select field with specified id|name|label|value.
   @When I select "option" from "select"
+
   And I select "option" from "select"
 
      
 
      
 
      
 
      
 
Selects additional option in select field with specified id|name|label|value.
 
Selects additional option in select field with specified id|name|label|value.
   @When I additionally select "option" from "select"
+
   And I additionally select "option" from "select"
 
      
 
      
 
    
 
    
 
Checks checkbox with specified id|name|label|value.
 
Checks checkbox with specified id|name|label|value.
   @When I check "option"
+
   And I check "option"
 
      
 
      
 
      
 
      
 
Unchecks checkbox with specified id|name|label|value.
 
Unchecks checkbox with specified id|name|label|value.
   @When I uncheck "option"
+
   And I uncheck "option"
 
      
 
      
  
 
Checks, that form field with specified id|name|label|value has specified value.
 
Checks, that form field with specified id|name|label|value has specified value.
   @Then the "field" field should contain "value"
+
   And the "field" field should contain "value"
 
      
 
      
 
      
 
      
 
Checks, that form field with specified id|name|label|value doesn't have specified value.
 
Checks, that form field with specified id|name|label|value doesn't have specified value.
   @Then the "field" field should not contain "value"
+
   And the "field" field should not contain "value"
 
      
 
      
 
      
 
      
 
Checks, that checkbox with specified in|name|label|value is checked.   
 
Checks, that checkbox with specified in|name|label|value is checked.   
   @Then the "checkbox" checkbox should be checked
+
   And the "checkbox" checkbox should be checked
 
      
 
      
 
    
 
    
 
Checks, that checkbox with specified in|name|label|value is checked.
 
Checks, that checkbox with specified in|name|label|value is checked.
   @Then the checkbox "checkbox" is|should be checked
+
   And the checkbox "checkbox" is|should be checked
 
      
 
      
 
    
 
    
 
Checks, that checkbox with specified in|name|label|value is unchecked.
 
Checks, that checkbox with specified in|name|label|value is unchecked.
   @Then the "checkbox" checkbox should not be checked
+
   And the "checkbox" checkbox should not be checked
 
      
 
      
 
Checks, that checkbox with specified in|name|label|value is unchecked.
 
Checks, that checkbox with specified in|name|label|value is unchecked.
   @Then the checkbox "checkbox" should be unchecked|not be checked
+
   And the checkbox "checkbox" should be unchecked|not be checked
 
      
 
      
 
      
 
      
 
Checks, that checkbox with specified in|name|label|value is unchecked.
 
Checks, that checkbox with specified in|name|label|value is unchecked.
   @Then the checkbox "checkbox" is unchecked|not checked)
+
   And the checkbox "checkbox" is unchecked|not checked)
  
 
Attaches file to field with specified id|name|label|value. eg; "/var/www/html/mahara/test/behat/upload_files/Mahara Testing notes.odt.tar.gz" to "Upload file"
 
Attaches file to field with specified id|name|label|value. eg; "/var/www/html/mahara/test/behat/upload_files/Mahara Testing notes.odt.tar.gz" to "Upload file"
   @When I attach the file "File Path and file name" to "field"
+
   And I attach the file "File Path and file name" to "field"
  
  
 
Fills a form with field/value data.  
 
Fills a form with field/value data.  
   @Given I set the following fields to these values:
+
   And I set the following fields to these values:
 
      
 
      
  
 
Sets the specified value to the field.
 
Sets the specified value to the field.
   @Given I set the field "field_string" to "field_value_string"
+
   And I set the field "field_string" to "field_value_string"
 
      
 
      
 
      
 
      
 
      
 
      
 
Sets the specified value to the field with xpath.     
 
Sets the specified value to the field with xpath.     
   @Given I set the field with xpath "fieldxpath_string" to "field_value_string"
+
   And I set the field with xpath "fieldxpath_string" to "field_value_string"
 
      
 
      
 
    
 
    
 
Checks, the field matches the value.
 
Checks, the field matches the value.
   @Then the field "field_string" matches value "field_value_string"
+
   And the field "field_string" matches value "field_value_string"
  
 
Checks, the field does not match the value.
 
Checks, the field does not match the value.
   @Then the field "field_string" does not match value "field_value_string"
+
   And the field "field_string" does not match value "field_value_string"
 
      
 
      
 
      
 
      
 
Checks, the provided field/value matches.  
 
Checks, the provided field/value matches.  
   @Then the following fields match these values:
+
   And the following fields match these values:
  
  
 
Checks that the provided field/value pairs don't match.   
 
Checks that the provided field/value pairs don't match.   
   @Then the following fields do not match these values:
+
   And the following fields do not match these values:
 
      
 
      
  
 
Checks, that given select box contains the specified option.
 
Checks, that given select box contains the specified option.
   @Then the "select_string" select box should contain "option_string"
+
   And the "select_string" select box should contain "option_string"
 
      
 
      
 
    
 
    
 
Checks, that given select box contains the specified option.
 
Checks, that given select box contains the specified option.
   @Then the "select_string" select box should not contain "option_string"
+
   And the "select_string" select box should not contain "option_string"
  
  
Line 235: Line 238:
  
 
Checks, that (?P<num>\d+) CSS elements exist on the page
 
Checks, that (?P<num>\d+) CSS elements exist on the page
   @Then I should see (?P<num>\d+) "element" elements
+
   And I should see (?P<num>\d+) "element" elements
  
 
Checks, that the specified element is visible. Only available in tests using Javascript.
 
Checks, that the specified element is visible. Only available in tests using Javascript.
   @Then I should see the element "element" "selectortype"
+
   And I should see the element "element" "selectortype"
 
    
 
    
 
Checks, that field with specified identifier exists on page.
 
Checks, that field with specified identifier exists on page.
   @Then I should see the field "field"
+
   And I should see the field "field"
 
        
 
        
  
 
Checks, that current page PATH matches regular expression.
 
Checks, that current page PATH matches regular expression.
   @Then the url should match "pattern"  
+
   And the url should match "pattern"  
 
      
 
      
 
Prints current URL to console.
 
Prints current URL to console.
   @Then print current URL
+
   And print current URL
 
      
 
      
  
 
Checks, that the specified element is visible. Only available in tests using Javascript.
 
Checks, that the specified element is visible. Only available in tests using Javascript.
   @Then "$elements" "$selector" should be visible
+
   And "$elements" "$selector" should be visible
 
      
 
      
   @Then "$element" "$selector" should not be visible
+
   And "$element" "$selector" should not be visible
  
  
 
Checks, that the specified element is visible inside the specified container. Only available in tests using Javascript.
 
Checks, that the specified element is visible inside the specified container. Only available in tests using Javascript.
   @Then "$element" "$selector" in the "$elementcontainer" "$selector" should be visible     
+
   And "$element" "$selector" in the "$elementcontainer" "$selector" should be visible     
  
  
  
 
Checks, that the specified element is not visible inside the specified container. Only available in tests using Javascript.
 
Checks, that the specified element is not visible inside the specified container. Only available in tests using Javascript.
   @Then "$element" "$selector" in the "$elementcontainer" "$textselector" should not be visible
+
   And "$element" "$selector" in the "$elementcontainer" "$textselector" should not be visible
 
            
 
            
  
 
Checks, that page contains specified text. It also checks if the text is visible when running Javascript tests.
 
Checks, that page contains specified text. It also checks if the text is visible when running Javascript tests.
   @Then I should see "$text"
+
   And I should see "$text"
 
      
 
      
  
 
Checks, that page doesn't contain specified text. When running Javascript tests it also considers that texts may be hidden.
 
Checks, that page doesn't contain specified text. When running Javascript tests it also considers that texts may be hidden.
   @Then I should not see "$text"
+
   And I should not see "$text"
  
  
 
Checks, that the specified element contains the specified text. When running Javascript tests it also considers that texts may be hidden.
 
Checks, that the specified element contains the specified text. When running Javascript tests it also considers that texts may be hidden.
   @Then I should see "$text" in the "$element" “$sector”
+
   And I should see "$text" in the "$element" “$sector”
 
   
 
   
  
 
Checks, that the specified element does not contain the specified text. When running Javascript tests it also considers that texts may be hidden.
 
Checks, that the specified element does not contain the specified text. When running Javascript tests it also considers that texts may be hidden.
   @Then I should not see "$text" in the “$element" "$selector”
+
   And I should not see "$text" in the “$element" "$selector”
  
  
  
 
Checks, that the first specified element appears before the second one.
 
Checks, that the first specified element appears before the second one.
   @Given "$element" "$selector" should appear before "$element" "$selector"
+
   And "$element" "$selector" should appear before "$element" "$selector"
 
      
 
      
  
  
 
Checks, that the first specified element appears after the second one.
 
Checks, that the first specified element appears after the second one.
   @Given "$element" "selector" should appear after $"element"  $"selector"
+
   And "$element" "selector" should appear after $"element"  $"selector"
  
  
 
Checks, that the first specified element appears after the second one.
 
Checks, that the first specified element appears after the second one.
   @Given "following_element_string" "selector1_string" should appear after "preceding_element_string" "selector2_string"
+
   And "following_element_string" "selector1_string" should appear after "preceding_element_string" "selector2_string"
 
      
 
      
 
Checks, that element of specified type is disabled.
 
Checks, that element of specified type is disabled.
   @Then the "$element" "$selector" should be disabled
+
   And the "$element" "$selector" should be disabled
 
      
 
      
  
 
Checks, that element of specified type is enabled.
 
Checks, that element of specified type is enabled.
   @Then the "$element" "$selector" should be enabled
+
   And the "$element" "$selector" should be enabled
 
      
 
      
  
 
Checks the provided element and selector type are readonly on the current page.
 
Checks the provided element and selector type are readonly on the current page.
   @Then the "$element" "$selector" should be readonly
+
   And the "$element" "$selector" should be readonly
 
   
 
   
  
 
Checks the provided element and selector type exists in the current page.
 
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.
 
-This step is for advanced users, use it if you don't find anything else suitable for what you need.
   @Then "$element" "$selector" should exists
+
   And "$element" "$selector" should exists
 
   
 
   
  
 
Checks that the provided element and selector type not exists in the current page.
 
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.
 
-This step is for advanced users, use it if you don't find anything else suitable for what you need.
   @Then "$element" "$selector" should not exists
+
   And "$element" "$selector" should not exists
  
  
 
Checks that an element and selector type exists in another element and selector type on the current page.
 
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.
 
-This step is for advanced users, use it if you don't find anything else suitable for what you need.
   @Then "$element" "$selector" should exist in the "$element" "$selector"
+
   And "$element" "$selector" should exist in the "$element" "$selector"
  
 
   
 
   
 
Checks, that page contains text matching specified pattern.
 
Checks, that page contains text matching specified pattern.
   @Then I should see text matching "pattern"
+
   And I should see text matching "pattern"
  
 
Checks, that page doesn't contain text matching specified pattern.
 
Checks, that page doesn't contain text matching specified pattern.
   @Then I should not see text matching "pattern"
+
   And I should not see text matching "pattern"
 
      
 
      
 
      
 
      
 
Checks, that HTML response contains specified string.
 
Checks, that HTML response contains specified string.
   @Then the response should contain "text"
+
   And the response should contain "text"
  
  
  
 
Checks, that HTML response doesn't contain specified string.
 
Checks, that HTML response doesn't contain specified string.
   @Then the response should not contain "text"
+
   And the response should not contain "text"
 
      
 
      
 
Checks, that element with specified CSS contains specified text.
 
Checks, that element with specified CSS contains specified text.
   @Then I should see "text>" in the "element" element
+
   And I should see "text>" in the "element" element
  
  
  
 
Checks, that element with specified CSS doesn't contain specified text.
 
Checks, that element with specified CSS doesn't contain specified text.
   @Then I should not see "text" in the "element" element
+
   And I should not see "text" in the "element" element
  
  
 
Checks, that element with specified CSS contains specified HTML.
 
Checks, that element with specified CSS contains specified HTML.
   @Then the "element" element should contain "value"
+
   And the "element" element should contain "value"
 
      
 
      
  
 
    
 
    
 
Checks, that element with specified CSS doesn't contain specified HTML.
 
Checks, that element with specified CSS doesn't contain specified HTML.
   @Then the "element" element should not contain "value"
+
   And the "element" element should not contain "value"
  
 
    
 
    
 
Checks, that element with specified CSS exists on page.
 
Checks, that element with specified CSS exists on page.
   @Then I should see an? "element" element
+
   And I should see an? "element" element
 
      
 
      
 
Checks, that element with specified CSS doesn't exist on page.
 
Checks, that element with specified CSS doesn't exist on page.
   @Then I should not see an? "element" element
+
   And I should not see an? "element" element
  
 
      
 
      
Line 367: Line 370:
  
 
Prints last response to console.
 
Prints last response to console.
   @Then print last response
+
   And print last response
  
 
Prints current URL to console.
 
Prints current URL to console.
   @Then print current URL
+
   And print current URL
  
  
Line 378: Line 381:
  
 
Opens last response content in browser.     
 
Opens last response content in browser.     
   @Then show last response
+
   And show last response
 
      
 
      
 
Internal step definition to find exceptions, debugging() messages and PHP debug messages.
 
Internal step definition to find exceptions, debugging() messages and PHP debug messages.
   @Given I look for exceptions
+
   And I look for exceptions
  
  
 
Follows the page redirection. Use this step after any action that shows a message and waits for a redirection
 
Follows the page redirection. Use this step after any action that shows a message and waits for a redirection
   @Given I wait to be redirected
+
   And I wait to be redirected
 
      
 
      
  
 
Accepts the currently displayed alert dialog. This step does not work in all the browsers, consider it experimental.
 
Accepts the currently displayed alert dialog. This step does not work in all the browsers, consider it experimental.
   @Given I accept the currently displayed dialog
+
   And I accept the currently displayed dialog
  
 
      
 
      
  
 
This step triggers cron like a user would do going to admin/cron.php.
 
This step triggers cron like a user would do going to admin/cron.php.
   @Given I trigger cron
+
   And I trigger cron

Revision as of 14:32, 10 November 2014


Use these steps to create Behat tests
Copy and paste the steps in the order your need into a text editor (ie gedit or vim) to create your tests.

Note: Replace the "And" with "Given, When, Then" where necessary

Logging In

Logs you in as Admin for testing purpose

  @Given I am logged in as the user "admin" with password "Password1"


To create additional users.

Note: The users will be given an automatic PW of Password1 and the email account will be [email protected].
If you want to set a user up with aditional admin permissions you have to do that manually.
 And the following "users" exist:
     | firstname | lastname | username | 
     | Student | User | student |
     | Student2 | User2 | student2 |

Opening/Loading/Closing Pages

Checks, that current page PATH is equal to specified. eg; And I should be on "Profile" would be written as; And I should be on "artefact/internal/index.php"

 And I should be on "page path"

Opens user profile.

 And I am on user profile

Opens homepage.

 And I go to the homepage

Opens Mahara homepage.

 And I am on homepage


Checks, that current page is the homepage.

 And I should be on the homepage
   

Reloads the current page.

 And I reload the page

Waits until the page is completely loaded. This step is auto-executed after every step.

 And I wait until the page is ready
    

Opens specified page.

 And I am on "page

Opens specified page.

 And I go to "page"

Moves backward one page in history.

 And I move backward one page

Moves forward one page in history

 And I move forward one page
   

Checks, that current page response status is equal to specified.

 And the response status code should be 404
   
   

Checks, that current page response status is not equal to specified.

 And the response status code should not be 404


Switching Frames/Windows

Switches to the specified iframe.

 And I switch to "$iframename" iframe


Switches to the main Mahara frame.

 And I switch to the main frame


Switches to the specified window. Useful when interacting with popup windows.

 And I switch to “windowname” windows


Switches to the main Mahara window. Useful when you finish interacting with popup windows.

 And I switch to the main window

Actions Requiring Waiting

Waits X seconds. Required after an action that requires data from an AJAX request.

 And I wait "$numberofseconds" seconds


Waits until the provided element selector exists in the DOM

 And I wait until "$element" "$selector" exists


Waits until the provided element does not exist in the DOM

 And I wait until "element_string" "selector_string" does not exist


Click Actions

Click on the specified element inside a table row containing the specified text.

 And I click on "element_string" "selector_string" in the "row_text_string" table row


@Given I drag "element_string" "selector1_string" and I drop it in "container_element_string" "selector2_string"


Generic mouse over action. Mouse over a element of the specified type.

 And I hover "$element" "$selector"
    


Click on the element of the specified type which is located inside the second element.

 And I click on "$element" "$selector"


Click on the specified element inside a table row containing the specified text.

 And I click on "$element" "$selector" in the table row
    

Clicks link with specified id|title|alt|text.

 And I follow "id|title|alt|text"


Presses button with specified id|name|title|alt|value.

 And I press "BUTTON_STRING"

Drags and drops the specified element to the specified container. This step does not work in all the browsers, consider it experimental.

 And I drag "$element" "$selector" and I drop it in "$containerelement" ”$selector"


Filling in Forms

Fills in form field with specified id|name|label|value.

 And I fill in "field" with "value"


Fills in form field with specified id|name|label|value.

 And I fill in "value" for "field"
   
   

Fills in form fields with provided table.

 And I fill in the following:
   
  

Selects option in select field with specified id|name|label|value.

 And I select "option" from "select"
   
   

Selects additional option in select field with specified id|name|label|value.

 And I additionally select "option" from "select"
   
  

Checks checkbox with specified id|name|label|value.

 And I check "option"
   
   

Unchecks checkbox with specified id|name|label|value.

 And I uncheck "option"
   

Checks, that form field with specified id|name|label|value has specified value.

 And the "field" field should contain "value"
   
   

Checks, that form field with specified id|name|label|value doesn't have specified value.

 And the "field" field should not contain "value"
   
   

Checks, that checkbox with specified in|name|label|value is checked.

 And the "checkbox" checkbox should be checked
   
  

Checks, that checkbox with specified in|name|label|value is checked.

 And the checkbox "checkbox" is|should be checked
   
  

Checks, that checkbox with specified in|name|label|value is unchecked.

 And the "checkbox" checkbox should not be checked
   

Checks, that checkbox with specified in|name|label|value is unchecked.

 And the checkbox "checkbox" should be unchecked|not be checked
   
   

Checks, that checkbox with specified in|name|label|value is unchecked.

 And the checkbox "checkbox" is unchecked|not checked)

Attaches file to field with specified id|name|label|value. eg; "/var/www/html/mahara/test/behat/upload_files/Mahara Testing notes.odt.tar.gz" to "Upload file"

 And I attach the file "File Path and file name" to "field"


Fills a form with field/value data.

 And I set the following fields to these values:
   

Sets the specified value to the field.

 And I set the field "field_string" to "field_value_string"
   
   
   

Sets the specified value to the field with xpath.

 And I set the field with xpath "fieldxpath_string" to "field_value_string"
   
  

Checks, the field matches the value.

 And the field "field_string" matches value "field_value_string"

Checks, the field does not match the value.

 And the field "field_string" does not match value "field_value_string"
   
   

Checks, the provided field/value matches.

 And the following fields match these values:


Checks that the provided field/value pairs don't match.

 And the following fields do not match these values:
   

Checks, that given select box contains the specified option.

 And the "select_string" select box should contain "option_string"
   
  

Checks, that given select box contains the specified option.

 And the "select_string" select box should not contain "option_string"


Checking For Specfic Visible Elements

Checks, that (?P<num>\d+) CSS elements exist on the page

 And I should see (?P<num>\d+) "element" elements

Checks, that the specified element is visible. Only available in tests using Javascript.

 And I should see the element "element" "selectortype"
  

Checks, that field with specified identifier exists on page.

 And I should see the field "field"
     

Checks, that current page PATH matches regular expression.

 And the url should match "pattern" 
   

Prints current URL to console.

 And print current URL
   

Checks, that the specified element is visible. Only available in tests using Javascript.

 And "$elements" "$selector" should be visible
    
 And "$element" "$selector" should not be visible


Checks, that the specified element is visible inside the specified container. Only available in tests using Javascript.

 And "$element" "$selector" in the "$elementcontainer" "$selector" should be visible     


Checks, that the specified element is not visible inside the specified container. Only available in tests using Javascript.

 And "$element" "$selector" in the "$elementcontainer" "$textselector" should not be visible
         

Checks, that page contains specified text. It also checks if the text is visible when running Javascript tests.

 And I should see "$text"
    

Checks, that page doesn't contain specified text. When running Javascript tests it also considers that texts may be hidden.

 And I should not see "$text"


Checks, that the specified element contains the specified text. When running Javascript tests it also considers that texts may be hidden.

 And I should see "$text" in the "$element" “$sector”

Checks, that the specified element does not contain the specified text. When running Javascript tests it also considers that texts may be hidden.

 And I should not see "$text" in the “$element" "$selector”


Checks, that the first specified element appears before the second one.

 And "$element" "$selector" should appear before "$element" "$selector"
    


Checks, that the first specified element appears after the second one.

 And "$element" "selector" should appear after $"element"  $"selector"


Checks, that the first specified element appears after the second one.

 And "following_element_string" "selector1_string" should appear after "preceding_element_string" "selector2_string"
   

Checks, that element of specified type is disabled.

 And the "$element" "$selector" should be disabled
    

Checks, that element of specified type is enabled.

 And the "$element" "$selector" should be enabled
    

Checks the provided element and selector type are readonly on the current page.

 And the "$element" "$selector" should be readonly

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.

 And "$element" "$selector" should exists

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.

 And "$element" "$selector" should not exists


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.

 And "$element" "$selector" should exist in the "$element" "$selector"


Checks, that page contains text matching specified pattern.

 And I should see text matching "pattern"

Checks, that page doesn't contain text matching specified pattern.

 And I should not see text matching "pattern"
   
   

Checks, that HTML response contains specified string.

 And the response should contain "text"


Checks, that HTML response doesn't contain specified string.

 And the response should not contain "text"
   

Checks, that element with specified CSS contains specified text.

 And I should see "text>" in the "element" element


Checks, that element with specified CSS doesn't contain specified text.

 And I should not see "text" in the "element" element


Checks, that element with specified CSS contains specified HTML.

 And the "element" element should contain "value"
   


Checks, that element with specified CSS doesn't contain specified HTML.

 And the "element" element should not contain "value"


Checks, that element with specified CSS exists on page.

 And I should see an? "element" element
   

Checks, that element with specified CSS doesn't exist on page.

 And I should not see an? "element" element


Printing/Display

Prints last response to console.

 And print last response

Prints current URL to console.

 And print current URL



Ungrouped Steps

Opens last response content in browser.

 And show last response
   

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

 And I look for exceptions


Follows the page redirection. Use this step after any action that shows a message and waits for a redirection

 And I wait to be redirected
    

Accepts the currently displayed alert dialog. This step does not work in all the browsers, consider it experimental.

 And I accept the currently displayed dialog


This step triggers cron like a user would do going to admin/cron.php.

 And I trigger cron