Add custom tests
This commit is contained in:
parent
8c11fb9195
commit
928dbde30f
|
@ -3,9 +3,3 @@ default:
|
||||||
Behat\MinkExtension:
|
Behat\MinkExtension:
|
||||||
base_url: http://127.0.0.1:8000
|
base_url: http://127.0.0.1:8000
|
||||||
goutte: ~
|
goutte: ~
|
||||||
|
|
||||||
suites:
|
|
||||||
default:
|
|
||||||
contexts:
|
|
||||||
- FeatureContext
|
|
||||||
- Behat\MinkExtension\Context\MinkContext
|
|
||||||
|
|
|
@ -3,12 +3,14 @@ Feature: Blog
|
||||||
Scenario:
|
Scenario:
|
||||||
Given I am on "/blog"
|
Given I am on "/blog"
|
||||||
Then the response status code should be 200
|
Then the response status code should be 200
|
||||||
And the ".nav li.active a" element should contain "Blog"
|
And the page title should be "Blog"
|
||||||
|
And the active menu link should be "Blog"
|
||||||
|
|
||||||
Scenario:
|
Scenario:
|
||||||
Given I am on "/blog/simplifying-drupal-migrations-with-xautoload"
|
Given I am on "/blog/simplifying-drupal-migrations-with-xautoload"
|
||||||
Then the response status code should be 200
|
Then the response status code should be 200
|
||||||
And the ".nav li.active a" element should contain "Blog"
|
And the page title should be "Simplifying Drupal Migrations with xautoload"
|
||||||
|
And the active menu link should be "Blog"
|
||||||
|
|
||||||
Scenario:
|
Scenario:
|
||||||
Given I am on "/"
|
Given I am on "/"
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Behat\Behat\Tester\Exception\PendingException;
|
||||||
use Behat\Behat\Context\Context;
|
use Behat\Behat\Context\Context;
|
||||||
use Behat\Behat\Context\SnippetAcceptingContext;
|
use Behat\Behat\Context\SnippetAcceptingContext;
|
||||||
use Behat\Gherkin\Node\PyStringNode;
|
use Behat\Gherkin\Node\PyStringNode;
|
||||||
use Behat\Gherkin\Node\TableNode;
|
use Behat\Gherkin\Node\TableNode;
|
||||||
|
use Behat\MinkExtension\Context\MinkContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines application features from the specific context.
|
* Defines application features from the specific context.
|
||||||
*/
|
*/
|
||||||
class FeatureContext implements Context, SnippetAcceptingContext
|
class FeatureContext extends MinkContext implements Context, SnippetAcceptingContext
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Initializes context.
|
* Initializes context.
|
||||||
|
@ -20,4 +22,28 @@ class FeatureContext implements Context, SnippetAcceptingContext
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then the active menu link should be :text
|
||||||
|
*/
|
||||||
|
public function theActiveMenuLinkShouldBe($text)
|
||||||
|
{
|
||||||
|
return $this->assertElementContains('.navbar .active a', $text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then the page title should be :text
|
||||||
|
*/
|
||||||
|
public function thePageTitleShouldBe($text)
|
||||||
|
{
|
||||||
|
return $this->assertElementContainsText('title', $text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Then the page title should not be :text
|
||||||
|
*/
|
||||||
|
public function thePageTitleShouldNotBe($text)
|
||||||
|
{
|
||||||
|
return $this->assertElementNotContainsText('title', $text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,4 +3,4 @@ Feature: Contact page
|
||||||
Scenario:
|
Scenario:
|
||||||
Given I am on "/contact"
|
Given I am on "/contact"
|
||||||
Then the response status code should be 200
|
Then the response status code should be 200
|
||||||
And the ".nav li.active a" element should contain "Contact"
|
And the active menu link should be "Contact"
|
||||||
|
|
|
@ -3,4 +3,5 @@ Feature: Experience page
|
||||||
Scenario:
|
Scenario:
|
||||||
Given I am on "/experience"
|
Given I am on "/experience"
|
||||||
Then the response status code should be 200
|
Then the response status code should be 200
|
||||||
And the ".nav li.active a" element should contain "Experience"
|
And the page title should be "Experience"
|
||||||
|
And the active menu link should be "Experience"
|
||||||
|
|
|
@ -6,7 +6,7 @@ Feature: Home
|
||||||
Scenario:
|
Scenario:
|
||||||
Given I am on the homepage
|
Given I am on the homepage
|
||||||
Then the response status code should be 200
|
Then the response status code should be 200
|
||||||
And the ".nav li.active a" element should contain "About"
|
|
||||||
And I should see "I’m a Web Developer and System Administrator based in Wales, UK."
|
And I should see "I’m a Web Developer and System Administrator based in Wales, UK."
|
||||||
And the "title" element should contain "Web Developer, System Administrator - PHP, Drupal, Symfony, Linux | Oliver Davies"
|
And the active menu link should be "About"
|
||||||
And the "title" element should not contain "About | Oliver Davies"
|
And the page title should be "Web Developer, System Administrator - PHP, Drupal, Symfony, Linux | Oliver Davies"
|
||||||
|
And the page title should not be "About | Oliver Davies"
|
||||||
|
|
Loading…
Reference in a new issue