Add custom tests
This commit is contained in:
parent
8c11fb9195
commit
928dbde30f
|
@ -3,9 +3,3 @@ default:
|
|||
Behat\MinkExtension:
|
||||
base_url: http://127.0.0.1:8000
|
||||
goutte: ~
|
||||
|
||||
suites:
|
||||
default:
|
||||
contexts:
|
||||
- FeatureContext
|
||||
- Behat\MinkExtension\Context\MinkContext
|
||||
|
|
|
@ -3,12 +3,14 @@ Feature: Blog
|
|||
Scenario:
|
||||
Given I am on "/blog"
|
||||
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:
|
||||
Given I am on "/blog/simplifying-drupal-migrations-with-xautoload"
|
||||
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:
|
||||
Given I am on "/"
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
<?php
|
||||
|
||||
use Behat\Behat\Tester\Exception\PendingException;
|
||||
use Behat\Behat\Context\Context;
|
||||
use Behat\Behat\Context\SnippetAcceptingContext;
|
||||
use Behat\Gherkin\Node\PyStringNode;
|
||||
use Behat\Gherkin\Node\TableNode;
|
||||
use Behat\MinkExtension\Context\MinkContext;
|
||||
|
||||
/**
|
||||
* Defines application features from the specific context.
|
||||
*/
|
||||
class FeatureContext implements Context, SnippetAcceptingContext
|
||||
class FeatureContext extends MinkContext implements Context, SnippetAcceptingContext
|
||||
{
|
||||
/**
|
||||
* Initializes context.
|
||||
|
@ -20,4 +22,28 @@ class FeatureContext implements Context, SnippetAcceptingContext
|
|||
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:
|
||||
Given I am on "/contact"
|
||||
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:
|
||||
Given I am on "/experience"
|
||||
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:
|
||||
Given I am on the homepage
|
||||
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 the "title" element should contain "Web Developer, System Administrator - PHP, Drupal, Symfony, Linux | Oliver Davies"
|
||||
And the "title" element should not contain "About | Oliver Davies"
|
||||
And the active menu link should be "About"
|
||||
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