mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Working on tests
This commit is contained in:
parent
3d6af09a69
commit
f32ae9f3a7
@ -55,7 +55,7 @@ class TaskCest
|
|||||||
$I->click('Invoice Task');
|
$I->click('Invoice Task');
|
||||||
$I->click('Mark Sent');
|
$I->click('Mark Sent');
|
||||||
$I->see('Sent');
|
$I->see('Sent');
|
||||||
$I->see('View as recipient');
|
$I->see('Successfully created invoice');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createManualTask(AcceptanceTester $I)
|
public function createManualTask(AcceptanceTester $I)
|
||||||
|
@ -14,9 +14,9 @@ class TaxRatesCest
|
|||||||
$this->faker = Factory::create();
|
$this->faker = Factory::create();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function taxRates(AcceptanceTester $I)
|
public function lineItemTaxRates(AcceptanceTester $I)
|
||||||
{
|
{
|
||||||
$I->wantTo('test tax rates');
|
$I->wantTo('test line item tax rates');
|
||||||
|
|
||||||
$clientEmail = $this->faker->safeEmail;
|
$clientEmail = $this->faker->safeEmail;
|
||||||
$productKey = $this->faker->text(10);
|
$productKey = $this->faker->text(10);
|
||||||
@ -40,7 +40,6 @@ class TaxRatesCest
|
|||||||
// enable line item taxes
|
// enable line item taxes
|
||||||
$I->amOnPage('/settings/tax_rates');
|
$I->amOnPage('/settings/tax_rates');
|
||||||
$I->checkOption('#invoice_item_taxes');
|
$I->checkOption('#invoice_item_taxes');
|
||||||
$I->selectOption('#default_tax_rate_id', 1);
|
|
||||||
$I->click('Save');
|
$I->click('Save');
|
||||||
|
|
||||||
// create product
|
// create product
|
||||||
@ -82,4 +81,70 @@ class TaxRatesCest
|
|||||||
$I->see("\${$total}");
|
$I->see("\${$total}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function invoiceTaxRates(AcceptanceTester $I)
|
||||||
|
{
|
||||||
|
$I->wantTo('test invoice tax rates');
|
||||||
|
|
||||||
|
$clientEmail = $this->faker->safeEmail;
|
||||||
|
$productKey = $this->faker->text(10);
|
||||||
|
$invoiceTaxRate = $this->faker->randomFloat(2, 5, 15);
|
||||||
|
$invoiceTaxName = $this->faker->word();
|
||||||
|
$itemCost = $this->faker->numberBetween(1, 20);
|
||||||
|
|
||||||
|
$total = $itemCost;
|
||||||
|
$total += round($itemCost * $invoiceTaxRate / 100, 2);
|
||||||
|
|
||||||
|
$invoiceTaxRate = number_format($invoiceTaxRate, 3);
|
||||||
|
|
||||||
|
// create tax rates
|
||||||
|
$I->createTaxRate($I, $invoiceTaxName, $invoiceTaxRate);
|
||||||
|
|
||||||
|
// enable line item taxes
|
||||||
|
$I->amOnPage('/settings/tax_rates');
|
||||||
|
$I->selectOption('#default_tax_rate_id', $invoiceTaxName . ': ' . $invoiceTaxRate . '%');
|
||||||
|
$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->click('Save');
|
||||||
|
$I->wait(1);
|
||||||
|
//$I->see($productKey);
|
||||||
|
|
||||||
|
// create client
|
||||||
|
$I->amOnPage('/clients/create');
|
||||||
|
$I->fillField(['name' => 'contacts[0][email]'], $clientEmail);
|
||||||
|
$I->click('Save');
|
||||||
|
$I->see($clientEmail);
|
||||||
|
|
||||||
|
// create invoice
|
||||||
|
$I->amOnPage('/invoices/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->wait(3);
|
||||||
|
|
||||||
|
// check total is right before saving
|
||||||
|
$I->see("\${$total}");
|
||||||
|
$I->click('Save Draft');
|
||||||
|
$I->wait(3);
|
||||||
|
$I->see($clientEmail);
|
||||||
|
|
||||||
|
// check total is right after saving
|
||||||
|
$I->see("\${$total}");
|
||||||
|
$I->amOnPage('/invoices');
|
||||||
|
$I->wait(2);
|
||||||
|
|
||||||
|
// check total is right in list view
|
||||||
|
$I->see("\${$total}");
|
||||||
|
|
||||||
|
// enable line item taxes
|
||||||
|
$I->amOnPage('/settings/tax_rates');
|
||||||
|
$I->selectOption('#default_tax_rate_id', '');
|
||||||
|
$I->click('Save');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user