-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from alexislefebvre/21-add-behat-browser-tests
Add behat test of Controller with MinkExtension
- Loading branch information
Showing
5 changed files
with
97 additions
and
5 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
Tests/Features/bootstrap/FeatureContext.php → Tests/Features/Context/FeatureContext.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
|
||
namespace AlexisLefebvre\Bundle\AsyncTweetsBundle\Tests\Features\Context; | ||
|
||
use Behat\MinkExtension\Context\RawMinkContext; | ||
|
||
/** | ||
* Class FeatureContextMink. | ||
* | ||
* @see https://github.com/jakzal/DemoBundle/blob/432e818097d9496223039eb28d79158daa216c6b/Features/Context/FeatureContext.php | ||
*/ | ||
class FeatureContextMink extends RawMinkContext | ||
{ | ||
/** | ||
* Initializes context. | ||
*/ | ||
public function __construct() | ||
{ | ||
} | ||
|
||
/** | ||
* @When I visit the index page | ||
*/ | ||
public function iVisitTheIndexPage() | ||
{ | ||
$this->getSession()->visit($this->locatePath('/')); | ||
} | ||
|
||
/** | ||
* @Then I should see a body tag | ||
*/ | ||
public function iShouldSeeABodyTag() | ||
{ | ||
$this->assertSession()->elementsCount( | ||
'css', | ||
'html > body', | ||
1 | ||
); | ||
} | ||
|
||
/** | ||
* @Then I should see the title of the page | ||
*/ | ||
public function iShouldSeeTheTitleOfThePage() | ||
{ | ||
$this->assertSession()->elementTextContains( | ||
'css', | ||
'html > head > title', | ||
'Home timeline' | ||
); | ||
} | ||
|
||
/** | ||
* @Then I should see the Tweets container | ||
*/ | ||
public function iShouldSeeTheTweetsContainer() | ||
{ | ||
$this->assertSession()->elementsCount( | ||
'css', | ||
'main.container > div.tweets', | ||
1 | ||
); | ||
} | ||
|
||
/** | ||
* @Then I should see the pending tweets | ||
*/ | ||
public function iShouldSeeThePendingTweets() | ||
{ | ||
$this->assertSession()->elementTextContains( | ||
'css', | ||
'body > main.container > div.navigation.row > div.col-sm-7.col-xs-12.count.alert.alert-info', | ||
'pending tweets' | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Feature: Test DefaultController | ||
|
||
Scenario: Index | ||
When I visit the index page | ||
Then I should see a body tag | ||
And I should see the title of the page | ||
And I should see the pending tweets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters