Renamed guy classes to actors, fixed phpdoc and code style

This commit is contained in:
Alexander Makarov 2014-08-16 18:15:41 +04:00
parent 9460b93de2
commit 3673e6c004
15 changed files with 31 additions and 19 deletions

View File

@ -1,4 +1,4 @@
# these files are auto generated by codeception build # these files are auto generated by codeception build
/unit/CodeGuy.php /unit/UnitTester.php
/functional/TestGuy.php /functional/FunctionalTester.php
/acceptance/WebGuy.php /acceptance/AcceptanceTester.php

View File

@ -4,6 +4,10 @@ namespace codeception\_pages;
use yii\codeception\BasePage; use yii\codeception\BasePage;
/**
* Represents about page
* @property \AcceptanceTester|\FunctionalTester $actor
*/
class AboutPage extends BasePage class AboutPage extends BasePage
{ {
public $route = 'site/about'; public $route = 'site/about';

View File

@ -4,6 +4,10 @@ namespace codeception\_pages;
use yii\codeception\BasePage; use yii\codeception\BasePage;
/**
* Represents contact page
* @property \AcceptanceTester|\FunctionalTester $actor
*/
class ContactPage extends BasePage class ContactPage extends BasePage
{ {
public $route = 'site/contact'; public $route = 'site/contact';
@ -15,8 +19,8 @@ class ContactPage extends BasePage
{ {
foreach ($contactData as $field => $value) { foreach ($contactData as $field => $value) {
$inputType = $field === 'body' ? 'textarea' : 'input'; $inputType = $field === 'body' ? 'textarea' : 'input';
$this->guy->fillField($inputType . '[name="ContactForm[' . $field . ']"]', $value); $this->actor->fillField($inputType . '[name="ContactForm[' . $field . ']"]', $value);
} }
$this->guy->click('contact-button'); $this->actor->click('contact-button');
} }
} }

View File

@ -4,6 +4,10 @@ namespace codeception\_pages;
use yii\codeception\BasePage; use yii\codeception\BasePage;
/**
* Represents login page
* @property \AcceptanceTester|\FunctionalTester $actor
*/
class LoginPage extends BasePage class LoginPage extends BasePage
{ {
public $route = 'site/login'; public $route = 'site/login';
@ -14,8 +18,8 @@ class LoginPage extends BasePage
*/ */
public function login($username, $password) public function login($username, $password)
{ {
$this->guy->fillField('input[name="LoginForm[username]"]', $username); $this->actor->fillField('input[name="LoginForm[username]"]', $username);
$this->guy->fillField('input[name="LoginForm[password]"]', $password); $this->actor->fillField('input[name="LoginForm[password]"]', $password);
$this->guy->click('login-button'); $this->actor->click('login-button');
} }
} }

View File

@ -8,7 +8,7 @@
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES. # RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
class_name: WebGuy class_name: AcceptanceTester
modules: modules:
enabled: enabled:
- PhpBrowser - PhpBrowser

View File

@ -2,7 +2,7 @@
use codeception\_pages\AboutPage; use codeception\_pages\AboutPage;
$I = new WebGuy($scenario); $I = new AcceptanceTester($scenario);
$I->wantTo('ensure that about works'); $I->wantTo('ensure that about works');
AboutPage::openBy($I); AboutPage::openBy($I);
$I->see('About', 'h1'); $I->see('About', 'h1');

View File

@ -2,7 +2,7 @@
use codeception\_pages\ContactPage; use codeception\_pages\ContactPage;
$I = new WebGuy($scenario); $I = new AcceptanceTester($scenario);
$I->wantTo('ensure that contact works'); $I->wantTo('ensure that contact works');
$contactPage = ContactPage::openBy($I); $contactPage = ContactPage::openBy($I);

View File

@ -1,6 +1,6 @@
<?php <?php
$I = new WebGuy($scenario); $I = new AcceptanceTester($scenario);
$I->wantTo('ensure that home page works'); $I->wantTo('ensure that home page works');
$I->amOnPage(Yii::$app->homeUrl); $I->amOnPage(Yii::$app->homeUrl);
$I->see('My Company'); $I->see('My Company');

View File

@ -2,7 +2,7 @@
use codeception\_pages\LoginPage; use codeception\_pages\LoginPage;
$I = new WebGuy($scenario); $I = new AcceptanceTester($scenario);
$I->wantTo('ensure that login works'); $I->wantTo('ensure that login works');
$loginPage = LoginPage::openBy($I); $loginPage = LoginPage::openBy($I);

View File

@ -6,7 +6,7 @@
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES. # RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
#basic/web/index.php #basic/web/index.php
class_name: TestGuy class_name: FunctionalTester
modules: modules:
enabled: enabled:
- Filesystem - Filesystem

View File

@ -2,7 +2,7 @@
use codeception\_pages\AboutPage; use codeception\_pages\AboutPage;
$I = new TestGuy($scenario); $I = new FunctionalTester($scenario);
$I->wantTo('ensure that about works'); $I->wantTo('ensure that about works');
AboutPage::openBy($I); AboutPage::openBy($I);
$I->see('About', 'h1'); $I->see('About', 'h1');

View File

@ -2,7 +2,7 @@
use codeception\_pages\ContactPage; use codeception\_pages\ContactPage;
$I = new TestGuy($scenario); $I = new FunctionalTester($scenario);
$I->wantTo('ensure that contact works'); $I->wantTo('ensure that contact works');
$contactPage = ContactPage::openBy($I); $contactPage = ContactPage::openBy($I);

View File

@ -1,6 +1,6 @@
<?php <?php
$I = new TestGuy($scenario); $I = new FunctionalTester($scenario);
$I->wantTo('ensure that home page works'); $I->wantTo('ensure that home page works');
$I->amOnPage(Yii::$app->homeUrl); $I->amOnPage(Yii::$app->homeUrl);
$I->see('My Company'); $I->see('My Company');

View File

@ -2,7 +2,7 @@
use codeception\_pages\LoginPage; use codeception\_pages\LoginPage;
$I = new TestGuy($scenario); $I = new FunctionalTester($scenario);
$I->wantTo('ensure that login works'); $I->wantTo('ensure that login works');
$loginPage = LoginPage::openBy($I); $loginPage = LoginPage::openBy($I);

View File

@ -3,4 +3,4 @@
# suite for unit (internal) tests. # suite for unit (internal) tests.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES. # RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
class_name: CodeGuy class_name: UnitTester