Add proposals to tests

This commit is contained in:
Hillel Coren 2018-02-13 18:08:17 +02:00
parent 08d4fe8d51
commit b07462ec4a
3 changed files with 43 additions and 20 deletions

View File

@ -67,11 +67,6 @@ class ProposalSnippetRepository extends BaseRepository
} }
$proposal->fill($input); $proposal->fill($input);
if (isset($input['proposal_category_id'])) {
$proposal->proposal_category_id = $input['proposal_category_id'] ? ProposalCategory::getPrivateId($input['proposal_category_id']) : null;
}
$proposal->save(); $proposal->save();
return $proposal; return $proposal;

View File

@ -19,7 +19,7 @@ Detailed Guides
Automated Installers Automated Installers
^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
- Dockerfile: `github.com/invoiceninja/dockerfiles <https://github.com/invoiceninja/dockerfiles>`_ - Dockerfile: `github.com <https://github.com/invoiceninja/dockerfiles>`_
- Cloudron: `cloudron.io <https://cloudron.io/store/com.invoiceninja.cloudronapp.html>`_ - Cloudron: `cloudron.io <https://cloudron.io/store/com.invoiceninja.cloudronapp.html>`_

View File

@ -20,8 +20,37 @@ class QuoteCest
{ {
$clientEmail = $this->faker->safeEmail; $clientEmail = $this->faker->safeEmail;
$productKey = $this->faker->text(10); $productKey = $this->faker->text(10);
$categoryName = $this->faker->text(11);
$snippetName = $this->faker->text(12);
$templateName = $this->faker->text(13);
$I->wantTo('create a quote'); $I->wantTo('create a quote and proposal');
// create proposal category
$I->amOnPage('/proposals/categories/create');
$I->fillField(['name' => 'name'], $categoryName);
$I->click('Save');
$I->see('Successfully created category');
$I->amOnPage('/proposals/categories');
$I->see($categoryName);
// create proposal snippet
$I->amOnPage('/proposals/snippets/create');
$I->fillField(['name' => 'name'], $snippetName);
$I->selectDropdown($I, $categoryName, '.category-select .dropdown-toggle');
$I->click('Save');
$I->see('Successfully created snippet');
$I->amOnPage('/proposals/snippets');
$I->see($snippetName);
$I->see($categoryName);
// create proposal template
$I->amOnPage('/proposals/templates/create');
$I->fillField(['name' => 'name'], $templateName);
$I->click('Save');
$I->see('Successfully created template');
$I->amOnPage('/proposals/templates');
$I->see($templateName);
// create client // create client
$I->amOnPage('/clients/create'); $I->amOnPage('/clients/create');
@ -35,8 +64,7 @@ class QuoteCest
$I->fillField(['name' => 'notes'], $this->faker->text(80)); $I->fillField(['name' => 'notes'], $this->faker->text(80));
$I->fillField(['name' => 'cost'], $this->faker->numberBetween(1, 20)); $I->fillField(['name' => 'cost'], $this->faker->numberBetween(1, 20));
$I->click('Save'); $I->click('Save');
$I->wait(1); $I->see('Successfully created product');
//$I->see($productKey);
// create quote // create quote
$I->amOnPage('/quotes/create'); $I->amOnPage('/quotes/create');
@ -46,17 +74,17 @@ class QuoteCest
$I->click('Mark Sent'); $I->click('Mark Sent');
$I->see($clientEmail); $I->see($clientEmail);
// enter payment $I->click('More Actions');
$clientId = $I->grabFromDatabase('contacts', 'client_id', ['email' => $clientEmail]); $I->click('New Proposal');
$invoiceId = $I->grabFromDatabase('invoices', 'id', ['client_id' => $clientId]); $I->see('Create');
$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('Successfully approved');
});
$I->selectDropdown($I, $templateName, '.template-select .dropdown-toggle');
$I->click('Save');
$I->click('Download');
$I->click('More Actions');
$I->click('View as recipient');
$I->click('Download');
$I->click('Approve');
$I->see('Successfully approved');
} }
} }