added addtional documents, added examples to all step definitions for additional clarity when running 'behat -di' or 'behat -dl'

This commit is contained in:
Sajjad Hossain
2015-06-01 15:08:04 -04:00

View File

@@ -38,8 +38,8 @@ class MinkContext extends RawMinkContext implements TranslatableContext
/** /**
* Opens specified page * Opens specified page
* Example: Given I am on "http://batman.com" * Example: Given I am on "http://batman.com"
* Example: When I am on "http://batman.com" * Example: And I am on "/articles/isBatmanBruceWayne"
* Example: And I go to "http://batman.com" * Example: When I go to "/articles/isBatmanBruceWayne"
* *
* @Given /^(?:|I )am on "(?P<page>[^"]+)"$/ * @Given /^(?:|I )am on "(?P<page>[^"]+)"$/
* @When /^(?:|I )go to "(?P<page>[^"]+)"$/ * @When /^(?:|I )go to "(?P<page>[^"]+)"$/
@@ -56,6 +56,7 @@ class MinkContext extends RawMinkContext implements TranslatableContext
* Example: And I reload the page * Example: And I reload the page
* *
* @When /^(?:|I )reload the page$/ * @When /^(?:|I )reload the page$/
*
*/ */
public function reload() public function reload()
{ {
@@ -118,7 +119,7 @@ class MinkContext extends RawMinkContext implements TranslatableContext
/** /**
* Fills in form field with specified id|name|label|value * Fills in form field with specified id|name|label|value
* Example: Given I fill in "username" with: "bwayne" * Example: Given I fill in "username" with "bwayne"
* Example: When I fill in "username" with: "bwayne" * Example: When I fill in "username" with: "bwayne"
* Example: And I fill in "bwayne" for "username" * Example: And I fill in "bwayne" for "username"
* *
@@ -481,6 +482,18 @@ class MinkContext extends RawMinkContext implements TranslatableContext
$this->assertSession()->checkboxChecked($this->fixStepArgument($checkbox)); $this->assertSession()->checkboxChecked($this->fixStepArgument($checkbox));
} }
/**
* Checks, that (?P<num>\d+) CSS elements exist on the page
* Example: Then I should see 5 "div" elements
* Example: And I should see 5 "div" elements
*
* @Then /^(?:|I )should see (?P<num>\d+) "(?P<element>[^"]*)" elements?$/
*/
public function assertNumElements($num, $element)
{
$this->assertSession()->elementsCount('css', $element, intval($num));
}
/** /**
* Checks, that checkbox with specified in|name|label|value is unchecked * Checks, that checkbox with specified in|name|label|value is unchecked
* Example: Then the "newsletter" checkbox should be unchecked * Example: Then the "newsletter" checkbox should be unchecked
@@ -496,18 +509,6 @@ class MinkContext extends RawMinkContext implements TranslatableContext
$this->assertSession()->checkboxNotChecked($this->fixStepArgument($checkbox)); $this->assertSession()->checkboxNotChecked($this->fixStepArgument($checkbox));
} }
/**
* Checks, that (?P<num>\d+) CSS elements exist on the page
* Example: Then I should see 5 "div" elements
* Example: And I should see 5 "div" elements
*
* @Then /^(?:|I )should see (?P<num>\d+) "(?P<element>[^"]*)" elements?$/
*/
public function assertNumElements($num, $element)
{
$this->assertSession()->elementsCount('css', $element, intval($num));
}
/** /**
* Prints current URL to console. * Prints current URL to console.
* Example: Then print current URL * Example: Then print current URL