Added test for quotes

This commit is contained in:
Hillel Coren 2016-03-13 17:38:55 +02:00
parent 243b1c1d37
commit 3a39da55fd
3 changed files with 63 additions and 13 deletions

View File

@ -70,6 +70,7 @@ script:
- php ./vendor/codeception/codeception/codecept run --debug acceptance ExpenseCest.php - php ./vendor/codeception/codeception/codecept run --debug acceptance ExpenseCest.php
- php ./vendor/codeception/codeception/codecept run --debug acceptance CreditCest.php - php ./vendor/codeception/codeception/codecept run --debug acceptance CreditCest.php
- php ./vendor/codeception/codeception/codecept run --debug acceptance InvoiceCest.php - php ./vendor/codeception/codeception/codecept run --debug acceptance InvoiceCest.php
- php ./vendor/codeception/codeception/codecept run --debug acceptance QuoteCest.php
- php ./vendor/codeception/codeception/codecept run --debug acceptance InvoiceDesignCest.php - php ./vendor/codeception/codeception/codecept run --debug acceptance InvoiceDesignCest.php
- php ./vendor/codeception/codeception/codecept run acceptance OnlinePaymentCest.php - php ./vendor/codeception/codeception/codecept run acceptance OnlinePaymentCest.php
- php ./vendor/codeception/codeception/codecept run --debug acceptance PaymentCest.php - php ./vendor/codeception/codeception/codecept run --debug acceptance PaymentCest.php

View File

@ -108,17 +108,4 @@ return [
'sendmail' => '/usr/sbin/sendmail -bs', 'sendmail' => '/usr/sbin/sendmail -bs',
/*
|--------------------------------------------------------------------------
| Mail "Pretend"
|--------------------------------------------------------------------------
|
| When this option is enabled, e-mail will not actually be sent over the
| web and will instead be written to your application's logs files so
| you may inspect the message. This is great for local development.
|
*/
'pretend' => env('MAIL_PRETEND'),
]; ];

View File

@ -0,0 +1,62 @@
<?php
use Faker\Factory;
class QuoteCest
{
/**
* @var \Faker\Generator
*/
private $faker;
public function _before(AcceptanceTester $I)
{
$I->checkIfLogin($I);
$this->faker = Factory::create();
}
public function createQuote(AcceptanceTester $I)
{
$clientEmail = $this->faker->safeEmail;
$productKey = $this->faker->text(10);
$I->wantTo('create a quote');
// create client
$I->amOnPage('/clients/create');
$I->fillField(['name' => 'contacts[0][email]'], $clientEmail);
$I->click('Save');
$I->see($clientEmail);
// create product
$I->amOnPage('/products/create');
$I->fillField(['name' => 'product_key'], $productKey);
$I->fillField(['name' => 'notes'], $this->faker->text(80));
$I->fillField(['name' => 'cost'], $this->faker->numberBetween(1, 20));
$I->click('Save');
$I->wait(1);
$I->see($productKey);
// create quote
$I->amOnPage('/quotes/create');
$I->selectDropdown($I, $clientEmail, '.client_select .dropdown-toggle');
$I->fillField('table.invoice-table tbody tr:nth-child(1) #product_key', $productKey);
$I->click('table.invoice-table tbody tr:nth-child(1) .tt-selectable');
$I->click('Save');
$I->see($clientEmail);
// enter payment
$clientId = $I->grabFromDatabase('contacts', 'client_id', ['email' => $clientEmail]);
$invoiceId = $I->grabFromDatabase('invoices', 'id', ['client_id' => $clientId]);
$invitationKey = $I->grabFromDatabase('invitations', 'invitation_key', ['invoice_id' => $invoiceId]);
$clientSession = $I->haveFriend('client');
$clientSession->does(function(AcceptanceTester $I) use ($invitationKey) {
$I->amOnPage('/view/' . $invitationKey);
$I->click('Approve');
$I->see('This quote is approved');
});
}
}