mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on acceptance test for tax rates
This commit is contained in:
parent
4d5aa1a712
commit
79ab9f9c48
@ -328,7 +328,7 @@
|
|||||||
<td>{{ trans('texts.tax') }}</td>
|
<td>{{ trans('texts.tax') }}</td>
|
||||||
@endif
|
@endif
|
||||||
<td style="min-width:120px">
|
<td style="min-width:120px">
|
||||||
<select class="form-control" style="width:100%" data-bind="value: tax, options: $root.tax_rates, optionsText: 'displayName'"></select>
|
<select id="taxRateSelect" class="form-control" style="width:100%" data-bind="value: tax, options: $root.tax_rates, optionsText: 'displayName'"></select>
|
||||||
<input type="text" name="tax_name" data-bind="value: tax().name" style="display:none">
|
<input type="text" name="tax_name" data-bind="value: tax().name" style="display:none">
|
||||||
<input type="text" name="tax_rate" data-bind="value: tax().rate" style="display:none">
|
<input type="text" name="tax_rate" data-bind="value: tax().rate" style="display:none">
|
||||||
</td>
|
</td>
|
||||||
|
@ -17,27 +17,47 @@ class TaxRatesCest
|
|||||||
|
|
||||||
public function taxRates(AcceptanceTester $I)
|
public function taxRates(AcceptanceTester $I)
|
||||||
{
|
{
|
||||||
|
$I->wantTo('test tax rates');
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
public function onlinePayment(AcceptanceTester $I)
|
|
||||||
{
|
|
||||||
$I->wantTo('test an online payment');
|
|
||||||
|
|
||||||
$clientEmail = $this->faker->safeEmail;
|
$clientEmail = $this->faker->safeEmail;
|
||||||
$productKey = $this->faker->text(10);
|
$productKey = $this->faker->text(10);
|
||||||
|
$itemTaxRate = $this->faker->randomFloat(2, 5, 15);
|
||||||
|
$itemTaxName = $this->faker->word();
|
||||||
|
$invoiceTaxRate = $this->faker->randomFloat(2, 5, 15);
|
||||||
|
$invoiceTaxName = $this->faker->word();
|
||||||
|
$itemCost = $this->faker->numberBetween(1, 20);
|
||||||
|
|
||||||
// set gateway info
|
$total = $itemCost;
|
||||||
$I->wantTo('create a gateway');
|
$total += round($itemCost * $itemTaxRate / 100, 2);
|
||||||
$I->amOnPage('/settings/online_payments');
|
$total += round($itemCost * $invoiceTaxRate / 100, 2);
|
||||||
|
|
||||||
if (strpos($I->grabFromCurrentUrl(), 'create') !== false) {
|
// create tax rates
|
||||||
$I->fillField(['name' =>'23_apiKey'], Fixtures::get('gateway_key'));
|
$I->amOnPage('/tax_rates/create');
|
||||||
$I->selectOption('#token_billing_type_id', 4);
|
$I->fillField(['name' => 'name'], $itemTaxName);
|
||||||
$I->click('Save');
|
$I->fillField(['name' => 'rate'], $itemTaxRate);
|
||||||
$I->see('Successfully created gateway');
|
$I->click('Save');
|
||||||
}
|
$I->see($itemTaxName);
|
||||||
|
|
||||||
|
$I->amOnPage('/tax_rates/create');
|
||||||
|
$I->fillField(['name' => 'name'], $invoiceTaxName);
|
||||||
|
$I->fillField(['name' => 'rate'], $invoiceTaxRate);
|
||||||
|
$I->click('Save');
|
||||||
|
$I->see($invoiceTaxName);
|
||||||
|
|
||||||
|
// enable line item taxes
|
||||||
|
$I->amOnPage('/settings/tax_rates');
|
||||||
|
$I->checkOption('#invoice_item_taxes');
|
||||||
|
$I->click('Save');
|
||||||
|
|
||||||
|
// create product
|
||||||
|
$I->amOnPage('/products/create');
|
||||||
|
$I->fillField(['name' => 'product_key'], $productKey);
|
||||||
|
$I->fillField(['name' => 'notes'], $this->faker->text(80));
|
||||||
|
$I->fillField(['name' => 'cost'], $itemCost);
|
||||||
|
$I->selectOption('select[name=default_tax_rate_id]', $itemTaxName . ' ' . $itemTaxRate . '%');
|
||||||
|
$I->click('Save');
|
||||||
|
$I->wait(1);
|
||||||
|
$I->see($productKey);
|
||||||
|
|
||||||
// create client
|
// create client
|
||||||
$I->amOnPage('/clients/create');
|
$I->amOnPage('/clients/create');
|
||||||
@ -45,59 +65,24 @@ class TaxRatesCest
|
|||||||
$I->click('Save');
|
$I->click('Save');
|
||||||
$I->see($clientEmail);
|
$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 invoice
|
// create invoice
|
||||||
$I->amOnPage('/invoices/create');
|
$I->amOnPage('/invoices/create');
|
||||||
$I->selectDropdown($I, $clientEmail, '.client_select .dropdown-toggle');
|
$I->selectDropdown($I, $clientEmail, '.client_select .dropdown-toggle');
|
||||||
$I->fillField('table.invoice-table tbody tr:nth-child(1) #product_key', $productKey);
|
$I->fillField('table.invoice-table tbody tr:nth-child(1) #product_key', $productKey);
|
||||||
|
$I->selectOption('#taxRateSelect', $invoiceTaxName . ' ' . $invoiceTaxRate . '%');
|
||||||
|
$I->wait(2);
|
||||||
|
|
||||||
|
// check total is right before saving
|
||||||
|
$I->see("\${$total}");
|
||||||
$I->click('Save');
|
$I->click('Save');
|
||||||
$I->see($clientEmail);
|
$I->see($clientEmail);
|
||||||
|
|
||||||
// enter payment
|
// check total is right after saving
|
||||||
$clientId = $I->grabFromDatabase('contacts', 'client_id', ['email' => $clientEmail]);
|
$I->see("\${$total}");
|
||||||
$invoiceId = $I->grabFromDatabase('invoices', 'id', ['client_id' => $clientId]);
|
$I->amOnPage('/invoices');
|
||||||
$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('Pay Now');
|
|
||||||
|
|
||||||
$I->fillField(['name' => 'first_name'], $this->faker->firstName);
|
|
||||||
$I->fillField(['name' => 'last_name'], $this->faker->lastName);
|
|
||||||
$I->fillField(['name' => 'address1'], $this->faker->streetAddress);
|
|
||||||
$I->fillField(['name' => 'address2'], $this->faker->streetAddress);
|
|
||||||
$I->fillField(['name' => 'city'], $this->faker->city);
|
|
||||||
$I->fillField(['name' => 'state'], $this->faker->state);
|
|
||||||
$I->fillField(['name' => 'postal_code'], $this->faker->postcode);
|
|
||||||
$I->selectDropdown($I, 'United States', '.country-select .dropdown-toggle');
|
|
||||||
$I->fillField(['name' => 'card_number'], '4242424242424242');
|
|
||||||
$I->fillField(['name' => 'cvv'], '1234');
|
|
||||||
$I->selectOption('#expiration_month', 12);
|
|
||||||
$I->selectOption('#expiration_year', date('Y'));
|
|
||||||
$I->click('.btn-success');
|
|
||||||
$I->see('Successfully applied payment');
|
|
||||||
});
|
|
||||||
|
|
||||||
$I->wait(1);
|
|
||||||
|
|
||||||
// create recurring invoice and auto-bill
|
|
||||||
$I->amOnPage('/recurring_invoices/create');
|
|
||||||
$I->selectDropdown($I, $clientEmail, '.client_select .dropdown-toggle');
|
|
||||||
$I->fillField('table.invoice-table tbody tr:nth-child(1) #product_key', $productKey);
|
|
||||||
$I->checkOption('#auto_bill');
|
|
||||||
$I->executeJS('preparePdfData(\'email\')');
|
|
||||||
$I->wait(2);
|
|
||||||
$I->see("$0.00");
|
|
||||||
|
|
||||||
|
// check total is right in list view
|
||||||
|
$I->see("\${$total}");
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user