Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from pkolomiy/request
Added tests for certificate and domain prices
- Loading branch information
Showing
7 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
actor: AcceptanceTester | ||
namespace: ahnames\hipanel\tests | ||
paths: | ||
tests: tests | ||
output: "%COMMON_TESTS_LOCATION%/_output" | ||
data: tests/_data | ||
support: tests/_support | ||
envs: tests/_envs | ||
extensions: | ||
enabled: | ||
- Codeception\Extension\RunFailed | ||
params: | ||
- '%PARAMS_LOCATION%' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
namespace ahnames\hipanel\tests\_support; | ||
|
||
/** | ||
* Inherited Methods | ||
* @method void wantToTest($text) | ||
* @method void wantTo($text) | ||
* @method void execute($callable) | ||
* @method void expectTo($prediction) | ||
* @method void expect($prediction) | ||
* @method void amGoingTo($argumentation) | ||
* @method void am($role) | ||
* @method void lookForwardTo($achieveValue) | ||
* @method void comment($description) | ||
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) | ||
* | ||
* @SuppressWarnings(PHPMD) | ||
*/ | ||
class AcceptanceTester extends \Codeception\Actor | ||
{ | ||
use _generated\AcceptanceTesterActions; | ||
|
||
/** | ||
* Define custom actions here | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Codeception Test Suite Configuration | ||
# | ||
# Suite for acceptance tests. | ||
# Perform tests in browser using the WebDriver or PhpBrowser. | ||
# If you need both WebDriver and PHPBrowser tests - create a separate suite. | ||
|
||
actor: AcceptanceTester | ||
namespace: ahnames\hipanel\tests\_support | ||
extends: '%COMMON_SUITE_LOCATION%' |
50 changes: 50 additions & 0 deletions
50
tests/acceptance/module/finance/manager/CertificateCrudCest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace ahnames\hipanel\tests\acceptance\module\finance\manager; | ||
|
||
use hipanel\helpers\Url; | ||
use hipanel\modules\finance\tests\_support\Page\plan\Create as PlanCreatePage; | ||
use hipanel\modules\finance\tests\_support\Page\price\certificate\Create as PriceCertificateCreate; | ||
use hipanel\modules\finance\tests\_support\Page\price\certificate\Update as PriceCertificateUpdate; | ||
use hipanel\tests\_support\Step\Acceptance\Manager; | ||
|
||
class CertificateCrudCest | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $id; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
private $fields; | ||
|
||
public function ensureThatICanCreateTariffPlan(Manager $I): void | ||
{ | ||
$this->fields = [ | ||
'name' => uniqid(), | ||
'type' => 'Certificate tariff', | ||
'client' => 'hipanel_test_manager@hiqdev.com', | ||
'currency' => 'USD', | ||
'note' => 'test note', | ||
]; | ||
$page = new PlanCreatePage($I, $this->fields); | ||
$this->id = $page->createPlan(); | ||
} | ||
|
||
public function ensureThatICanAddPrices(Manager $I): void | ||
{ | ||
$I->needPage(Url::to(['@plan/view', 'id' => $this->id])); | ||
$I->see('No prices found'); | ||
$price = new PriceCertificateCreate($I, $this->id); | ||
$price->addPrices('Certificate tariff'); | ||
$price->ensureThereNoSuggestions('Certificate tariff'); | ||
} | ||
|
||
public function ensureICanUpdatePrices(Manager $I): void | ||
{ | ||
$price = new PriceCertificateUpdate($I, $this->id); | ||
$price->updatePrices(); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
tests/acceptance/module/finance/manager/DomainCrudCest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace ahnames\hipanel\tests\acceptance\module\finance\manager; | ||
|
||
use hipanel\helpers\Url; | ||
use hipanel\modules\finance\tests\_support\Page\plan\Create as PlanCreatePage; | ||
use hipanel\modules\finance\tests\_support\Page\price\domain\Create as PriceDomainCreate; | ||
use hipanel\modules\finance\tests\_support\Page\price\certificate\Update as PriceDomainUpdate; | ||
use hipanel\tests\_support\Step\Acceptance\Manager; | ||
|
||
class DomainCrudCest | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $id; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
private $fields; | ||
|
||
public function ensureThatICanCreateTariffPlan(Manager $I): void | ||
{ | ||
$this->fields = [ | ||
'name' => uniqid(), | ||
'type' => 'Domain tariff', | ||
'client' => 'hipanel_test_manager@hiqdev.com', | ||
'currency' => 'USD', | ||
'note' => 'test note', | ||
]; | ||
$page = new PlanCreatePage($I, $this->fields); | ||
$this->id = $page->createPlan(); | ||
} | ||
|
||
public function ensureThatICanAddPrices(Manager $I): void | ||
{ | ||
$I->needPage(Url::to(['@plan/view', 'id' => $this->id])); | ||
$I->see('No prices found'); | ||
$price = new PriceDomainCreate($I, $this->id); | ||
$price->addPrices('Default Tariff'); | ||
$price->ensureThereNoSuggestions('Default Tariff'); | ||
} | ||
|
||
public function ensureICanUpdatePrices(Manager $I): void | ||
{ | ||
$price = new PriceDomainUpdate($I, $this->id); | ||
$price->updatePrices(); | ||
} | ||
} |