Added functional tests for the basic app.
This commit is contained in:
parent
bdfa3860ed
commit
ec38fc6345
@ -1,19 +1,18 @@
|
||||
<?php
|
||||
// This class was automatically generated by build task
|
||||
// You can change it manually, but it will be overwritten on next build
|
||||
// You should not change it manually as it will be overwritten on next build
|
||||
// @codingStandardsIgnoreFile
|
||||
|
||||
use Codeception\Maybe;
|
||||
|
||||
use \Codeception\Maybe;
|
||||
use Codeception\Module\PhpBrowser;
|
||||
use Codeception\Module\WebHelper;
|
||||
|
||||
/**
|
||||
* Inherited methods
|
||||
* @method void execute($callable)
|
||||
* @method void wantToTest($text)
|
||||
* @method void wantTo($text)
|
||||
* @method void amTesting($method)
|
||||
* @method void amTestingMethod($method)
|
||||
* @method void testMethod($signature)
|
||||
* @method void expectTo($prediction)
|
||||
* @method void expect($prediction)
|
||||
* @method void amGoingTo($argumentation)
|
||||
@ -236,7 +235,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
* Opens the page.
|
||||
*
|
||||
* @param $page
|
||||
* @see PhpBrowser::amOnPage()
|
||||
* @see Mink::amOnPage()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -268,7 +267,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
* ```
|
||||
* @param $subdomain
|
||||
* @return mixed
|
||||
* @see PhpBrowser::amOnSubdomain()
|
||||
* @see Mink::amOnSubdomain()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -298,7 +297,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
*
|
||||
* @param $text
|
||||
* @param null $selector
|
||||
* @see PhpBrowser::dontSee()
|
||||
* @see Mink::dontSee()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -329,7 +328,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
*
|
||||
* @param $text
|
||||
* @param null $selector
|
||||
* @see PhpBrowser::see()
|
||||
* @see Mink::see()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -359,7 +358,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
*
|
||||
* @param $text
|
||||
* @param null $url
|
||||
* @see PhpBrowser::seeLink()
|
||||
* @see Mink::seeLink()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -388,7 +387,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
*
|
||||
* @param $text
|
||||
* @param null $url
|
||||
* @see PhpBrowser::dontSeeLink()
|
||||
* @see Mink::dontSeeLink()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -432,7 +431,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
* ```
|
||||
* @param $link
|
||||
* @param $context
|
||||
* @see PhpBrowser::click()
|
||||
* @see Mink::click()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -457,7 +456,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
* ?>
|
||||
* ```
|
||||
* @param $selector
|
||||
* @see PhpBrowser::seeElement()
|
||||
* @see Mink::seeElement()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -482,7 +481,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
* ?>
|
||||
* ```
|
||||
* @param $selector
|
||||
* @see PhpBrowser::dontSeeElement()
|
||||
* @see Mink::dontSeeElement()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -499,7 +498,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
|
||||
/**
|
||||
* Reloads current page
|
||||
* @see PhpBrowser::reloadPage()
|
||||
* @see Mink::reloadPage()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -516,7 +515,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
|
||||
/**
|
||||
* Moves back in history
|
||||
* @see PhpBrowser::moveBack()
|
||||
* @see Mink::moveBack()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -533,7 +532,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
|
||||
/**
|
||||
* Moves forward in history
|
||||
* @see PhpBrowser::moveForward()
|
||||
* @see Mink::moveForward()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -553,7 +552,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
*
|
||||
* @param $field
|
||||
* @param $value
|
||||
* @see PhpBrowser::fillField()
|
||||
* @see Mink::fillField()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -583,7 +582,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
*
|
||||
* @param $select
|
||||
* @param $option
|
||||
* @see PhpBrowser::selectOption()
|
||||
* @see Mink::selectOption()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -611,7 +610,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
* ```
|
||||
*
|
||||
* @param $option
|
||||
* @see PhpBrowser::checkOption()
|
||||
* @see Mink::checkOption()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -638,7 +637,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
* ```
|
||||
*
|
||||
* @param $option
|
||||
* @see PhpBrowser::uncheckOption()
|
||||
* @see Mink::uncheckOption()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -666,7 +665,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
* ```
|
||||
*
|
||||
* @param $uri
|
||||
* @see PhpBrowser::seeInCurrentUrl()
|
||||
* @see Mink::seeInCurrentUrl()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -691,7 +690,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
* ```
|
||||
*
|
||||
* @param $uri
|
||||
* @see PhpBrowser::dontSeeInCurrentUrl()
|
||||
* @see Mink::dontSeeInCurrentUrl()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -716,7 +715,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
* ?>
|
||||
*
|
||||
* @param $uri
|
||||
* @see PhpBrowser::seeCurrentUrlEquals()
|
||||
* @see Mink::seeCurrentUrlEquals()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -741,7 +740,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
* ?>
|
||||
*
|
||||
* @param $uri
|
||||
* @see PhpBrowser::dontSeeCurrentUrlEquals()
|
||||
* @see Mink::dontSeeCurrentUrlEquals()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -765,7 +764,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
* ?>
|
||||
*
|
||||
* @param $uri
|
||||
* @see PhpBrowser::seeCurrentUrlMatches()
|
||||
* @see Mink::seeCurrentUrlMatches()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -789,7 +788,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
* ?>
|
||||
*
|
||||
* @param $uri
|
||||
* @see PhpBrowser::dontSeeCurrentUrlMatches()
|
||||
* @see Mink::dontSeeCurrentUrlMatches()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -806,7 +805,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
|
||||
/**
|
||||
*
|
||||
* @see PhpBrowser::seeCookie()
|
||||
* @see Mink::seeCookie()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -823,7 +822,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
|
||||
/**
|
||||
*
|
||||
* @see PhpBrowser::dontSeeCookie()
|
||||
* @see Mink::dontSeeCookie()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -840,7 +839,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
|
||||
/**
|
||||
*
|
||||
* @see PhpBrowser::setCookie()
|
||||
* @see Mink::setCookie()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -857,7 +856,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
|
||||
/**
|
||||
*
|
||||
* @see PhpBrowser::resetCookie()
|
||||
* @see Mink::resetCookie()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -874,7 +873,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
|
||||
/**
|
||||
*
|
||||
* @see PhpBrowser::grabCookie()
|
||||
* @see Mink::grabCookie()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -903,7 +902,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
* @param null $uri
|
||||
* @internal param $url
|
||||
* @return mixed
|
||||
* @see PhpBrowser::grabFromCurrentUrl()
|
||||
* @see Mink::grabFromCurrentUrl()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -932,7 +931,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
*
|
||||
* @param $field
|
||||
* @param $filename
|
||||
* @see PhpBrowser::attachFile()
|
||||
* @see Mink::attachFile()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -959,7 +958,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
* @param $selector
|
||||
* @param $optionText
|
||||
* @return mixed
|
||||
* @see PhpBrowser::seeOptionIsSelected()
|
||||
* @see Mink::seeOptionIsSelected()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -986,7 +985,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
* @param $selector
|
||||
* @param $optionText
|
||||
* @return mixed
|
||||
* @see PhpBrowser::dontSeeOptionIsSelected()
|
||||
* @see Mink::dontSeeOptionIsSelected()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -1016,7 +1015,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
* ```
|
||||
*
|
||||
* @param $checkbox
|
||||
* @see PhpBrowser::seeCheckboxIsChecked()
|
||||
* @see Mink::seeCheckboxIsChecked()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -1045,7 +1044,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
* ```
|
||||
*
|
||||
* @param $checkbox
|
||||
* @see PhpBrowser::dontSeeCheckboxIsChecked()
|
||||
* @see Mink::dontSeeCheckboxIsChecked()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -1078,7 +1077,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
*
|
||||
* @param $field
|
||||
* @param $value
|
||||
* @see PhpBrowser::seeInField()
|
||||
* @see Mink::seeInField()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -1110,7 +1109,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
*
|
||||
* @param $field
|
||||
* @param $value
|
||||
* @see PhpBrowser::dontSeeInField()
|
||||
* @see Mink::dontSeeInField()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -1141,7 +1140,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
*
|
||||
* @param $cssOrXPathOrRegex
|
||||
* @return mixed
|
||||
* @see PhpBrowser::grabTextFrom()
|
||||
* @see Mink::grabTextFrom()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -1172,7 +1171,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
*
|
||||
* @param $field
|
||||
* @return mixed
|
||||
* @see PhpBrowser::grabValueFrom()
|
||||
* @see Mink::grabValueFrom()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
@ -1189,7 +1188,7 @@ class WebGuy extends \Codeception\AbstractGuy
|
||||
|
||||
/**
|
||||
*
|
||||
* @see PhpBrowser::grabAttribute()
|
||||
* @see Mink::grabAttribute()
|
||||
* @return \Codeception\Maybe
|
||||
* ! This method is generated. DO NOT EDIT. !
|
||||
* ! Documentation taken from corresponding module !
|
||||
|
@ -8,4 +8,8 @@
|
||||
|
||||
class_name: TestGuy
|
||||
modules:
|
||||
enabled: [Filesystem, TestHelper]
|
||||
enabled: [Filesystem, TestHelper, Yii2]
|
||||
config:
|
||||
Yii2:
|
||||
entryScript: 'www/index-test.php'
|
||||
url: 'http://localhost/'
|
||||
|
36
tests/functional/ContactCept.php
Normal file
36
tests/functional/ContactCept.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
$I = new TestGuy($scenario);
|
||||
$I->wantTo('ensure that contact works');
|
||||
$I->amOnPage('?r=site/contact');
|
||||
$I->see('Contact', 'h1');
|
||||
|
||||
$I->submitForm('#contact-form', array());
|
||||
$I->see('Contact', 'h1');
|
||||
$I->see('Name cannot be blank');
|
||||
$I->see('Email cannot be blank');
|
||||
$I->see('Subject cannot be blank');
|
||||
$I->see('Body cannot be blank');
|
||||
$I->see('The verification code is incorrect');
|
||||
|
||||
$I->submitForm('#contact-form', array(
|
||||
'ContactForm[name]' => 'tester',
|
||||
'ContactForm[email]' => 'tester.email',
|
||||
'ContactForm[subject]' => 'test subject',
|
||||
'ContactForm[body]' => 'test content',
|
||||
'ContactForm[verifyCode]' => 'testme',
|
||||
));
|
||||
$I->dontSee('Name cannot be blank', '.help-inline');
|
||||
$I->see('Email is not a valid email address.');
|
||||
$I->dontSee('Subject cannot be blank', '.help-inline');
|
||||
$I->dontSee('Body cannot be blank', '.help-inline');
|
||||
$I->dontSee('The verification code is incorrect', '.help-inline');
|
||||
|
||||
$I->submitForm('#contact-form', array(
|
||||
'ContactForm[name]' => 'tester',
|
||||
'ContactForm[email]' => 'tester@example.com',
|
||||
'ContactForm[subject]' => 'test subject',
|
||||
'ContactForm[body]' => 'test content',
|
||||
'ContactForm[verifyCode]' => 'testme',
|
||||
));
|
||||
$I->dontSeeElement('#contact-form');
|
||||
$I->see('Thank you for contacting us. We will respond to you as soon as possible.');
|
8
tests/functional/HomeCept.php
Normal file
8
tests/functional/HomeCept.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
$I = new TestGuy($scenario);
|
||||
$I->wantTo('ensure that home page works');
|
||||
$I->amOnPage('');
|
||||
$I->see('My Company');
|
||||
$I->seeLink('About');
|
||||
$I->click('About');
|
||||
$I->see('This is the About page.');
|
23
tests/functional/LoginCept.php
Normal file
23
tests/functional/LoginCept.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
$I = new TestGuy($scenario);
|
||||
$I->wantTo('ensure that login works');
|
||||
$I->amOnPage('?r=site/login');
|
||||
$I->see('Login', 'h1');
|
||||
|
||||
$I->submitForm('#login-form', array());
|
||||
$I->dontSee('Logout (admin)');
|
||||
$I->see('Username cannot be blank');
|
||||
$I->see('Password cannot be blank');
|
||||
|
||||
$I->submitForm('#login-form', array(
|
||||
'LoginForm[username]' => 'admin',
|
||||
'LoginForm[password]' => 'wrong',
|
||||
));
|
||||
$I->dontSee('Logout (admin)');
|
||||
$I->see('Incorrect username or password');
|
||||
|
||||
$I->submitForm('#login-form', array(
|
||||
'LoginForm[username]' => 'admin',
|
||||
'LoginForm[password]' => 'admin',
|
||||
));
|
||||
$I->see('Logout (admin)');
|
File diff suppressed because it is too large
Load Diff
@ -8,8 +8,8 @@ defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
|
||||
defined('YII_ENV') or define('YII_ENV', 'test');
|
||||
|
||||
require(__DIR__ . '/../vendor/yiisoft/yii2/yii/Yii.php');
|
||||
require(__DIR__ . '/../vendor/autoload.php');
|
||||
require_once(__DIR__ . '/../vendor/yiisoft/yii2/yii/Yii.php');
|
||||
require_once(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
$config = require(__DIR__ . '/../config/web-test.php');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user