Skip to content

Commit aaee084

Browse files
MaxHeroDavertMik
authored andcommitted
Acceptance tests refactoring (#1)
1 parent 75a273e commit aaee084

11 files changed

+128
-58
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
4+
/**
5+
* Inherited Methods
6+
* @method void wantToTest($text)
7+
* @method void wantTo($text)
8+
* @method void execute($callable)
9+
* @method void expectTo($prediction)
10+
* @method void expect($prediction)
11+
* @method void amGoingTo($argumentation)
12+
* @method void am($role)
13+
* @method void lookForwardTo($achieveValue)
14+
* @method void comment($description)
15+
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
16+
*
17+
* @SuppressWarnings(PHPMD)
18+
*/
19+
class AcceptanceTester extends \Codeception\Actor
20+
{
21+
use _generated\AcceptanceTesterActions;
22+
23+
/**
24+
* Define custom actions here
25+
*/
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
4+
/**
5+
* Inherited Methods
6+
* @method void wantToTest($text)
7+
* @method void wantTo($text)
8+
* @method void execute($callable)
9+
* @method void expectTo($prediction)
10+
* @method void expect($prediction)
11+
* @method void amGoingTo($argumentation)
12+
* @method void am($role)
13+
* @method void lookForwardTo($achieveValue)
14+
* @method void comment($description)
15+
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
16+
*
17+
* @SuppressWarnings(PHPMD)
18+
*/
19+
class FunctionalTester extends \Codeception\Actor
20+
{
21+
use _generated\FunctionalTesterActions;
22+
23+
/**
24+
* Define custom actions here
25+
*/
26+
}
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
4+
/**
5+
* Inherited Methods
6+
* @method void wantToTest($text)
7+
* @method void wantTo($text)
8+
* @method void execute($callable)
9+
* @method void expectTo($prediction)
10+
* @method void expect($prediction)
11+
* @method void amGoingTo($argumentation)
12+
* @method void am($role)
13+
* @method void lookForwardTo($achieveValue)
14+
* @method void comment($description)
15+
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
16+
*
17+
* @SuppressWarnings(PHPMD)
18+
*/
19+
class UnitTester extends \Codeception\Actor
20+
{
21+
use _generated\UnitTesterActions;
22+
23+
/**
24+
* Define custom actions here
25+
*/
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

tests/codeception/acceptance.suite.yml

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class_name: AcceptanceTester
1212
modules:
1313
enabled:
1414
- PhpBrowser
15+
# - Yii2:
16+
# configFile: '/codeception/config/acceptance.php'
1517
# you can use WebDriver instead of PhpBrowser to test javascript and ajax.
1618
# This will require you to install selenium. See http://codeception.com/docs/03-AcceptanceTests#selenium-webdriver
1719
# "restart" option is used by the WebDriver to start each time per test-file new session and cookies,

tests/codeception/acceptance/AboutCept.php

-10
This file was deleted.
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
class AboutCest
4+
{
5+
public function ensureThatAboutWorks(AcceptanceTester $I)
6+
{
7+
//$I->amOnPage(['site/about']);
8+
$I->amOnPage('index.php?r=site%2Fabout');
9+
$I->see('About', 'h1');
10+
}
11+
}

tests/codeception/acceptance/HomeCept.php

-11
This file was deleted.
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
class HomeCest
4+
{
5+
public function ensureThatHomePageWorks(AcceptanceTester $I)
6+
{
7+
//$I->amOnPage(Yii::$app->homeUrl);
8+
$I->amOnPage('index.php?r=site%2Findex');
9+
$I->see('My Company');
10+
11+
$I->seeLink('About');
12+
$I->click('About');
13+
14+
$I->see('This is the About page.');
15+
}
16+
}

tests/codeception/acceptance/LoginCept.php

-37
This file was deleted.
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
class LoginCest
4+
{
5+
public function ensureThatLoginWorks(AcceptanceTester $I)
6+
{
7+
//$I->amOnPage(['site/login']);
8+
$I->amOnPage('index.php?r=site%2Flogin');
9+
$I->see('Login', 'h1');
10+
11+
$I->amGoingTo('try to login with correct credentials');
12+
$I->fillField('input[name="LoginForm[username]"]', 'admin');
13+
$I->fillField('input[name="LoginForm[password]"]', 'admin');
14+
$I->click('login-button');
15+
16+
$I->expectTo('see user info');
17+
$I->see('Logout (admin)');
18+
}
19+
}

0 commit comments

Comments
 (0)