Working on tests

This commit is contained in:
Hillel Coren 2016-06-07 17:07:28 +03:00
parent 73ab6a308b
commit a1f0461e02

View File

@ -17,7 +17,7 @@ class CheckBalanceCest
public function checkBalance(AcceptanceTester $I) public function checkBalance(AcceptanceTester $I)
{ {
$I->wantTo('ensure the balance is correct'); $I->wantTo('ensure the balance is correct');
$clientEmail = $this->faker->safeEmail; $clientEmail = $this->faker->safeEmail;
$productKey = $this->faker->text(10); $productKey = $this->faker->text(10);
$productPrice = $this->faker->numberBetween(1, 20); $productPrice = $this->faker->numberBetween(1, 20);
@ -30,7 +30,7 @@ class CheckBalanceCest
$I->see($clientEmail); $I->see($clientEmail);
$clientId = $I->grabFromCurrentUrl('~clients/(\d+)~'); $clientId = $I->grabFromCurrentUrl('~clients/(\d+)~');
// create product // create product
$I->amOnPage('/products/create'); $I->amOnPage('/products/create');
$I->fillField(['name' => 'product_key'], $productKey); $I->fillField(['name' => 'product_key'], $productKey);
@ -39,7 +39,7 @@ class CheckBalanceCest
$I->click('Save'); $I->click('Save');
$I->wait(1); $I->wait(1);
$I->see($productKey); $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');
@ -51,7 +51,7 @@ class CheckBalanceCest
$invoiceId = $I->grabFromCurrentUrl('~invoices/(\d+)~'); $invoiceId = $I->grabFromCurrentUrl('~invoices/(\d+)~');
$I->amOnPage("/clients/{$clientId}"); $I->amOnPage("/clients/{$clientId}");
$I->see('Balance $' . $productPrice); $I->see('Balance $' . $productPrice);
// update the invoice // update the invoice
$I->amOnPage('/invoices/' . $invoiceId); $I->amOnPage('/invoices/' . $invoiceId);
$I->fillField(['name' => 'invoice_items[0][qty]'], 2); $I->fillField(['name' => 'invoice_items[0][qty]'], 2);
@ -67,6 +67,7 @@ class CheckBalanceCest
$I->see('Balance $0.00'); $I->see('Balance $0.00');
$I->see('Paid to Date $' . ($productPrice * 2)); $I->see('Paid to Date $' . ($productPrice * 2));
/*
// archive the invoice // archive the invoice
$I->amOnPage('/invoices/' . $invoiceId); $I->amOnPage('/invoices/' . $invoiceId);
$I->executeJS('submitBulkAction("archive")'); $I->executeJS('submitBulkAction("archive")');
@ -74,7 +75,8 @@ class CheckBalanceCest
$I->amOnPage("/clients/{$clientId}"); $I->amOnPage("/clients/{$clientId}");
$I->see('Balance $0.00'); $I->see('Balance $0.00');
$I->see('Paid to Date $' . ($productPrice * 2)); $I->see('Paid to Date $' . ($productPrice * 2));
*/
// delete the invoice // delete the invoice
$I->amOnPage('/invoices/' . $invoiceId); $I->amOnPage('/invoices/' . $invoiceId);
$I->executeJS('submitBulkAction("delete")'); $I->executeJS('submitBulkAction("delete")');
@ -91,4 +93,4 @@ class CheckBalanceCest
$I->see('Balance $0.00'); $I->see('Balance $0.00');
$I->see('Paid to Date $' . ($productPrice * 2)); $I->see('Paid to Date $' . ($productPrice * 2));
} }
} }