Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
improve tests and try to fix travis
Browse files Browse the repository at this point in the history
  • Loading branch information
cordoval committed Feb 18, 2014
1 parent 302b7bd commit 34016a0
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ composer.phar
phpunit.xml
Tests/cache
Tests/logs
selenium.jar
17 changes: 15 additions & 2 deletions Tests/BaseSessionTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,23 @@ public function testSimpleBrowsing()
$session = $this->getMink()->getSession();

$session->visit($this->base . '/_behat/tests/page/page1');
$this->wait();
$this->assertTrue($session->getPage()->hasContent('Page N1'));
$this->assertFalse($session->getPage()->hasContent('Page N2'));

$session->visit($this->base . '/_behat/tests/page/page2');
$this->wait();
$this->assertTrue($session->getPage()->hasContent('Page N2'));
$this->assertFalse($session->getPage()->hasContent('Page N1'));

$session->visit($this->base . '/_behat/tests/page/page1');
$this->wait();
$session->getPage()->clickLink('p10');
$this->wait();
$this->assertTrue($session->getPage()->hasContent('Page N10'));

$session->getPage()->clickLink('p22');

$this->wait();
$this->assertNotNull($environment = $session->getPage()->find('css', '#environment'));
$this->assertEquals('test', $environment->getText());

Expand All @@ -49,6 +53,7 @@ public function testRedirects()
$session = $this->getMink()->getSession();

$session->visit($this->base . '/_behat/tests/redirect');
$this->wait();
$this->assertTrue($session->getPage()->hasContent('Page N1'));
}

Expand All @@ -57,14 +62,22 @@ public function testForms()
$session = $this->getMink()->getSession();

$session->visit($this->base . '/_behat/tests/form');
$this->wait();
$page = $session->getPage();

$page->fillField('name', 'ever');
$page->fillField('age', '23');
$page->selectFieldOption('speciality', 'manager');
$page->pressButton('Send spec info');

$this->wait();
$this->assertTrue($session->getPage()->hasContent('POST recieved'), $page->getContent());
$this->assertTrue($page->hasContent('ever is 23 years old manager'));
}

protected function wait()
{
if ('selenium' === $this->getSessionName()) {
$this->getMink()->getSession()->wait('2000');
}
}
}
3 changes: 3 additions & 0 deletions Tests/Functional/GoutteSessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

use Behat\MinkBundle\Tests\BaseSessionTestCase;

/**
* @group goutte
*/
class GoutteSessionTest extends BaseSessionTestCase
{
protected function getSessionName()
Expand Down
3 changes: 3 additions & 0 deletions Tests/Functional/SahiSessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

use Behat\MinkBundle\Tests\BaseSessionTestCase;

/**
* @group sahi
*/
class SahiSessionTest extends BaseSessionTestCase
{
protected function getSessionName()
Expand Down
3 changes: 3 additions & 0 deletions Tests/Functional/Selenium2SessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

use Behat\MinkBundle\Tests\BaseSessionTestCase;

/**
* @group selenium2
*/
class Selenium2SessionTest extends BaseSessionTestCase
{
protected function getSessionName()
Expand Down
3 changes: 3 additions & 0 deletions Tests/Functional/SeleniumSessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

use Behat\MinkBundle\Tests\BaseSessionTestCase;

/**
* @group selenium
*/
class SeleniumSessionTest extends BaseSessionTestCase
{
protected function getSessionName()
Expand Down
3 changes: 3 additions & 0 deletions Tests/Functional/SymfonySessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

use Behat\MinkBundle\Tests\BaseSessionTestCase;

/**
* @group symfony
*/
class SymfonySessionTest extends BaseSessionTestCase
{
protected function getSessionName()
Expand Down
3 changes: 3 additions & 0 deletions Tests/Functional/ZombieSessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

use Behat\MinkBundle\Tests\BaseSessionTestCase;

/**
* @group zombie
*/
class ZombieSessionTest extends BaseSessionTestCase
{
protected function getSessionName()
Expand Down
4 changes: 3 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
</testsuites>

<php>
<!--server name="WEB_FIXTURES_HOST" value="http://test.mink.dev" /-->
<!--
<server name="WEB_FIXTURES_HOST" value="http://test.mink.dev" />
/-->
<server name="KERNEL_DIR" value="Tests/" />
</php>

Expand Down

0 comments on commit 34016a0

Please sign in to comment.